path
stringlengths
5
300
repo_name
stringlengths
6
76
content
stringlengths
26
1.05M
src/routes/content/index.js
DanielHabib/Float
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import Content from './Content'; import fetch from '../../core/fetch'; export default { path: '*', async action({ path }) { // eslint-disable-line react/prop-types const resp = await fetch('/graphql', { method: 'post', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ query: `{content(path:"${path}"){path,title,content,component}}`, }), credentials: 'include', }); if (resp.status !== 200) throw new Error(resp.statusText); const { data } = await resp.json(); if (!data || !data.content) return undefined; return <Content {...data.content} />; }, };
packages/material-ui-icons/src/BatteryCharging60TwoTone.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V11h3.87L13 7v4h4V5.33C17 4.6 16.4 4 15.67 4z" /><path d="M13 12.5h2L11 20v-5.5H9l1.87-3.5H7v9.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V11h-4v1.5z" /></React.Fragment> , 'BatteryCharging60TwoTone');
plugins/jQRangeSlider/jQEditRangeSlider-min.js
WatchSMS/Dashboard
/*! jQRangeSlider 5.7.2 - 2016-01-18 - Copyright (C) Guillaume Gautreau 2012 - MIT and GPLv3 licenses.*/!function(a,b){"use strict";a.widget("ui.rangeSliderMouseTouch",a.ui.mouse,{enabled:!0,_mouseInit:function(){var b=this;a.ui.mouse.prototype._mouseInit.apply(this),this._mouseDownEvent=!1,this.element.bind("touchstart."+this.widgetName,function(a){return b._touchStart(a)})},_mouseDestroy:function(){a(document).unbind("touchmove."+this.widgetName,this._touchMoveDelegate).unbind("touchend."+this.widgetName,this._touchEndDelegate),a.ui.mouse.prototype._mouseDestroy.apply(this)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},destroy:function(){this._mouseDestroy(),a.ui.mouse.prototype.destroy.apply(this),this._mouseInit=null},_touchStart:function(b){if(!this.enabled)return!1;b.which=1,b.preventDefault(),this._fillTouchEvent(b);var c=this,d=this._mouseDownEvent;this._mouseDown(b),d!==this._mouseDownEvent&&(this._touchEndDelegate=function(a){c._touchEnd(a)},this._touchMoveDelegate=function(a){c._touchMove(a)},a(document).bind("touchmove."+this.widgetName,this._touchMoveDelegate).bind("touchend."+this.widgetName,this._touchEndDelegate))},_mouseDown:function(b){return this.enabled?a.ui.mouse.prototype._mouseDown.apply(this,[b]):!1},_touchEnd:function(b){this._fillTouchEvent(b),this._mouseUp(b),a(document).unbind("touchmove."+this.widgetName,this._touchMoveDelegate).unbind("touchend."+this.widgetName,this._touchEndDelegate),this._mouseDownEvent=!1,a(document).trigger("mouseup")},_touchMove:function(a){return a.preventDefault(),this._fillTouchEvent(a),this._mouseMove(a)},_fillTouchEvent:function(a){var b;b="undefined"==typeof a.targetTouches&&"undefined"==typeof a.changedTouches?a.originalEvent.targetTouches[0]||a.originalEvent.changedTouches[0]:a.targetTouches[0]||a.changedTouches[0],a.pageX=b.pageX,a.pageY=b.pageY,a.which=1}})}(jQuery),function(a,b){"use strict";a.widget("ui.rangeSliderDraggable",a.ui.rangeSliderMouseTouch,{cache:null,options:{containment:null},_create:function(){a.ui.rangeSliderMouseTouch.prototype._create.apply(this),setTimeout(a.proxy(this._initElementIfNotDestroyed,this),10)},destroy:function(){this.cache=null,a.ui.rangeSliderMouseTouch.prototype.destroy.apply(this)},_initElementIfNotDestroyed:function(){this._mouseInit&&this._initElement()},_initElement:function(){this._mouseInit(),this._cache()},_setOption:function(b,c){"containment"===b&&(null===c||0===a(c).length?this.options.containment=null:this.options.containment=a(c))},_mouseStart:function(a){return this._cache(),this.cache.click={left:a.pageX,top:a.pageY},this.cache.initialOffset=this.element.offset(),this._triggerMouseEvent("mousestart"),!0},_mouseDrag:function(a){var b=a.pageX-this.cache.click.left;return b=this._constraintPosition(b+this.cache.initialOffset.left),this._applyPosition(b),this._triggerMouseEvent("sliderDrag"),!1},_mouseStop:function(){this._triggerMouseEvent("stop")},_constraintPosition:function(a){return 0!==this.element.parent().length&&null!==this.cache.parent.offset&&(a=Math.min(a,this.cache.parent.offset.left+this.cache.parent.width-this.cache.width.outer),a=Math.max(a,this.cache.parent.offset.left)),a},_applyPosition:function(a){this._cacheIfNecessary();var b={top:this.cache.offset.top,left:a};this.element.offset({left:a}),this.cache.offset=b},_cacheIfNecessary:function(){null===this.cache&&this._cache()},_cache:function(){this.cache={},this._cacheMargins(),this._cacheParent(),this._cacheDimensions(),this.cache.offset=this.element.offset()},_cacheMargins:function(){this.cache.margin={left:this._parsePixels(this.element,"marginLeft"),right:this._parsePixels(this.element,"marginRight"),top:this._parsePixels(this.element,"marginTop"),bottom:this._parsePixels(this.element,"marginBottom")}},_cacheParent:function(){if(null!==this.options.parent){var a=this.element.parent();this.cache.parent={offset:a.offset(),width:a.width()}}else this.cache.parent=null},_cacheDimensions:function(){this.cache.width={outer:this.element.outerWidth(),inner:this.element.width()}},_parsePixels:function(a,b){return parseInt(a.css(b),10)||0},_triggerMouseEvent:function(a){var b=this._prepareEventData();this.element.trigger(a,b)},_prepareEventData:function(){return{element:this.element,offset:this.cache.offset||null}}})}(jQuery),function(a,b){"use strict";a.widget("ui.rangeSlider",{options:{bounds:{min:0,max:100},defaultValues:{min:20,max:50},wheelMode:null,wheelSpeed:4,arrows:!0,valueLabels:"show",formatter:null,durationIn:0,durationOut:400,delayOut:200,range:{min:!1,max:!1},step:!1,scales:!1,enabled:!0,symmetricPositionning:!1},_values:null,_valuesChanged:!1,_initialized:!1,bar:null,leftHandle:null,rightHandle:null,innerBar:null,container:null,arrows:null,labels:null,changing:{min:!1,max:!1},changed:{min:!1,max:!1},ruler:null,_create:function(){this._setDefaultValues(),this.labels={left:null,right:null,leftDisplayed:!0,rightDisplayed:!0},this.arrows={left:null,right:null},this.changing={min:!1,max:!1},this.changed={min:!1,max:!1},this._createElements(),this._bindResize(),setTimeout(a.proxy(this.resize,this),1),setTimeout(a.proxy(this._initValues,this),1)},_setDefaultValues:function(){this._values={min:this.options.defaultValues.min,max:this.options.defaultValues.max}},_bindResize:function(){var b=this;this._resizeProxy=function(a){b.resize(a)},a(window).resize(this._resizeProxy)},_initWidth:function(){this.container.css("width",this.element.width()-this.container.outerWidth(!0)+this.container.width()),this.innerBar.css("width",this.container.width()-this.innerBar.outerWidth(!0)+this.innerBar.width())},_initValues:function(){this._initialized=!0,this.values(this._values.min,this._values.max)},_setOption:function(a,b){this._setWheelOption(a,b),this._setArrowsOption(a,b),this._setLabelsOption(a,b),this._setLabelsDurations(a,b),this._setFormatterOption(a,b),this._setBoundsOption(a,b),this._setRangeOption(a,b),this._setStepOption(a,b),this._setScalesOption(a,b),this._setEnabledOption(a,b),this._setPositionningOption(a,b)},_validProperty:function(a,b,c){return null===a||"undefined"==typeof a[b]?c:a[b]},_setStepOption:function(a,b){"step"===a&&(this.options.step=b,this._leftHandle("option","step",b),this._rightHandle("option","step",b),this._changed(!0))},_setScalesOption:function(a,b){"scales"===a&&(b===!1||null===b?(this.options.scales=!1,this._destroyRuler()):b instanceof Array&&(this.options.scales=b,this._updateRuler()))},_setRangeOption:function(a,b){"range"===a&&(this._bar("option","range",b),this.options.range=this._bar("option","range"),this._changed(!0))},_setBoundsOption:function(a,b){"bounds"===a&&"undefined"!=typeof b.min&&"undefined"!=typeof b.max&&this.bounds(b.min,b.max)},_setWheelOption:function(a,b){("wheelMode"===a||"wheelSpeed"===a)&&(this._bar("option",a,b),this.options[a]=this._bar("option",a))},_setLabelsOption:function(a,b){if("valueLabels"===a){if("hide"!==b&&"show"!==b&&"change"!==b)return;this.options.valueLabels=b,"hide"!==b?(this._createLabels(),this._leftLabel("update"),this._rightLabel("update")):this._destroyLabels()}},_setFormatterOption:function(a,b){"formatter"===a&&null!==b&&"function"==typeof b&&"hide"!==this.options.valueLabels&&(this._leftLabel("option","formatter",b),this.options.formatter=this._rightLabel("option","formatter",b))},_setArrowsOption:function(a,b){"arrows"!==a||b!==!0&&b!==!1||b===this.options.arrows||(b===!0?(this.element.removeClass("ui-rangeSlider-noArrow").addClass("ui-rangeSlider-withArrows"),this.arrows.left.css("display","block"),this.arrows.right.css("display","block"),this.options.arrows=!0):b===!1&&(this.element.addClass("ui-rangeSlider-noArrow").removeClass("ui-rangeSlider-withArrows"),this.arrows.left.css("display","none"),this.arrows.right.css("display","none"),this.options.arrows=!1),this._initWidth())},_setLabelsDurations:function(a,b){if("durationIn"===a||"durationOut"===a||"delayOut"===a){if(parseInt(b,10)!==b)return;null!==this.labels.left&&this._leftLabel("option",a,b),null!==this.labels.right&&this._rightLabel("option",a,b),this.options[a]=b}},_setEnabledOption:function(a,b){"enabled"===a&&this.toggle(b)},_setPositionningOption:function(a,b){"symmetricPositionning"===a&&(this._rightHandle("option",a,b),this.options[a]=this._leftHandle("option",a,b))},_createElements:function(){"absolute"!==this.element.css("position")&&this.element.css("position","relative"),this.element.addClass("ui-rangeSlider"),this.container=a("<div class='ui-rangeSlider-container' />").css("position","absolute").appendTo(this.element),this.innerBar=a("<div class='ui-rangeSlider-innerBar' />").css("position","absolute").css("top",0).css("left",0),this._createHandles(),this._createBar(),this.container.prepend(this.innerBar),this._createArrows(),"hide"!==this.options.valueLabels?this._createLabels():this._destroyLabels(),this._updateRuler(),this.options.enabled||this._toggle(this.options.enabled)},_createHandle:function(b){return a("<div />")[this._handleType()](b).bind("sliderDrag",a.proxy(this._changing,this)).bind("stop",a.proxy(this._changed,this))},_createHandles:function(){this.leftHandle=this._createHandle({isLeft:!0,bounds:this.options.bounds,value:this._values.min,step:this.options.step,symmetricPositionning:this.options.symmetricPositionning}).appendTo(this.container),this.rightHandle=this._createHandle({isLeft:!1,bounds:this.options.bounds,value:this._values.max,step:this.options.step,symmetricPositionning:this.options.symmetricPositionning}).appendTo(this.container)},_createBar:function(){this.bar=a("<div />").prependTo(this.container).bind("sliderDrag scroll zoom",a.proxy(this._changing,this)).bind("stop",a.proxy(this._changed,this)),this._bar({leftHandle:this.leftHandle,rightHandle:this.rightHandle,values:{min:this._values.min,max:this._values.max},type:this._handleType(),range:this.options.range,wheelMode:this.options.wheelMode,wheelSpeed:this.options.wheelSpeed}),this.options.range=this._bar("option","range"),this.options.wheelMode=this._bar("option","wheelMode"),this.options.wheelSpeed=this._bar("option","wheelSpeed")},_createArrows:function(){this.arrows.left=this._createArrow("left"),this.arrows.right=this._createArrow("right"),this.options.arrows?this.element.addClass("ui-rangeSlider-withArrows"):(this.arrows.left.css("display","none"),this.arrows.right.css("display","none"),this.element.addClass("ui-rangeSlider-noArrow"))},_createArrow:function(b){var c,d=a("<div class='ui-rangeSlider-arrow' />").append("<div class='ui-rangeSlider-arrow-inner' />").addClass("ui-rangeSlider-"+b+"Arrow").css("position","absolute").css(b,0).appendTo(this.element);return c="right"===b?a.proxy(this._scrollRightClick,this):a.proxy(this._scrollLeftClick,this),d.bind("mousedown touchstart",c),d},_proxy:function(a,b,c){var d=Array.prototype.slice.call(c);return a&&a[b]?a[b].apply(a,d):null},_handleType:function(){return"rangeSliderHandle"},_barType:function(){return"rangeSliderBar"},_bar:function(){return this._proxy(this.bar,this._barType(),arguments)},_labelType:function(){return"rangeSliderLabel"},_leftLabel:function(){return this._proxy(this.labels.left,this._labelType(),arguments)},_rightLabel:function(){return this._proxy(this.labels.right,this._labelType(),arguments)},_leftHandle:function(){return this._proxy(this.leftHandle,this._handleType(),arguments)},_rightHandle:function(){return this._proxy(this.rightHandle,this._handleType(),arguments)},_getValue:function(a,b){return b===this.rightHandle&&(a-=b.outerWidth()),a*(this.options.bounds.max-this.options.bounds.min)/(this.container.innerWidth()-b.outerWidth(!0))+this.options.bounds.min},_trigger:function(a){var b=this;setTimeout(function(){b.element.trigger(a,{label:b.element,values:b.values()})},1)},_changing:function(){this._updateValues()&&(this._trigger("valuesChanging"),this._valuesChanged=!0)},_deactivateLabels:function(){"change"===this.options.valueLabels&&(this._leftLabel("option","show","hide"),this._rightLabel("option","show","hide"))},_reactivateLabels:function(){"change"===this.options.valueLabels&&(this._leftLabel("option","show","change"),this._rightLabel("option","show","change"))},_changed:function(a){a===!0&&this._deactivateLabels(),(this._updateValues()||this._valuesChanged)&&(this._trigger("valuesChanged"),a!==!0&&this._trigger("userValuesChanged"),this._valuesChanged=!1),a===!0&&this._reactivateLabels()},_updateValues:function(){var a=this._leftHandle("value"),b=this._rightHandle("value"),c=this._min(a,b),d=this._max(a,b),e=c!==this._values.min||d!==this._values.max;return this._values.min=this._min(a,b),this._values.max=this._max(a,b),e},_min:function(a,b){return Math.min(a,b)},_max:function(a,b){return Math.max(a,b)},_createLabel:function(b,c){var d;return null===b?(d=this._getLabelConstructorParameters(b,c),b=a("<div />").appendTo(this.element)[this._labelType()](d)):(d=this._getLabelRefreshParameters(b,c),b[this._labelType()](d)),b},_getLabelConstructorParameters:function(a,b){return{handle:b,handleType:this._handleType(),formatter:this._getFormatter(),show:this.options.valueLabels,durationIn:this.options.durationIn,durationOut:this.options.durationOut,delayOut:this.options.delayOut}},_getLabelRefreshParameters:function(){return{formatter:this._getFormatter(),show:this.options.valueLabels,durationIn:this.options.durationIn,durationOut:this.options.durationOut,delayOut:this.options.delayOut}},_getFormatter:function(){return this.options.formatter===!1||null===this.options.formatter?this._defaultFormatter:this.options.formatter},_defaultFormatter:function(a){return Math.round(a)},_destroyLabel:function(a){return null!==a&&(a[this._labelType()]("destroy"),a.remove(),a=null),a},_createLabels:function(){this.labels.left=this._createLabel(this.labels.left,this.leftHandle),this.labels.right=this._createLabel(this.labels.right,this.rightHandle),this._leftLabel("pair",this.labels.right)},_destroyLabels:function(){this.labels.left=this._destroyLabel(this.labels.left),this.labels.right=this._destroyLabel(this.labels.right)},_stepRatio:function(){return this._leftHandle("stepRatio")},_scrollRightClick:function(a){return this.options.enabled?(a.preventDefault(),this._bar("startScroll"),this._bindStopScroll(),void this._continueScrolling("scrollRight",4*this._stepRatio(),1)):!1},_continueScrolling:function(a,b,c,d){if(!this.options.enabled)return!1;this._bar(a,c),d=d||5,d--;var e=this,f=16,g=Math.max(1,4/this._stepRatio());this._scrollTimeout=setTimeout(function(){0===d&&(b>f?b=Math.max(f,b/1.5):c=Math.min(g,2*c),d=5),e._continueScrolling(a,b,c,d)},b)},_scrollLeftClick:function(a){return this.options.enabled?(a.preventDefault(),this._bar("startScroll"),this._bindStopScroll(),void this._continueScrolling("scrollLeft",4*this._stepRatio(),1)):!1},_bindStopScroll:function(){var b=this;this._stopScrollHandle=function(a){a.preventDefault(),b._stopScroll()},a(document).bind("mouseup touchend",this._stopScrollHandle)},_stopScroll:function(){a(document).unbind("mouseup touchend",this._stopScrollHandle),this._stopScrollHandle=null,this._bar("stopScroll"),clearTimeout(this._scrollTimeout)},_createRuler:function(){this.ruler=a("<div class='ui-rangeSlider-ruler' />").appendTo(this.innerBar)},_setRulerParameters:function(){this.ruler.ruler({min:this.options.bounds.min,max:this.options.bounds.max,scales:this.options.scales})},_destroyRuler:function(){null!==this.ruler&&a.fn.ruler&&(this.ruler.ruler("destroy"),this.ruler.remove(),this.ruler=null)},_updateRuler:function(){this._destroyRuler(),this.options.scales!==!1&&a.fn.ruler&&(this._createRuler(),this._setRulerParameters())},values:function(a,b){var c;if("undefined"!=typeof a&&"undefined"!=typeof b){if(!this._initialized)return this._values.min=a,this._values.max=b,this._values;this._deactivateLabels(),c=this._bar("values",a,b),this._changed(!0),this._reactivateLabels()}else c=this._bar("values",a,b);return c},min:function(a){return this._values.min=this.values(a,this._values.max).min,this._values.min},max:function(a){return this._values.max=this.values(this._values.min,a).max,this._values.max},bounds:function(a,b){return this._isValidValue(a)&&this._isValidValue(b)&&b>a&&(this._setBounds(a,b),this._updateRuler(),this._changed(!0)),this.options.bounds},_isValidValue:function(a){return"undefined"!=typeof a&&parseFloat(a)===a},_setBounds:function(a,b){this.options.bounds={min:a,max:b},this._leftHandle("option","bounds",this.options.bounds),this._rightHandle("option","bounds",this.options.bounds),this._bar("option","bounds",this.options.bounds)},zoomIn:function(a){this._bar("zoomIn",a)},zoomOut:function(a){this._bar("zoomOut",a)},scrollLeft:function(a){this._bar("startScroll"),this._bar("scrollLeft",a),this._bar("stopScroll")},scrollRight:function(a){this._bar("startScroll"),this._bar("scrollRight",a),this._bar("stopScroll")},resize:function(){this.container&&(this._initWidth(),this._leftHandle("update"),this._rightHandle("update"),this._bar("update"))},enable:function(){this.toggle(!0)},disable:function(){this.toggle(!1)},toggle:function(a){a===b&&(a=!this.options.enabled),this.options.enabled!==a&&this._toggle(a)},_toggle:function(a){this.options.enabled=a,this.element.toggleClass("ui-rangeSlider-disabled",!a);var b=a?"enable":"disable";this._bar(b),this._leftHandle(b),this._rightHandle(b),this._leftLabel(b),this._rightLabel(b)},destroy:function(){this.element.removeClass("ui-rangeSlider-withArrows ui-rangeSlider-noArrow ui-rangeSlider-disabled"),this._destroyWidgets(),this._destroyElements(),this.element.removeClass("ui-rangeSlider"),this.options=null,a(window).unbind("resize",this._resizeProxy),this._resizeProxy=null,this._bindResize=null,a.Widget.prototype.destroy.apply(this,arguments)},_destroyWidget:function(a){this["_"+a]("destroy"),this[a].remove(),this[a]=null},_destroyWidgets:function(){this._destroyWidget("bar"),this._destroyWidget("leftHandle"),this._destroyWidget("rightHandle"),this._destroyRuler(),this._destroyLabels()},_destroyElements:function(){this.container.remove(),this.container=null,this.innerBar.remove(),this.innerBar=null,this.arrows.left.remove(),this.arrows.right.remove(),this.arrows=null}})}(jQuery),function(a,b){"use strict";a.widget("ui.rangeSliderHandle",a.ui.rangeSliderDraggable,{currentMove:null,margin:0,parentElement:null,options:{isLeft:!0,bounds:{min:0,max:100},range:!1,value:0,step:!1},_value:0,_left:0,_create:function(){a.ui.rangeSliderDraggable.prototype._create.apply(this),this.element.css("position","absolute").css("top",0).addClass("ui-rangeSlider-handle").toggleClass("ui-rangeSlider-leftHandle",this.options.isLeft).toggleClass("ui-rangeSlider-rightHandle",!this.options.isLeft),this.element.append("<div class='ui-rangeSlider-handle-inner' />"),this._value=this._constraintValue(this.options.value)},destroy:function(){this.element.empty(),a.ui.rangeSliderDraggable.prototype.destroy.apply(this)},_setOption:function(b,c){"isLeft"!==b||c!==!0&&c!==!1||c===this.options.isLeft?"step"===b&&this._checkStep(c)?(this.options.step=c,this.update()):"bounds"===b?(this.options.bounds=c,this.update()):"range"===b&&this._checkRange(c)?(this.options.range=c,this.update()):"symmetricPositionning"===b&&(this.options.symmetricPositionning=c===!0,this.update()):(this.options.isLeft=c,this.element.toggleClass("ui-rangeSlider-leftHandle",this.options.isLeft).toggleClass("ui-rangeSlider-rightHandle",!this.options.isLeft),this._position(this._value),this.element.trigger("switch",this.options.isLeft)),a.ui.rangeSliderDraggable.prototype._setOption.apply(this,[b,c])},_checkRange:function(a){return a===!1||!this._isValidValue(a.min)&&!this._isValidValue(a.max)},_isValidValue:function(a){return"undefined"!=typeof a&&a!==!1&&parseFloat(a)!==a},_checkStep:function(a){return a===!1||parseFloat(a)===a},_initElement:function(){a.ui.rangeSliderDraggable.prototype._initElement.apply(this),0===this.cache.parent.width||null===this.cache.parent.width?setTimeout(a.proxy(this._initElementIfNotDestroyed,this),500):(this._position(this._value),this._triggerMouseEvent("initialize"))},_bounds:function(){return this.options.bounds},_cache:function(){a.ui.rangeSliderDraggable.prototype._cache.apply(this),this._cacheParent()},_cacheParent:function(){var a=this.element.parent();this.cache.parent={element:a,offset:a.offset(),padding:{left:this._parsePixels(a,"paddingLeft")},width:a.width()}},_position:function(a){var b=this._getPositionForValue(a);this._applyPosition(b)},_constraintPosition:function(a){var b=this._getValueForPosition(a);return this._getPositionForValue(b)},_applyPosition:function(b){a.ui.rangeSliderDraggable.prototype._applyPosition.apply(this,[b]),this._left=b,this._setValue(this._getValueForPosition(b)),this._triggerMouseEvent("moving")},_prepareEventData:function(){var b=a.ui.rangeSliderDraggable.prototype._prepareEventData.apply(this);return b.value=this._value,b},_setValue:function(a){a!==this._value&&(this._value=a)},_constraintValue:function(a){if(a=Math.min(a,this._bounds().max),a=Math.max(a,this._bounds().min),a=this._round(a),this.options.range!==!1){var b=this.options.range.min||!1,c=this.options.range.max||!1;b!==!1&&(a=Math.max(a,this._round(b))),c!==!1&&(a=Math.min(a,this._round(c))),a=Math.min(a,this._bounds().max),a=Math.max(a,this._bounds().min)}return a},_round:function(a){return this.options.step!==!1&&this.options.step>0?Math.round(a/this.options.step)*this.options.step:a},_getPositionForValue:function(a){if(!this.cache||!this.cache.parent||null===this.cache.parent.offset)return 0;a=this._constraintValue(a);var b=(a-this.options.bounds.min)/(this.options.bounds.max-this.options.bounds.min),c=this.cache.parent.width,d=this.cache.parent.offset.left,e=this.options.isLeft?0:this.cache.width.outer;return this.options.symmetricPositionning?b*(c-2*this.cache.width.outer)+d+e:b*c+d-e},_getValueForPosition:function(a){var b=this._getRawValueForPositionAndBounds(a,this.options.bounds.min,this.options.bounds.max);return this._constraintValue(b)},_getRawValueForPositionAndBounds:function(a,b,c){var d,e,f=null===this.cache.parent.offset?0:this.cache.parent.offset.left;return this.options.symmetricPositionning?(a-=this.options.isLeft?0:this.cache.width.outer,d=this.cache.parent.width-2*this.cache.width.outer):(a+=this.options.isLeft?0:this.cache.width.outer,d=this.cache.parent.width),0===d?this._value:(e=(a-f)/d,e*(c-b)+b)},value:function(a){return"undefined"!=typeof a&&(this._cache(),a=this._constraintValue(a),this._position(a)),this._value},update:function(){this._cache();var a=this._constraintValue(this._value),b=this._getPositionForValue(a);a!==this._value?(this._triggerMouseEvent("updating"),this._position(a),this._triggerMouseEvent("update")):b!==this.cache.offset.left&&(this._triggerMouseEvent("updating"),this._position(a),this._triggerMouseEvent("update"))},position:function(a){return"undefined"!=typeof a&&(this._cache(),a=this._constraintPosition(a),this._applyPosition(a)),this._left},add:function(a,b){return a+b},substract:function(a,b){return a-b},stepsBetween:function(a,b){return this.options.step===!1?b-a:(b-a)/this.options.step},multiplyStep:function(a,b){return a*b},moveRight:function(a){var b;return this.options.step===!1?(b=this._left,this.position(this._left+a),this._left-b):(b=this._value,this.value(this.add(b,this.multiplyStep(this.options.step,a))),this.stepsBetween(b,this._value))},moveLeft:function(a){return-this.moveRight(-a)},stepRatio:function(){if(this.options.step===!1)return 1;var a=(this.options.bounds.max-this.options.bounds.min)/this.options.step;return this.cache.parent.width/a}})}(jQuery),function(a,b){"use strict";function c(a,b){return"undefined"==typeof a?b||!1:a}a.widget("ui.rangeSliderBar",a.ui.rangeSliderDraggable,{options:{leftHandle:null,rightHandle:null,bounds:{min:0,max:100},type:"rangeSliderHandle",range:!1,drag:function(){},stop:function(){},values:{min:0,max:20},wheelSpeed:4,wheelMode:null},_values:{min:0,max:20},_waitingToInit:2,_wheelTimeout:!1,_create:function(){a.ui.rangeSliderDraggable.prototype._create.apply(this),this.element.css("position","absolute").css("top",0).addClass("ui-rangeSlider-bar"),this.options.leftHandle.bind("initialize",a.proxy(this._onInitialized,this)).bind("mousestart",a.proxy(this._cache,this)).bind("stop",a.proxy(this._onHandleStop,this)),this.options.rightHandle.bind("initialize",a.proxy(this._onInitialized,this)).bind("mousestart",a.proxy(this._cache,this)).bind("stop",a.proxy(this._onHandleStop,this)),this._bindHandles(),this._values=this.options.values,this._setWheelModeOption(this.options.wheelMode)},destroy:function(){this.options.leftHandle.unbind(".bar"),this.options.rightHandle.unbind(".bar"),this.options=null,a.ui.rangeSliderDraggable.prototype.destroy.apply(this)},_setOption:function(a,b){"range"===a?this._setRangeOption(b):"wheelSpeed"===a?this._setWheelSpeedOption(b):"wheelMode"===a&&this._setWheelModeOption(b)},_setRangeOption:function(a){if(("object"!=typeof a||null===a)&&(a=!1),a!==!1||this.options.range!==!1){if(a!==!1){var b=c(a.min,this.options.range.min),d=c(a.max,this.options.range.max);this.options.range={min:b,max:d}}else this.options.range=!1;this._setLeftRange(),this._setRightRange()}},_setWheelSpeedOption:function(a){"number"==typeof a&&0!==a&&(this.options.wheelSpeed=a)},_setWheelModeOption:function(a){(null===a||a===!1||"zoom"===a||"scroll"===a)&&(this.options.wheelMode!==a&&this.element.parent().unbind("mousewheel.bar"),this._bindMouseWheel(a),this.options.wheelMode=a)},_bindMouseWheel:function(b){"zoom"===b?this.element.parent().bind("mousewheel.bar",a.proxy(this._mouseWheelZoom,this)):"scroll"===b&&this.element.parent().bind("mousewheel.bar",a.proxy(this._mouseWheelScroll,this))},_setLeftRange:function(){if(this.options.range===!1)return!1;var a=this._values.max,b={min:!1,max:!1};"undefined"!=typeof this.options.range.min&&this.options.range.min!==!1?b.max=this._leftHandle("substract",a,this.options.range.min):b.max=!1,"undefined"!=typeof this.options.range.max&&this.options.range.max!==!1?b.min=this._leftHandle("substract",a,this.options.range.max):b.min=!1,this._leftHandle("option","range",b)},_setRightRange:function(){var a=this._values.min,b={min:!1,max:!1};"undefined"!=typeof this.options.range.min&&this.options.range.min!==!1?b.min=this._rightHandle("add",a,this.options.range.min):b.min=!1,"undefined"!=typeof this.options.range.max&&this.options.range.max!==!1?b.max=this._rightHandle("add",a,this.options.range.max):b.max=!1,this._rightHandle("option","range",b)},_deactivateRange:function(){this._leftHandle("option","range",!1),this._rightHandle("option","range",!1)},_reactivateRange:function(){this._setRangeOption(this.options.range)},_onInitialized:function(){this._waitingToInit--,0===this._waitingToInit&&this._initMe()},_initMe:function(){this._cache(),this.min(this._values.min),this.max(this._values.max);var a=this._leftHandle("position"),b=this._rightHandle("position")+this.options.rightHandle.width();this.element.offset({left:a}),this.element.css("width",b-a)},_leftHandle:function(){return this._handleProxy(this.options.leftHandle,arguments)},_rightHandle:function(){return this._handleProxy(this.options.rightHandle,arguments)},_handleProxy:function(a,b){var c=Array.prototype.slice.call(b);return a[this.options.type].apply(a,c)},_cache:function(){a.ui.rangeSliderDraggable.prototype._cache.apply(this),this._cacheHandles()},_cacheHandles:function(){this.cache.rightHandle={},this.cache.rightHandle.width=this.options.rightHandle.width(),this.cache.rightHandle.offset=this.options.rightHandle.offset(),this.cache.leftHandle={},this.cache.leftHandle.offset=this.options.leftHandle.offset()},_mouseStart:function(b){a.ui.rangeSliderDraggable.prototype._mouseStart.apply(this,[b]),this._deactivateRange()},_mouseStop:function(b){a.ui.rangeSliderDraggable.prototype._mouseStop.apply(this,[b]),this._cacheHandles(),this._values.min=this._leftHandle("value"),this._values.max=this._rightHandle("value"),this._reactivateRange(),this._leftHandle().trigger("stop"),this._rightHandle().trigger("stop")},_onDragLeftHandle:function(a,b){if(this._cacheIfNecessary(),b.element[0]===this.options.leftHandle[0]){if(this._switchedValues())return this._switchHandles(),void this._onDragRightHandle(a,b);this._values.min=b.value,this.cache.offset.left=b.offset.left,this.cache.leftHandle.offset=b.offset,this._positionBar()}},_onDragRightHandle:function(a,b){if(this._cacheIfNecessary(),b.element[0]===this.options.rightHandle[0]){if(this._switchedValues())return this._switchHandles(),void this._onDragLeftHandle(a,b);this._values.max=b.value,this.cache.rightHandle.offset=b.offset,this._positionBar()}},_positionBar:function(){var a=this.cache.rightHandle.offset.left+this.cache.rightHandle.width-this.cache.leftHandle.offset.left;this.cache.width.inner=a,this.element.css("width",a).offset({left:this.cache.leftHandle.offset.left})},_onHandleStop:function(){this._setLeftRange(),this._setRightRange()},_switchedValues:function(){if(this.min()>this.max()){var a=this._values.min;return this._values.min=this._values.max,this._values.max=a,!0}return!1},_switchHandles:function(){var a=this.options.leftHandle;this.options.leftHandle=this.options.rightHandle,this.options.rightHandle=a,this._leftHandle("option","isLeft",!0),this._rightHandle("option","isLeft",!1),this._bindHandles(),this._cacheHandles()},_bindHandles:function(){this.options.leftHandle.unbind(".bar").bind("sliderDrag.bar update.bar moving.bar",a.proxy(this._onDragLeftHandle,this)),this.options.rightHandle.unbind(".bar").bind("sliderDrag.bar update.bar moving.bar",a.proxy(this._onDragRightHandle,this))},_constraintPosition:function(b){var c,d={};return d.left=a.ui.rangeSliderDraggable.prototype._constraintPosition.apply(this,[b]),d.left=this._leftHandle("position",d.left),c=this._rightHandle("position",d.left+this.cache.width.outer-this.cache.rightHandle.width),d.width=c-d.left+this.cache.rightHandle.width,d},_applyPosition:function(b){a.ui.rangeSliderDraggable.prototype._applyPosition.apply(this,[b.left]),this.element.width(b.width)},_mouseWheelZoom:function(b,c,d,e){if(!this.enabled)return!1;var f=this._values.min+(this._values.max-this._values.min)/2,g={},h={};return this.options.range===!1||this.options.range.min===!1?(g.max=f,h.min=f):(g.max=f-this.options.range.min/2,h.min=f+this.options.range.min/2),this.options.range!==!1&&this.options.range.max!==!1&&(g.min=f-this.options.range.max/2,h.max=f+this.options.range.max/2),this._leftHandle("option","range",g),this._rightHandle("option","range",h),clearTimeout(this._wheelTimeout),this._wheelTimeout=setTimeout(a.proxy(this._wheelStop,this),200),this.zoomIn(e*this.options.wheelSpeed),!1},_mouseWheelScroll:function(b,c,d,e){return this.enabled?(this._wheelTimeout===!1?this.startScroll():clearTimeout(this._wheelTimeout),this._wheelTimeout=setTimeout(a.proxy(this._wheelStop,this),200),this.scrollLeft(e*this.options.wheelSpeed),!1):!1},_wheelStop:function(){this.stopScroll(),this._wheelTimeout=!1},min:function(a){return this._leftHandle("value",a)},max:function(a){return this._rightHandle("value",a)},startScroll:function(){this._deactivateRange()},stopScroll:function(){this._reactivateRange(),this._triggerMouseEvent("stop"),this._leftHandle().trigger("stop"),this._rightHandle().trigger("stop")},scrollLeft:function(a){return a=a||1,0>a?this.scrollRight(-a):(a=this._leftHandle("moveLeft",a),this._rightHandle("moveLeft",a),this.update(),void this._triggerMouseEvent("scroll"))},scrollRight:function(a){return a=a||1,0>a?this.scrollLeft(-a):(a=this._rightHandle("moveRight",a),this._leftHandle("moveRight",a),this.update(),void this._triggerMouseEvent("scroll"))},zoomIn:function(a){if(a=a||1,0>a)return this.zoomOut(-a);var b=this._rightHandle("moveLeft",a);a>b&&(b/=2,this._rightHandle("moveRight",b)),this._leftHandle("moveRight",b),this.update(),this._triggerMouseEvent("zoom")},zoomOut:function(a){if(a=a||1,0>a)return this.zoomIn(-a);var b=this._rightHandle("moveRight",a);a>b&&(b/=2,this._rightHandle("moveLeft",b)),this._leftHandle("moveLeft",b),this.update(),this._triggerMouseEvent("zoom")},values:function(a,b){if("undefined"!=typeof a&&"undefined"!=typeof b){var c=Math.min(a,b),d=Math.max(a,b); this._deactivateRange(),this.options.leftHandle.unbind(".bar"),this.options.rightHandle.unbind(".bar"),this._values.min=this._leftHandle("value",c),this._values.max=this._rightHandle("value",d),this._bindHandles(),this._reactivateRange(),this.update()}return{min:this._values.min,max:this._values.max}},update:function(){this._values.min=this.min(),this._values.max=this.max(),this._cache(),this._positionBar()}})}(jQuery),function(a,b){"use strict";function c(b,c,d,e){this.label1=b,this.label2=c,this.type=d,this.options=e,this.handle1=this.label1[this.type]("option","handle"),this.handle2=this.label2[this.type]("option","handle"),this.cache=null,this.left=b,this.right=c,this.moving=!1,this.initialized=!1,this.updating=!1,this.Init=function(){this.BindHandle(this.handle1),this.BindHandle(this.handle2),"show"===this.options.show?(setTimeout(a.proxy(this.PositionLabels,this),1),this.initialized=!0):setTimeout(a.proxy(this.AfterInit,this),1e3),this._resizeProxy=a.proxy(this.onWindowResize,this),a(window).resize(this._resizeProxy)},this.Destroy=function(){this._resizeProxy&&(a(window).unbind("resize",this._resizeProxy),this._resizeProxy=null,this.handle1.unbind(".positionner"),this.handle1=null,this.handle2.unbind(".positionner"),this.handle2=null,this.label1=null,this.label2=null,this.left=null,this.right=null),this.cache=null},this.AfterInit=function(){this.initialized=!0},this.Cache=function(){"none"!==this.label1.css("display")&&(this.cache={},this.cache.label1={},this.cache.label2={},this.cache.handle1={},this.cache.handle2={},this.cache.offsetParent={},this.CacheElement(this.label1,this.cache.label1),this.CacheElement(this.label2,this.cache.label2),this.CacheElement(this.handle1,this.cache.handle1),this.CacheElement(this.handle2,this.cache.handle2),this.CacheElement(this.label1.offsetParent(),this.cache.offsetParent))},this.CacheIfNecessary=function(){null===this.cache?this.Cache():(this.CacheWidth(this.label1,this.cache.label1),this.CacheWidth(this.label2,this.cache.label2),this.CacheHeight(this.label1,this.cache.label1),this.CacheHeight(this.label2,this.cache.label2),this.CacheWidth(this.label1.offsetParent(),this.cache.offsetParent))},this.CacheElement=function(a,b){this.CacheWidth(a,b),this.CacheHeight(a,b),b.offset=a.offset(),b.margin={left:this.ParsePixels("marginLeft",a),right:this.ParsePixels("marginRight",a)},b.border={left:this.ParsePixels("borderLeftWidth",a),right:this.ParsePixels("borderRightWidth",a)}},this.CacheWidth=function(a,b){b.width=a.width(),b.outerWidth=a.outerWidth()},this.CacheHeight=function(a,b){b.outerHeightMargin=a.outerHeight(!0)},this.ParsePixels=function(a,b){return parseInt(b.css(a),10)||0},this.BindHandle=function(b){b.bind("updating.positionner",a.proxy(this.onHandleUpdating,this)),b.bind("update.positionner",a.proxy(this.onHandleUpdated,this)),b.bind("moving.positionner",a.proxy(this.onHandleMoving,this)),b.bind("stop.positionner",a.proxy(this.onHandleStop,this))},this.PositionLabels=function(){if(this.CacheIfNecessary(),null!==this.cache){var a=this.GetRawPosition(this.cache.label1,this.cache.handle1),b=this.GetRawPosition(this.cache.label2,this.cache.handle2);this.label1[d]("option","isLeft")?this.ConstraintPositions(a,b):this.ConstraintPositions(b,a),this.PositionLabel(this.label1,a.left,this.cache.label1),this.PositionLabel(this.label2,b.left,this.cache.label2)}},this.PositionLabel=function(a,b,c){var d,e,f,g=this.cache.offsetParent.offset.left+this.cache.offsetParent.border.left;g-b>=0?(a.css("right",""),a.offset({left:b})):(d=g+this.cache.offsetParent.width,e=b+c.margin.left+c.outerWidth+c.margin.right,f=d-e,a.css("left",""),a.css("right",f))},this.ConstraintPositions=function(a,b){(a.center<b.center&&a.outerRight>b.outerLeft||a.center>b.center&&b.outerRight>a.outerLeft)&&(a=this.getLeftPosition(a,b),b=this.getRightPosition(a,b))},this.getLeftPosition=function(a,b){var c=(b.center+a.center)/2,d=c-a.cache.outerWidth-a.cache.margin.right+a.cache.border.left;return a.left=d,a},this.getRightPosition=function(a,b){var c=(b.center+a.center)/2;return b.left=c+b.cache.margin.left+b.cache.border.left,b},this.ShowIfNecessary=function(){"show"===this.options.show||this.moving||!this.initialized||this.updating||(this.label1.stop(!0,!0).fadeIn(this.options.durationIn||0),this.label2.stop(!0,!0).fadeIn(this.options.durationIn||0),this.moving=!0)},this.HideIfNeeded=function(){this.moving===!0&&(this.label1.stop(!0,!0).delay(this.options.delayOut||0).fadeOut(this.options.durationOut||0),this.label2.stop(!0,!0).delay(this.options.delayOut||0).fadeOut(this.options.durationOut||0),this.moving=!1)},this.onHandleMoving=function(a,b){this.ShowIfNecessary(),this.CacheIfNecessary(),this.UpdateHandlePosition(b),this.PositionLabels()},this.onHandleUpdating=function(){this.updating=!0},this.onHandleUpdated=function(){this.updating=!1,this.cache=null},this.onHandleStop=function(){this.HideIfNeeded()},this.onWindowResize=function(){this.cache=null},this.UpdateHandlePosition=function(a){null!==this.cache&&(a.element[0]===this.handle1[0]?this.UpdatePosition(a,this.cache.handle1):this.UpdatePosition(a,this.cache.handle2))},this.UpdatePosition=function(a,b){b.offset=a.offset,b.value=a.value},this.GetRawPosition=function(a,b){var c=b.offset.left+b.outerWidth/2,d=c-a.outerWidth/2,e=d+a.outerWidth-a.border.left-a.border.right,f=d-a.margin.left-a.border.left,g=b.offset.top-a.outerHeightMargin;return{left:d,outerLeft:f,top:g,right:e,outerRight:f+a.outerWidth+a.margin.left+a.margin.right,cache:a,center:c}},this.Init()}a.widget("ui.rangeSliderLabel",a.ui.rangeSliderMouseTouch,{options:{handle:null,formatter:!1,handleType:"rangeSliderHandle",show:"show",durationIn:0,durationOut:500,delayOut:500,isLeft:!1},cache:null,_positionner:null,_valueContainer:null,_innerElement:null,_value:null,_create:function(){this.options.isLeft=this._handle("option","isLeft"),this.element.addClass("ui-rangeSlider-label").css("position","absolute").css("display","block"),this._createElements(),this._toggleClass(),this.options.handle.bind("moving.label",a.proxy(this._onMoving,this)).bind("update.label",a.proxy(this._onUpdate,this)).bind("switch.label",a.proxy(this._onSwitch,this)),"show"!==this.options.show&&this.element.hide(),this._mouseInit()},destroy:function(){this.options.handle.unbind(".label"),this.options.handle=null,this._valueContainer=null,this._innerElement=null,this.element.empty(),this._positionner&&(this._positionner.Destroy(),this._positionner=null),a.ui.rangeSliderMouseTouch.prototype.destroy.apply(this)},_createElements:function(){this._valueContainer=a("<div class='ui-rangeSlider-label-value' />").appendTo(this.element),this._innerElement=a("<div class='ui-rangeSlider-label-inner' />").appendTo(this.element)},_handle:function(){var a=Array.prototype.slice.apply(arguments);return this.options.handle[this.options.handleType].apply(this.options.handle,a)},_setOption:function(a,b){"show"===a?this._updateShowOption(b):("durationIn"===a||"durationOut"===a||"delayOut"===a)&&this._updateDurations(a,b),this._setFormatterOption(a,b)},_setFormatterOption:function(a,b){"formatter"===a&&("function"==typeof b||b===!1)&&(this.options.formatter=b,this._display(this._value))},_updateShowOption:function(a){this.options.show=a,"show"!==this.options.show?(this.element.hide(),this._positionner.moving=!1):(this.element.show(),this._display(this.options.handle[this.options.handleType]("value")),this._positionner.PositionLabels()),this._positionner.options.show=this.options.show},_updateDurations:function(a,b){parseInt(b,10)===b&&(this._positionner.options[a]=b,this.options[a]=b)},_display:function(a){this.options.formatter===!1?this._displayText(Math.round(a)):this._displayText(this.options.formatter(a)),this._value=a},_displayText:function(a){this._valueContainer.text(a)},_toggleClass:function(){this.element.toggleClass("ui-rangeSlider-leftLabel",this.options.isLeft).toggleClass("ui-rangeSlider-rightLabel",!this.options.isLeft)},_positionLabels:function(){this._positionner.PositionLabels()},_mouseDown:function(a){this.options.handle.trigger(a)},_mouseUp:function(a){this.options.handle.trigger(a)},_mouseMove:function(a){this.options.handle.trigger(a)},_onMoving:function(a,b){this._display(b.value)},_onUpdate:function(){"show"===this.options.show&&this.update()},_onSwitch:function(a,b){this.options.isLeft=b,this._toggleClass(),this._positionLabels()},pair:function(a){null===this._positionner&&(this._positionner=new c(this.element,a,this.widgetName,{show:this.options.show,durationIn:this.options.durationIn,durationOut:this.options.durationOut,delayOut:this.options.delayOut}),a[this.widgetName]("positionner",this._positionner))},positionner:function(a){return"undefined"!=typeof a&&(this._positionner=a),this._positionner},update:function(){this._positionner.cache=null,this._display(this._handle("value")),"show"===this.options.show&&this._positionLabels()}})}(jQuery),function(a,b){"use strict";a.widget("ui.editRangeSlider",a.ui.rangeSlider,{options:{type:"text",round:1},_create:function(){a.ui.rangeSlider.prototype._create.apply(this),this.element.addClass("ui-editRangeSlider")},destroy:function(){this.element.removeClass("ui-editRangeSlider"),a.ui.rangeSlider.prototype.destroy.apply(this)},_setOption:function(b,c){("type"===b||"step"===b)&&this._setLabelOption(b,c),"type"===b&&(this.options[b]=null===this.labels.left?c:this._leftLabel("option",b)),a.ui.rangeSlider.prototype._setOption.apply(this,[b,c])},_setLabelOption:function(a,b){null!==this.labels.left&&(this._leftLabel("option",a,b),this._rightLabel("option",a,b))},_labelType:function(){return"editRangeSliderLabel"},_createLabel:function(b,c){var d=a.ui.rangeSlider.prototype._createLabel.apply(this,[b,c]);return null===b&&d.bind("valueChange",a.proxy(this._onValueChange,this)),d},_addPropertiesToParameter:function(a){return a.type=this.options.type,a.step=this.options.step,a.id=this.element.attr("id"),a},_getLabelConstructorParameters:function(b,c){var d=a.ui.rangeSlider.prototype._getLabelConstructorParameters.apply(this,[b,c]);return this._addPropertiesToParameter(d)},_getLabelRefreshParameters:function(b,c){var d=a.ui.rangeSlider.prototype._getLabelRefreshParameters.apply(this,[b,c]);return this._addPropertiesToParameter(d)},_onValueChange:function(a,b){var c=!1;c=b.isLeft?this._values.min!==this.min(b.value):this._values.max!==this.max(b.value),c&&this._trigger("userValuesChanged")}})}(jQuery),function(a){"use strict";a.widget("ui.editRangeSliderLabel",a.ui.rangeSliderLabel,{options:{type:"text",step:!1,id:""},_input:null,_text:"",_create:function(){a.ui.rangeSliderLabel.prototype._create.apply(this),this._createInput()},_setOption:function(b,c){"type"===b?this._setTypeOption(c):"step"===b&&this._setStepOption(c),a.ui.rangeSliderLabel.prototype._setOption.apply(this,[b,c])},_createInput:function(){this._input=a("<input type='"+this.options.type+"' />").addClass("ui-editRangeSlider-inputValue").appendTo(this._valueContainer),this._setInputName(),this._input.bind("keyup",a.proxy(this._onKeyUp,this)),this._input.blur(a.proxy(this._onChange,this)),"number"===this.options.type&&(this.options.step!==!1&&this._input.attr("step",this.options.step),this._input.click(a.proxy(this._onChange,this))),this._input.val(this._text)},_setInputName:function(){var a=this.options.isLeft?"left":"right";this._input.attr("name",this.options.id+a)},_onSwitch:function(b,c){a.ui.rangeSliderLabel.prototype._onSwitch.apply(this,[b,c]),this._setInputName()},_destroyInput:function(){this._input.remove(),this._input=null},_onKeyUp:function(a){return 13===a.which?(this._onChange(a),!1):void 0},_onChange:function(){var a=this._returnCheckedValue(this._input.val());a!==!1&&this._triggerValue(a)},_triggerValue:function(a){var b=this.options.handle[this.options.handleType]("option","isLeft");this.element.trigger("valueChange",[{isLeft:b,value:a}])},_returnCheckedValue:function(a){var b=parseFloat(a);return isNaN(b)||isNaN(Number(a))?!1:b},_setTypeOption:function(a){"text"!==a&&"number"!==a||this.options.type===a||(this._destroyInput(),this.options.type=a,this._createInput())},_setStepOption:function(a){this.options.step=a,"number"===this.options.type&&this._input.attr("step",a!==!1?a:"any")},_displayText:function(a){this._input.val(a),this._text=a},enable:function(){a.ui.rangeSliderLabel.prototype.enable.apply(this),this._input.attr("disabled",null)},disable:function(){a.ui.rangeSliderLabel.prototype.disable.apply(this),this._input.attr("disabled","disabled")}})}(jQuery);
ajax/libs/concent/2.15.2/concent.js
cdnjs/cdnjs
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : (factory((global.concent = {}),global.React)); }(this, (function (exports,React) { 'use strict'; var _ERR_MESSAGE; var MODULE_GLOBAL = '$$global'; var MODULE_DEFAULT = '$$default'; var MODULE_CC = '$$cc'; // do not consider symbol as MODULE_VOID var MODULE_VOID = '$$concent_void_module_624313307'; var MODULE_CC_ROUTER = '$$CONCENT_ROUTER'; // component type var CC_CLASS = '$$CcClass'; var CC_HOOK = '$$CcHook'; // component ins type /** use CcFragment initialize a component instance in jsx directly */ var CC_FRAGMENT = '$$CcFrag'; /** use Ob to initialize a component instance in jsx directly */ var CC_OB = '$$CcOb'; /** * use api register、useConcent to create component firstly, * then use the customized component to initialize a component instance in jsx */ var CC_CUSTOMIZE = '$$CcCust'; var CC_PREFIX = '$$Cc'; var CC_DISPATCHER = '$$Dispatcher'; var CCSYNC_KEY = Symbol('__for_sync_param_ccsync__'); var SIG_FN_START = 10; var SIG_FN_END = 11; var SIG_FN_QUIT = 12; var SIG_FN_ERR = 13; var SIG_MODULE_CONFIGURED = 14; var SIG_STATE_CHANGED = 15; var SIG_ASYNC_COMPUTED_START = 30; var SIG_ASYNC_COMPUTED_END = 31; var SIG_ASYNC_COMPUTED_ERR = 32; var SIG_ASYNC_COMPUTED_BATCH_START = 33; var SIG_ASYNC_COMPUTED_BATCH_END = 34; var RENDER_NO_OP = 1; var RENDER_BY_KEY = 2; var RENDER_BY_STATE = 3; var FOR_CUR_MOD = 1; var FOR_ANOTHER_MOD = 2; // 暂时用不到 // export const EFFECT_AVAILABLE = 1; // export const EFFECT_STOPPED = 0; var DISPATCH = 'dispatch'; var SET_STATE = 'setState'; var SET_MODULE_STATE = 'setModuleState'; var FORCE_UPDATE = 'forceUpdate'; var INVOKE = 'invoke'; var SYNC = 'sync'; var CATE_MODULE = 'module'; var CATE_REF = 'ref'; var FN_CU = 'computed'; var FN_WATCH = 'watch'; var ERR = { CC_MODULE_NAME_DUPLICATE: 1002, CC_MODULE_NOT_FOUND: 1012, CC_DISPATCH_STRING_INVALID: 1013, CC_DISPATCH_PARAM_INVALID: 1014, CC_MODULE_NOT_CONNECTED: 1015, CC_CLASS_KEY_DUPLICATE: 1100, CC_CLASS_INSTANCE_KEY_DUPLICATE: 1200, CC_STORED_KEYS_NEED_CCKEY: 1207, CC_REDUCER_NOT_A_FUNCTION: 1503 }; var ERR_MESSAGE = (_ERR_MESSAGE = {}, _ERR_MESSAGE[ERR.CC_MODULE_NAME_DUPLICATE] = 'module name duplicate!', _ERR_MESSAGE[ERR.CC_MODULE_NOT_FOUND] = "module not found!", _ERR_MESSAGE[ERR.CC_DISPATCH_STRING_INVALID] = "when type param is string, it must be one of these format: (fnName)\u3001(moduleName)/(fnName)", _ERR_MESSAGE[ERR.CC_DISPATCH_PARAM_INVALID] = "dispatch param type is invalid, it must be string or object", _ERR_MESSAGE[ERR.CC_MODULE_NOT_CONNECTED] = "module not been connected by ref", _ERR_MESSAGE[ERR.CC_CLASS_INSTANCE_KEY_DUPLICATE] = "props.ccKey duplicate", _ERR_MESSAGE[ERR.CC_STORED_KEYS_NEED_CCKEY] = 'you must explicitly specify a ccKey for ccInstance when set storedKeys!', _ERR_MESSAGE[ERR.CC_CLASS_KEY_DUPLICATE] = 'ccClassKey duplicate!', _ERR_MESSAGE[ERR.CC_REDUCER_NOT_A_FUNCTION] = "reducer must be a function!", _ERR_MESSAGE); var NOT_MOUNT = 1; var MOUNTED = 2; // 已挂载未卸载 var UNMOUNTED = 3; var _cst = /*#__PURE__*/Object.freeze({ MODULE_GLOBAL: MODULE_GLOBAL, MODULE_DEFAULT: MODULE_DEFAULT, MODULE_CC: MODULE_CC, MODULE_VOID: MODULE_VOID, MODULE_CC_ROUTER: MODULE_CC_ROUTER, CC_CLASS: CC_CLASS, CC_HOOK: CC_HOOK, CC_FRAGMENT: CC_FRAGMENT, CC_OB: CC_OB, CC_CUSTOMIZE: CC_CUSTOMIZE, CC_PREFIX: CC_PREFIX, CC_DISPATCHER: CC_DISPATCHER, CCSYNC_KEY: CCSYNC_KEY, SIG_FN_START: SIG_FN_START, SIG_FN_END: SIG_FN_END, SIG_FN_QUIT: SIG_FN_QUIT, SIG_FN_ERR: SIG_FN_ERR, SIG_MODULE_CONFIGURED: SIG_MODULE_CONFIGURED, SIG_STATE_CHANGED: SIG_STATE_CHANGED, SIG_ASYNC_COMPUTED_START: SIG_ASYNC_COMPUTED_START, SIG_ASYNC_COMPUTED_END: SIG_ASYNC_COMPUTED_END, SIG_ASYNC_COMPUTED_ERR: SIG_ASYNC_COMPUTED_ERR, SIG_ASYNC_COMPUTED_BATCH_START: SIG_ASYNC_COMPUTED_BATCH_START, SIG_ASYNC_COMPUTED_BATCH_END: SIG_ASYNC_COMPUTED_BATCH_END, RENDER_NO_OP: RENDER_NO_OP, RENDER_BY_KEY: RENDER_BY_KEY, RENDER_BY_STATE: RENDER_BY_STATE, FOR_CUR_MOD: FOR_CUR_MOD, FOR_ANOTHER_MOD: FOR_ANOTHER_MOD, DISPATCH: DISPATCH, SET_STATE: SET_STATE, SET_MODULE_STATE: SET_MODULE_STATE, FORCE_UPDATE: FORCE_UPDATE, INVOKE: INVOKE, SYNC: SYNC, CATE_MODULE: CATE_MODULE, CATE_REF: CATE_REF, FN_CU: FN_CU, FN_WATCH: FN_WATCH, ERR: ERR, ERR_MESSAGE: ERR_MESSAGE, NOT_MOUNT: NOT_MOUNT, MOUNTED: MOUNTED, UNMOUNTED: UNMOUNTED }); var _moduleName2stateKeys; /** * 为避免cc-context文件里调用的方法和自身产生循环引用,将moduleName_stateKeys_单独拆开放置到此文件 * 如果还有别的类似循环引用产生,都可以像moduleName_stateKeys_一样单独拆出来放置为一个文件 */ var moduleName2stateKeys = (_moduleName2stateKeys = {}, _moduleName2stateKeys[MODULE_DEFAULT] = [], _moduleName2stateKeys); // 映射好模块的状态所有key并缓存住,用于提高性能 var _computedValues2, _computedRawValues2; var _computedValues = (_computedValues2 = {}, _computedValues2[MODULE_GLOBAL] = {}, _computedValues2[MODULE_DEFAULT] = {}, _computedValues2[MODULE_CC] = {}, _computedValues2[MODULE_VOID] = {}, _computedValues2); var _computedRawValues = (_computedRawValues2 = {}, _computedRawValues2[MODULE_GLOBAL] = {}, _computedRawValues2[MODULE_DEFAULT] = {}, _computedRawValues2[MODULE_CC] = {}, _computedRawValues2[MODULE_VOID] = {}, _computedRawValues2); var _computedDep = {}; var _computedRaw = {}; var computedMap = { _computedRawValues: _computedRawValues, // 在 init-module-computed 时,会将key对应的值赋为经defineProperty处理过的对象 _computedValues: _computedValues, _computedRaw: _computedRaw, _computedDep: _computedDep, getRootComputedValue: function getRootComputedValue() { return _computedValues; }, getRootComputedDep: function getRootComputedDep() { return _computedDep; }, getRootComputedRaw: function getRootComputedRaw() { return _computedRaw; } }; /** watch section */ var _watchDep = {}; var _watchRaw = {}; var watch = { _watchRaw: _watchRaw, _watchDep: _watchDep, getRootWatchDep: function getRootWatchDep() { return _watchDep; }, getRootWatchRaw: function getRootWatchRaw() { return _watchRaw; } }; // 后续在逐步迁移其他的 var rv = { asyncCuKeys: [], // if isStrict is true, every error will be throw out instead of console.error, // but this may crash your app, make sure you have a nice error handling way, // like componentDidCatch in react 16.* isStrict: false, isDebug: false, unsafe_moveReducerErrToErrorHandler: false, log: true, alwaysRenderCaller: true, computedCompare: false, // 针对object值的比较规则 watchCompare: false, // 针对object值的比较规则 watchImmediate: false, bindCtxToMethod: false, extractModuleChangedState: true, extractRefChangedState: false, // 对于triggerReactSetState调用,当judgeStateChangedForRef为true时,触发__$$ccSetState 前,提取真正发生变化的值 // 对于saveSharedState调用,提取真正发生变化的值作为sharedState,透传给其他实例 // object类型值的比较规则默认是 false // false: 不比较,只要set了就提取出来 // true: 比较,只有和前一刻的值不一样就提取出来 objectValueCompare: false, // 非object类型值的比较规则默认是 true, // false: 不比较,只要set了就提取出来 // true: 只有和前一刻的值不一样就提取出来 nonObjectValueCompare: true }; 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); } var CU_KEY = Symbol('cuk'); var ALCC_KEY = Symbol('allowCcPrefix'); var UNSTART = '0'; var START = '1'; var END = '2'; var FN = 'function'; var OBJ = 'object'; var INAF = "is not a " + FN; var INAJ = 'is not a plain json object!'; var STR_ARR_OR_STAR = 'should be an string array or *!'; var cer = function cer() { return rv.log && logErr.apply(void 0, arguments); }; var protoToString = Object.prototype.toString; function logErr() { var _console; (_console = console).error.apply(_console, arguments); } function logWarn() { var _console2; (_console2 = console).warn.apply(_console2, arguments); } function logNormal() { var _console3; (_console3 = console).log.apply(_console3, arguments); } function noop() {} function isValueNotNull(value) { return !(value === null || value === undefined); } function isObjectNotNull(object) { if (object === null || object === undefined) { return false; } if (okeys(object).length > 0) { return true; } return false; } function isObjectNull(object) { return !isObjectNotNull(object); } function isBool(val) { return typeof val === 'boolean'; } function isObject(obj) { if (!obj) return false; // undefined null etc... var str = protoToString.call(obj); // !!!编译后的对象可能重写了toStringTag Symbol(Symbol.toStringTag): "Module" return str === '[object Object]' || str === '[object Module]'; } function isArray(obj) { return Array.isArray(obj); } // isPJO is short of isPlainJsonObject function isPJO(obj, canBeArray) { if (canBeArray === void 0) { canBeArray = false; } var isArr = isArray(obj); var isObj = isObject(obj); return canBeArray ? isArr || isObj : isObj; } function isFn(maybeFn) { return typeof maybeFn === FN; } function isAsyncFn(fn, asyncKey) { if (!fn) return false; // @see https://github.com/tj/co/blob/master/index.js // obj.constructor.name === 'AsyncFunction' var isAsync = protoToString.call(fn) === '[object AsyncFunction]' || isFn(fn.then); if (isAsync === true) { return true; } // 有可能成降级编译成 __awaiter格式的了 或者 _regenerator var fnStr = fn.toString(); if (fnStr.indexOf('_awaiter') >= 0 || fnStr.indexOf('_regenerator') >= 0) { return true; } /** * 上面的判定过程目前对这种编译结果是无效的, * function asyncFn(_x, _x2, _x3) { * return _asyncFn.apply(this, arguments); * } * 所以要求用户传入相应的asyncKeys来辅助判断,由runOptins里传入 */ if (asyncKey && rv.asyncCuKeys.includes(asyncKey)) { return true; } return false; } // 0 算有效值, undefined null ''算空值 function isEmptyVal(val) { return !val && val !== 0; } function isKeyValid(obj, key) { return typeof key !== "symbol" && Object.prototype.hasOwnProperty.call(obj, key); } // renderKey 可能是 IDispatchOptions function extractRenderKey(renderKey) { var getRkey = function getRkey(key) { if (!key && key !== 0) return []; if (isArray(key)) return key; return null; }; var targetRenderKey = getRkey(renderKey); if (targetRenderKey) return targetRenderKey; if (typeof renderKey === 'object') targetRenderKey = getRkey(renderKey.renderKey); if (targetRenderKey) return targetRenderKey; return [renderKey]; // 是一个具体的string 或 number } function makeError(code, extraMessage) { var message = ''; if (typeof code === 'string') message = code;else { message = ERR_MESSAGE[code] || ''; } if (extraMessage) message += extraMessage; if (!message) message = "undefined message for code:" + code; var error = new Error(message); error.code = code; return error; } function makeCuPackedValue(isLazy, result, needCompute, fn, newState, oldState, fnCtx) { var _ref; return _ref = {}, _ref[CU_KEY] = 1, _ref.needCompute = needCompute, _ref.fn = fn, _ref.newState = newState, _ref.oldState = oldState, _ref.fnCtx = fnCtx, _ref.isLazy = isLazy, _ref.result = result, _ref; } function makeCuDepDesc() { return { retKey2fn: {}, retKey2lazy: {}, stateKey2retKeys: {}, // 用于辅助依赖收集系统更新依赖之用,render逻辑书写 refCompute.*** moduleCompted.*** connectedCompute.yy.** 时触发 retKey2stateKeys: {}, fnCount: 0 }; } /** make ccClassContext */ function makeCcClassContext(module, ccClassKey, renderKeyClasses) { return { module: module, ccClassKey: ccClassKey, renderKeyClasses: renderKeyClasses }; } // !!! different ccClass enable own a same key function makeUniqueCcKey(ccClassKey, featureStr) { return ccClassKey + "$" + featureStr; } function makeHandlerKey(ccUniqueKey, eventName, identity) { return ccUniqueKey + "$" + eventName + "$" + identity; } function isModuleNameValid(moduleName) { if (!moduleName) return false; return /^[\$\#\&a-zA-Z0-9_-]+$/.test(moduleName); } function isModuleNameCcLike(moduleName) { var name = moduleName.toLowerCase(); return name.startsWith(MODULE_CC); } function verboseInfo(info) { return info ? " --verbose-info: " + info : ''; } function ccClassDisplayName(className) { return "CC(" + className + ")"; } function verifyKeys(keys1, keys2) { var duplicate = false, notArray = false, keyElementNotString = false; if (!isArray(keys1)) return { duplicate: duplicate, notArray: true, keyElementNotString: keyElementNotString }; if (!isArray(keys2)) return { duplicate: duplicate, notArray: true, keyElementNotString: keyElementNotString }; var len1 = keys1.length; var len2 = keys2.length; outLoop: for (var i = 0; i < len1; i++) { var tmpKey = keys1[i]; if (typeof tmpKey !== 'string') { keyElementNotString = true; break outLoop; } for (var j = 0; j < len2; j++) { var tmpKey2 = keys2[j]; if (typeof tmpKey2 !== 'string') { keyElementNotString = true; break outLoop; } if (tmpKey2 === tmpKey) { duplicate = true; break outLoop; } } } return { duplicate: duplicate, notArray: notArray, keyElementNotString: keyElementNotString }; } function color(color) { if (color === void 0) { color = 'green'; } return "color:" + color + ";border:1px solid " + color; } function styleStr(str) { return "%c" + str; } var tipStart = function tipStart(str) { return "------------ CC " + str + " ------------"; }; function justWarning(err) { cer(tipStart('WARNING')); if (err instanceof Error) { cer(err.message); cer(err.stack); } else cer(err); } function justTip(msg, tipColor) { if (tipColor === void 0) { tipColor = 'green'; } if (!rv.log) return; console.log(tipStart('TIP')); console.log("%c" + msg, "color:" + tipColor + ";border:1px solid " + tipColor + ";"); } function strictWarning(err) { cer(tipStart('WARNING')); cer(err); if (rv.isStrict) { throw err; } } function safeAdd(object, key, toAdd) { try { object[key] += toAdd; } catch (err) { object[key] = toAdd; } } function safeMinus(object, key, toMinus) { try { object[key] -= toMinus; } catch (err) { object[key] = 0; } } function safeGet(object, key, defaultVal) { if (defaultVal === void 0) { defaultVal = {}; } var childrenObject = object[key]; if (!childrenObject) { childrenObject = object[key] = defaultVal; } return childrenObject; } function safeGetArray(object, key, defaultVal) { if (defaultVal === void 0) { defaultVal = []; } return safeGet(object, key, defaultVal); } function noDupPush(arr, strItem) { if (!arr.includes(strItem)) arr.push(strItem); } function safeGetThenNoDupPush(object, key, strItem) { var arr = safeGetArray(object, key); noDupPush(arr, strItem); } function safeAssignObjectValue(assignTo, assignFrom) { okeys(assignFrom).forEach(function (key) { assignTo[key] = assignFrom[key]; }); } /** * 把某个object赋值到container[key]的map下,map存在就直接赋值,map不存在则先创建再赋值,确保map引用无变化 * @param {*} container 对象容器 * @param {*} key 字段名 * @param {*} objectToBeenAssign 等待赋值的object */ function safeAssignToMap(container, key, objectToBeenAssign) { var map = container[key]; if (!map) map = container[key] = {}; safeAssignObjectValue(map, objectToBeenAssign); } function computeFeature(ccUniqueKey, state) { var stateKeys = okeys(state); var stateKeysStr = stateKeys.sort().join('|'); return ccUniqueKey + "/" + stateKeysStr; } function randomNumber(lessThan) { if (lessThan === void 0) { lessThan = 52; } var seed = Math.random(); return parseInt(seed * lessThan); } // 在 object[key]存在且deepClear为true时,传入的reset会被忽略 // 传入deepClear是为了保持引用不变 function clearObject(object, excludeKeys, reset, deepClear) { if (excludeKeys === void 0) { excludeKeys = []; } if (deepClear === void 0) { deepClear = false; } if (isArray(object)) { var retainKeys = []; excludeKeys.forEach(function (key) { if (object.includes(key)) retainKeys.push(key); }); object.length = 0; retainKeys.forEach(function (key) { return object.push(key); }); return; } okeys(object).forEach(function (key) { if (excludeKeys.includes(key)) { // do nothing return; } var subMap = object[key]; if (deepClear && subMap) { okeys(subMap).forEach(function (key) { return delete subMap[key]; }); } else { if (reset) object[key] = reset;else delete object[key]; } }); } function okeys(obj) { return Object.keys(obj); } function convertToStandardEvent(e) { var ret = null; // avoid Warning: This synthetic event is reused for performance reasons. If you're seeing this... // call e.persist() @see https://reactjs.org/docs/events.html#event-pooling if (e) { if (e.persist) e.persist(); if (e.currentTarget && e.type) { ret = e; } else if (e.nativeEvent && e.target) { e.currentTarget = e.target; ret = e; } } return ret; } //防止有些在线IDE,绑定失败 function bindToWindow(key, toBindObj, targetObj) { var attachToTarget = function attachToTarget(targetObj) { if (!window) return; if (targetObj) targetObj[key] = toBindObj;else window[key] = toBindObj; }; if (window) { attachToTarget(targetObj); } else { setTimeout(function () { attachToTarget(targetObj); }, 3000); } } /** * 浅比较两个对象 * come from : https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349 */ function shallowDiffers(a, b) { for (var i in a) { if (!(i in b)) return true; } for (var _i in b) { if (a[_i] !== b[_i]) return true; } return false; } function shallowCopy(oriVal) { var newVal = oriVal; if (isObject(oriVal)) { newVal = _extends({}, oriVal); } else if (isArray(oriVal)) { newVal = [].concat(oriVal); } return newVal; } function extractChangedState(oldState, partialNewState, moduleOpt, force) { var changedState = {}; var setted = false; var extractRefChangedState = rv.extractRefChangedState, extractModuleChangedState = rv.extractModuleChangedState, nonObjectValueCompare = rv.nonObjectValueCompare, objectValueCompare = rv.objectValueCompare; var needExtractChangedState = moduleOpt ? extractModuleChangedState : extractRefChangedState; // 非模块调用 if (!moduleOpt) { if (!needExtractChangedState) return partialNewState; if (!nonObjectValueCompare && !objectValueCompare) return partialNewState; } if (partialNewState) { okeys(partialNewState).forEach(function (key) { var oldVal = oldState[key]; var newVal = partialNewState[key]; var valType = typeof newVal; var isNotEqual = true; if (force === true) ; else { if (valType !== 'object') { // 比较非object类型的值 if (nonObjectValueCompare) isNotEqual = oldVal !== newVal; } else { // 比较object类型的值 if (objectValueCompare) isNotEqual = oldVal !== newVal; } } if (isNotEqual) { if (moduleOpt) { moduleOpt.prevStateContainer[key] = oldVal; moduleOpt.incStateVer(key); oldState[key] = newVal; } changedState[key] = newVal; setted = true; } }); } return setted ? changedState : null; } function differStateKeys(oldState, newState) { var changed = [], setted = []; // const unchanged=[]; okeys(newState).forEach(function (k) { var newVal = newState[k]; if (newVal !== undefined) { setted.push(k); if (newVal !== oldState[k]) changed.push(k); // else unchanged.push(k); } }); return { changed: changed, setted: setted }; } function removeArrElements(arr, toRemoveArr) { var newArr = []; arr.forEach(function (item) { if (!toRemoveArr.includes(item)) newArr.push(item); }); return newArr; } function getRegisterOptions(options) { if (options === void 0) { options = {}; } if (typeof options === 'string') { return { module: options }; } if (options) { if (options.module) return Object.assign({ module: MODULE_DEFAULT }, options); return Object.assign(options, { module: MODULE_DEFAULT }); } return { module: MODULE_DEFAULT }; } var ccns = ''; function setCcNamespace(name) { ccns = name; } function getCcNamespace() { return ccns; } function getWinCc() { if (ccns) return window.mcc[ccns]; return window.cc; } function makeCommitHandler() { var state = null; var commit = function commit(partialState) { if (!state) state = {}; Object.assign(state, partialState); }; var clear = function clear() { return state = null; }; var getFnCommittedState = function getFnCommittedState() { return state; }; return { commit: commit, clear: clear, getFnCommittedState: getFnCommittedState }; } function isOnlineEditor() { var result = false; if (window) { if (window.name === 'previewFrame' //for stackblitz || window.__SANDBOX_DATA__ // for codesandbox || window.BrowserFS // for codesandbox ) { result = true; } } return result; } function makeCallInfo(module) { return { payload: null, renderKey: [], delay: -1, module: module, fnName: '' }; } function evalState(state) { if (state === void 0) { state = {}; } var ret = isFn(state) ? state() : state; if (!isPJO(ret)) { throw new Error("state " + INAJ); } return ret; } function _getValue(obj, keys, lastKeyIndex, keyIndex) { var key = keys[keyIndex]; if (lastKeyIndex === keyIndex) { return obj[key]; } else { return _getValue(obj[key], keys, lastKeyIndex, ++keyIndex); } } function getValueByKeyPath(obj, keyPath) { var keys = keyPath.split('.'); return _getValue(obj, keys, keys.length - 1, 0); } function isDepKeysValid(depKeys) { return isFn(depKeys) || isArray(depKeys) || depKeys === '-' || depKeys === '*'; } function checkDepKeys(depKeys) { if (depKeys && !isDepKeysValid(depKeys)) { throw new Error("depKeys must be one of them(array,'*','-',fn)"); } } function makeFnDesc(fn, depKeysOrOpt, check) { if (check === void 0) { check = true; } // 防止显式的传递null var _depKeysOrOpt = depKeysOrOpt || {}; var desc = { fn: fn }; var assignFrom = isDepKeysValid(_depKeysOrOpt) ? { depKeys: _depKeysOrOpt } : _depKeysOrOpt; check && checkDepKeys(assignFrom.depKeys); return Object.assign(desc, assignFrom); } function delay(ms) { if (ms === void 0) { ms = 1000; } return new Promise(function (resolve) { return setTimeout(resolve, ms); }); } function getErrStackKeywordLoc(err, keyword, offset) { if (offset === void 0) { offset = 0; } var errStack = err.stack; var arr = errStack.split('\n'); var len = arr.length; var curLocation = ''; for (var i = 0; i < len; i++) { if (arr[i].includes(keyword)) { curLocation = arr[i + offset]; break; } } return curLocation; } function getVal(val, defaultVal) { if (val !== undefined) return val; return defaultVal; } var defaultErrorHandler = function defaultErrorHandler(err, silent) { if (silent === void 0) { silent = false; } var logFn = rv.isDebug ? logWarn : logErr; // 避免travis 发现 error打印就导致test用例不通过 logFn('found uncaught err, suggest configure an errorHandler in run options'); logFn(err); if (!silent) throw err; }; var rh = { act: null, errorHandler: null, warningHandler: null, tryHandleError: function tryHandleError(err, silent) { rh.errorHandler ? rh.errorHandler(err) : defaultErrorHandler(err, silent); }, tryHandleWarning: function tryHandleWarning(err) { // this kind of error will not lead to app crash, but should let developer know justWarning(err); rh.warningHandler && rh.warningHandler(err); } }; /* eslint-disable camelcase */ // 依赖收集写入的映射 var waKey2uKeyMap = {}; // 依赖标记写入的映射,是一个实例化完成就会固化的依赖 // 不采取一开始映射好全部waKey的形式,而是采用safeGet动态添加map映射 var waKey2staticUKeyMap = {}; function _mapIns(mapContainer, waKey, ccUniqueKey) { try { mapContainer[waKey][ccUniqueKey] = 1; //处于依赖状态 } catch (err) { var map = {}; map[ccUniqueKey] = 1; mapContainer[waKey] = map; } } function makeWaKey(module, stateKey) { return module + "/" + stateKey; } function mapIns(module, stateKey, ccUniqueKey) { _mapIns(waKey2uKeyMap, makeWaKey(module, stateKey), ccUniqueKey); } function mapInsM(modStateKey, ccUniqueKey) { _mapIns(waKey2uKeyMap, modStateKey, ccUniqueKey); } function delIns(module, stateKey, ccUniqueKey) { delInsM(makeWaKey(module, stateKey), ccUniqueKey); } function delInsM(modStateKey, ccUniqueKey) { try { delete waKey2uKeyMap[modStateKey][ccUniqueKey]; } catch (err) {// do nothing } } function mapStaticInsM(modStateKey, ccUniqueKey) { _mapIns(waKey2staticUKeyMap, modStateKey, ccUniqueKey); } function delStaticInsM(modStateKey, ccUniqueKey) { try { delete waKey2staticUKeyMap[modStateKey][ccUniqueKey]; } catch (err) {// do nothing } } var _MODULE_DEFAULT$MODUL; var module2insCount = (_MODULE_DEFAULT$MODUL = {}, _MODULE_DEFAULT$MODUL[MODULE_DEFAULT] = 0, _MODULE_DEFAULT$MODUL[MODULE_GLOBAL] = 0, _MODULE_DEFAULT$MODUL); var _lifecycle; var lifecycle = { _lifecycle: (_lifecycle = {}, _lifecycle[MODULE_DEFAULT] = {}, _lifecycle[MODULE_GLOBAL] = {}, _lifecycle), _mountedOnce: {}, _willUnmountOnce: {} }; var refs = {}; /* eslint-disable camelcase */ function getCacheDataContainer() { return { module: { computed: {}, watch: {} }, ref: { computed: {}, watch: {}, effect: {} } }; } var cacheArea_pickedRetKeys_ = getCacheDataContainer(); function _wrapFn(retKey, retKey2fn, isLazy) { var _retKey2fn$retKey = retKey2fn[retKey], fn = _retKey2fn$retKey.fn, depKeys = _retKey2fn$retKey.depKeys, sort = _retKey2fn$retKey.sort; return { retKey: retKey, fn: fn, depKeys: depKeys, isLazy: isLazy, sort: sort }; } // asc sort var sortCb = function sortCb(o1, o2) { return o1.sort - o2.sort; }; function clearCachedData() { cacheArea_pickedRetKeys_ = getCacheDataContainer(); } // cate module | ref // type computed | watch function pickDepFns (isBeforeMount, cate, type, depDesc, stateModule, oldState, committedState, cUkey) { var moduleDep = depDesc[stateModule]; // it can be refModuleDep or moduleDep var pickedFns = []; // 针对type module, init-module-state时,已对_computedValueOri赋值了默认cuDesc, // 所以此时可以安全的直接判断非关系,而不用担心 {}对象存在 if (isObjectNull(moduleDep)) return { pickedFns: pickedFns, setted: [], changed: [], retKey2stateKeys: {} }; var retKey2fn = moduleDep.retKey2fn, retKey2lazy = moduleDep.retKey2lazy, stateKey2retKeys = moduleDep.stateKey2retKeys, retKey2stateKeys = moduleDep.retKey2stateKeys, fnCount = moduleDep.fnCount; /** 首次调用 */ if (isBeforeMount) { var retKeys = okeys(retKey2fn); var _setted = okeys(committedState); var _changed = _setted; if (type === 'computed') { return { pickedFns: retKeys.map(function (retKey) { return _wrapFn(retKey, retKey2fn, retKey2lazy[retKey]); }).sort(sortCb), setted: _setted, changed: _changed, retKey2stateKeys: retKey2stateKeys }; } // for watch retKeys.forEach(function (retKey) { var _retKey2fn$retKey2 = retKey2fn[retKey], fn = _retKey2fn$retKey2.fn, immediate = _retKey2fn$retKey2.immediate, depKeys = _retKey2fn$retKey2.depKeys, sort = _retKey2fn$retKey2.sort; if (immediate) pickedFns.push({ retKey: retKey, fn: fn, depKeys: depKeys, sort: sort }); }); pickedFns.sort(sortCb); return { pickedFns: pickedFns, setted: _setted, changed: _changed, retKey2stateKeys: retKey2stateKeys }; } // 这些目标stateKey的值发生了变化 var _differStateKeys = differStateKeys(oldState, committedState), setted = _differStateKeys.setted, changed = _differStateKeys.changed; if (setted.length === 0) { return { pickedFns: pickedFns, setted: [], changed: [], retKey2stateKeys: {} }; } //用setted + changed + module 作为键,缓存对应的pickedFns,这样相同形状的committedState再次进入此函数时,方便快速直接命中pickedFns var cacheKey = setted.join(',') + "|" + changed.join(',') + "|" + stateModule; // 要求用户必须在setup里静态的定义完computed & watch,动态的调用computed & watch的回调因为缓存原因不会被触发 var tmpNode = cacheArea_pickedRetKeys_[cate][type]; var cachePool = cUkey ? safeGet(tmpNode, cUkey) : tmpNode; var cachedPickedRetKeys = cachePool[cacheKey]; if (cachedPickedRetKeys) { // todo, for 2.5, call checkFnByDepPath with variable depKey_pathDepKeys_ return { pickedFns: cachedPickedRetKeys.map(function (retKey) { return _wrapFn(retKey, retKey2fn, retKey2lazy[retKey]); }), setted: setted, changed: changed, retKey2stateKeys: retKey2stateKeys }; } _pickFn(pickedFns, setted, changed, retKey2fn, stateKey2retKeys, retKey2lazy, fnCount); cachePool[cacheKey] = pickedFns.map(function (v) { return v.retKey; }); // todo, for 2.5, call checkFnByDepPath with variable depKey_pathDepKeys_ return { pickedFns: pickedFns, setted: setted, changed: changed, retKey2stateKeys: retKey2stateKeys }; } function _pickFn(pickedFns, settedStateKeys, changedStateKeys, retKey2fn, stateKey2retKeys, retKey2lazy, fnCount) { if (settedStateKeys.length === 0) return; // 把*的函数先全部挑出来, 有key的值发生变化了或者有设值行为 var starRetKeys = stateKey2retKeys['*']; if (starRetKeys) { var isKeyValChanged = changedStateKeys.length > 0; starRetKeys.forEach(function (retKey) { var _retKey2fn$retKey3 = retKey2fn[retKey], fn = _retKey2fn$retKey3.fn, compare = _retKey2fn$retKey3.compare, depKeys = _retKey2fn$retKey3.depKeys, sort = _retKey2fn$retKey3.sort; var toPush = { retKey: retKey, fn: fn, depKeys: depKeys, isLazy: retKey2lazy[retKey], sort: sort }; if (compare) { if (isKeyValChanged) pickedFns.push(toPush); return; } pickedFns.push(toPush); }); } // 继续遍历settedStateKeys, 挑选出剩余的目标fn(非*相关的) if (pickedFns.length < fnCount) { (function () { var retKey_picked_ = {}; var len = settedStateKeys.length; var _loop2 = function _loop2(i) { var stateKey = settedStateKeys[i]; var retKeys = stateKey2retKeys[stateKey]; //发生变化了的stateKey不一定在依赖列表里 if (!retKeys) return "continue"; retKeys.forEach(function (retKey) { //没有挑过的方法才挑出来 if (!retKey_picked_[retKey]) { var _retKey2fn$retKey4 = retKey2fn[retKey], fn = _retKey2fn$retKey4.fn, compare = _retKey2fn$retKey4.compare, depKeys = _retKey2fn$retKey4.depKeys, sort = _retKey2fn$retKey4.sort; var canPick; var isValChanged = changedStateKeys.includes(stateKey); // 检测出发生了变化,就一定pick if (isValChanged) { canPick = true; } else { // 对于未采用 immutable写法的object是检测不出是否改变的, // 因为指向同一个引用,isValChanged一定是false // 所以如果compare 为true,则要求用户严格采用immutable写法 // 为false的话,进入到这里,是已经set的key,canPick一定为true canPick = compare ? isValChanged : true; } if (canPick) { retKey_picked_[retKey] = true; pickedFns.push({ retKey: retKey, fn: fn, depKeys: depKeys, isLazy: retKey2lazy[retKey], sort: sort }); } } }); if (pickedFns.length === fnCount) return "break"; }; _loop: for (var i = 0; i < len; i++) { var _ret = _loop2(i); switch (_ret) { case "continue": continue; case "break": break _loop; } } })(); } pickedFns.sort(sortCb); } function setPartialState(partialState, state, key) { var value = state[key]; if (value !== undefined) { partialState[key] = value; return true; } return false; } // missKeyInState: true代表state含有stateKeys里不包含的key, false则不含 function extractStateByKeys (state, stateKeys, returnNullIfEmpty, needIgnored) { if (stateKeys === void 0) { stateKeys = []; } if (returnNullIfEmpty === void 0) { returnNullIfEmpty = false; } if (needIgnored === void 0) { needIgnored = false; } var partialState = {}, ignoredStateKeys = [], missKeyInState = false; if (!isPJO(state)) { return { partialState: returnNullIfEmpty ? null : partialState, isStateEmpty: true, ignoredStateKeys: ignoredStateKeys, missKeyInState: missKeyInState }; } var isStateEmpty = true; var committedStateKeys = okeys(state); var cLen = committedStateKeys.length; var sLen = stateKeys.length; if (cLen >= sLen) { missKeyInState = cLen > sLen; stateKeys.forEach(function (key) { if (setPartialState(partialState, state, key)) isStateEmpty = false; }); if (needIgnored) ignoredStateKeys = removeArrElements(committedStateKeys, stateKeys); } else { committedStateKeys.forEach(function (key) { if (stateKeys.includes(key)) { if (setPartialState(partialState, state, key)) isStateEmpty = false; } else { missKeyInState = true; if (needIgnored) ignoredStateKeys.push(key); } }); } if (isStateEmpty && returnNullIfEmpty) partialState = null; return { partialState: partialState, isStateEmpty: isStateEmpty, ignoredStateKeys: ignoredStateKeys, missKeyInState: missKeyInState }; } /** * 用于传递给 computed 回调收集相关依赖 * defComputed((newState, oldState)=>{ * // 此处的newState oldState即cuObState * }) * @param {{[key:string]:any}} state * @param {string[]} depKeys */ function makeCuObState (state, depKeys) { return new Proxy(state, { get: function get(target, key) { /** * 第一个isKeyValid判断,是为了防止误使用state算computed value,而触发了其他的key收集 * ctx.computed('count', n => { * return n * 2;// 正确写法本应该是 return n.count * 2 * }) * // 本应该是 n.count * 2, 写为 n * 2 后,触发的key分别为 * // valueOf, toString, Symbol(...) */ if (isKeyValid(target, key) && !depKeys.includes(key)) depKeys.push(key); return target[key]; }, // set: function (target, key) { set: function set() { // do nothing,拒绝用户在computed回调里修改state的值 return true; } }); } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var runtime_1 = createCommonjsModule(function (module) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var runtime = (function (exports) { var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that // don't natively support it. var IteratorPrototype = {}; IteratorPrototype[iteratorSymbol] = function () { return this; }; var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { // This environment has a native %IteratorPrototype%; use it instead // of the polyfill. IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); } exports.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; exports.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. exports.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return Promise.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return Promise.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. result.value = unwrapped; resolve(result); }, function(error) { // If a rejected Promise was yielded, throw the rejection back // into the async generator function so it can be handled there. return invoke("throw", error, resolve, reject); }); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new Promise(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. exports.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per 25.3.3.3.3 of the spec: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(context.arg) call above. context.method = "throw"; context.arg = record.arg; } } }; } // Call delegate.iterator[context.method](context.arg) and handle the // result, either by returning a { value, done } result from the // delegate iterator, or by modifying context.method and context.arg, // setting context.delegate to null, and returning the ContinueSentinel. function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined) { // A .throw or .return when the delegate iterator has no .throw // method always terminates the yield* loop. context.delegate = null; if (context.method === "throw") { // Note: ["return"] must be used for ES3 parsing compatibility. if (delegate.iterator["return"]) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { // If maybeInvokeDelegate(context) changed context.method from // "return" to "throw", let that override the TypeError below. return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError( "The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (! info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { // Assign the result of the finished delegate to the temporary // variable specified by delegate.resultName (see delegateYield). context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the // exception, let the outer generator proceed normally. If // context.method was "next", forget context.arg since it has been // "consumed" by the delegate iterator. If context.method was // "return", allow the original .return call to continue in the // outer generator. if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { // Re-yield the result returned by the delegate method. return info; } // The delegate iterator is finished, so forget it and continue with // the outer generator. context.delegate = null; return ContinueSentinel; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the // @@iterator function is called on it. Some browsers' implementations of the // iterator prototype chain incorrectly implement this, causing the Generator // object to not be returned from this call. This ensures that doesn't happen. // See https://github.com/facebook/regenerator/issues/274 for more details. Gp[iteratorSymbol] = function() { return this; }; Gp.toString = function() { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } exports.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } // Return an iterator with no values. return { next: doneResult }; } exports.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, 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; if (caught) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. context.method = "next"; context.arg = undefined; } return !! caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. this.arg = undefined; } return ContinueSentinel; } }; // Regardless of whether this script is executing as a CommonJS module // or not, return the runtime object so that we can declare the variable // regeneratorRuntime in the outer scope, which allows this module to be // injected easily by `bin/regenerator --include-runtime script.js`. return exports; }( // If this script is executing as a CommonJS module, use module.exports // as the regeneratorRuntime namespace. Otherwise create a new empty // object. Either way, the resulting object will be used to initialize // the regeneratorRuntime variable at the top of this file. module.exports )); try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { // This module should not be running in strict mode, so the above // assignment should always work unless something is misconfigured. Just // in case runtime.js accidentally runs in strict mode, we can escape // strict mode using a global Function call. This could conceivably fail // if a Content Security Policy forbids using Function, but in that case // the proper solution is to fix the accidental strict mode problem. If // you've misconfigured your bundler to force strict mode and applied a // CSP to forbid Function, and you're not willing to fix either of those // problems, please detail your unique predicament in a GitHub issue. Function("r", "regeneratorRuntime = r")(runtime); } }); var regenerator = runtime_1; function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } var sigs = [SIG_FN_START, SIG_FN_END, SIG_FN_QUIT, SIG_FN_ERR, SIG_MODULE_CONFIGURED, SIG_STATE_CHANGED, SIG_ASYNC_COMPUTED_START, SIG_ASYNC_COMPUTED_END, SIG_ASYNC_COMPUTED_ERR, SIG_ASYNC_COMPUTED_BATCH_START, SIG_ASYNC_COMPUTED_BATCH_END]; var sig2cbs = {}; sigs.forEach(function (sig) { return sig2cbs[sig] = []; }); function _pushSigCb(sigMap, sigOrSigs, cb) { function pushCb(sig, cb) { var cbs = sigMap[sig]; if (cb) { cbs.push(cb); } else { console.warn("invalid sig[" + sig + "]"); } } if (Array.isArray(sigOrSigs)) { sigOrSigs.forEach(function (sig) { pushCb(sig, cb); }); } else { pushCb(sigOrSigs, cb); } } function clearCbs() { sigs.forEach(function (sig) { return sig2cbs[sig].length = 0; }); } function send(sig, payload) { var cbs = sig2cbs[sig]; cbs.forEach(function (cb) { try { cb({ sig: sig, payload: payload }); } catch (err) { // plugin error should not abort dispatch process // for letting plugin error be isolate, I have to put try catch block in forEach loop rh.tryHandleError(err, true); } }); } function on(sigOrSigs, cb) { _pushSigCb(sig2cbs, sigOrSigs, cb); } var waKey2uKeyMap$1 = waKey2uKeyMap, waKey2staticUKeyMap$1 = waKey2staticUKeyMap; function triggerReRender(ref) { if (!ref) return; // 对于挂载好了还未卸载的实例,才有必要触发重渲染 if (ref.__$$ms === MOUNTED) { var refCtx = ref.ctx; refCtx.__$$ccForceUpdate(); } } function executeCuInfo(_x) { return _executeCuInfo.apply(this, arguments); } function _executeCuInfo() { _executeCuInfo = _asyncToGenerator( /*#__PURE__*/ regenerator.mark(function _callee(cuInfo) { var fns, len, sourceType, ref, module, fnAsync, fnRetKeys, cuRetContainer, retKey2stateKeys, isModule, stateKeys, curRetKey, i, fn, isAsync, retKey, ret, toSend, uKeyMap, uKeys; return regenerator.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.prev = 0; fns = cuInfo.fns; len = fns.length; if (!(len === 0)) { _context.next = 5; break; } return _context.abrupt("return"); case 5: _context.next = 7; return delay(); case 7: sourceType = cuInfo.sourceType, ref = cuInfo.ref, module = cuInfo.module, fnAsync = cuInfo.fnAsync, fnRetKeys = cuInfo.fnRetKeys, cuRetContainer = cuInfo.cuRetContainer, retKey2stateKeys = cuInfo.retKey2stateKeys; isModule = sourceType !== CATE_REF; stateKeys = []; curRetKey = ''; _context.prev = 11; send(SIG_ASYNC_COMPUTED_BATCH_START, { module: module }); i = 0; case 14: if (!(i < len)) { _context.next = 34; break; } fn = fns[i]; isAsync = fnAsync[i]; retKey = fnRetKeys[i]; curRetKey = retKey; ret = void 0; send(SIG_ASYNC_COMPUTED_START, { module: module, retKey: retKey }); if (!isAsync) { _context.next = 27; break; } _context.next = 24; return fn(); case 24: ret = _context.sent; _context.next = 28; break; case 27: ret = fn(); case 28: cuRetContainer[retKey] = makeCuPackedValue(false, ret); send(SIG_ASYNC_COMPUTED_END, { module: module, retKey: retKey }); if (isModule) stateKeys = stateKeys.concat(retKey2stateKeys[retKey]); case 31: i++; _context.next = 14; break; case 34: send(SIG_ASYNC_COMPUTED_BATCH_END, { module: module }); _context.next = 41; break; case 37: _context.prev = 37; _context.t0 = _context["catch"](11); if (isModule) { toSend = { module: module, err: _context.t0, retKey: curRetKey }; send(SIG_ASYNC_COMPUTED_ERR, toSend); send(SIG_ASYNC_COMPUTED_BATCH_END, toSend); } rh.tryHandleError(_context.t0); case 41: if (isModule) { // 让所有正确执行完毕的计算函数关联到的实例能够被触发重渲染 stateKeys = Array.from(new Set(stateKeys)); uKeyMap = {}; stateKeys.forEach(function (stateKey) { var waKey = module + "/" + stateKey; // 利用assign不停的去重 Object.assign(uKeyMap, waKey2uKeyMap$1[waKey], waKey2staticUKeyMap$1[waKey]); }); uKeys = okeys(uKeyMap); uKeys.forEach(function (refKey) { triggerReRender(refs[refKey]); }); } else { triggerReRender(ref); } _context.next = 47; break; case 44: _context.prev = 44; _context.t1 = _context["catch"](0); rh.tryHandleError(_context.t1); case 47: case "end": return _context.stop(); } } }, _callee, null, [[0, 44], [11, 37]]); })); return _executeCuInfo.apply(this, arguments); } /** @typedef {import('../../types-inner').IRefCtx} IRefCtx */ // cur: {} compare: {a:2, b:2, c:2} compareCount=3 nextCompare:{} // // receive cur in rendering period as below // cur: {a:'val', c:'val', d:'val'} // // after render // cur: {a:1, c:1, d:1} compare: {a:1, b:2, c:1, d:1} compareCount=4 nextCompare:{a:2, c:2, d:2} // // then concent know 'b' should delete from dep because its value is 2, // if compare key count become bigger than previous render(4>3) or compare key values include 2, // then cache will be expired // // before next render, assign nextCompare to compare, clear cur and nextCompare // cur: {} compare: {a:2, c:2, d:2} compareCount=3 nextCompare:{} function updateDep (ref, module, key, isForModule) { // 这个key不是模块的stateKey,则忽略依赖记录 if (!moduleName2stateKeys[module].includes(key)) { return; } /** @type IRefCtx */ var refCtx = ref.ctx; if (refCtx.__$$inBM === true // 还处于beforeMount步骤 || refCtx.__$$renderStatus === START) { var ccUniqueKey = refCtx.ccUniqueKey; var waKey = makeWaKey(module, key); // 未挂载时,是refWatch 或者 refComputed 函数里读取了moduleComputed的值间接推导出来的依赖stateKey // 则写到static块里,防止依赖丢失 if (refCtx.__$$inBM === true) { refCtx.__$$staticWaKeys[waKey] = 1; return; } if (!isForModule) { // for ref connect // 处于非自动收集状态则忽略,依赖在buildRefCtx时已记录 if (refCtx.connect[module] !== '-') return; var __$$curConnWaKeys = refCtx.__$$curConnWaKeys, __$$compareConnWaKeys = refCtx.__$$compareConnWaKeys, __$$nextCompareConnWaKeys = refCtx.__$$nextCompareConnWaKeys, __$$nextCompareConnWaKeyCount = refCtx.__$$nextCompareConnWaKeyCount; // TODO: 考虑用 waKey 写在map里 mapInsM(waKey, ccUniqueKey); __$$curConnWaKeys[module][key] = 1; __$$compareConnWaKeys[module][key] = 1; var tmpMap = __$$nextCompareConnWaKeys[module]; if (!tmpMap[key]) { tmpMap[key] = 2; __$$nextCompareConnWaKeyCount[module]++; } } else { // for ref module // 处于非自动收集状态则忽略 if (refCtx.watchedKeys !== '-') return; var __$$curWaKeys = refCtx.__$$curWaKeys, __$$compareWaKeys = refCtx.__$$compareWaKeys, __$$nextCompareWaKeys = refCtx.__$$nextCompareWaKeys; mapInsM(waKey, ccUniqueKey); __$$curWaKeys[key] = 1; __$$compareWaKeys[key] = 1; if (!__$$nextCompareWaKeys[key]) { __$$nextCompareWaKeys[key] = 2; refCtx.__$$nextCompareWaKeyCount++; } } } } /** * 为每一个实例单独建立了一个获取计算结果的观察容器,方便写入依赖 */ var hasOwnProperty = Object.prototype.hasOwnProperty; var _computedRawValues$1 = computedMap._computedRawValues, _computedValues$1 = computedMap._computedValues, _computedRaw$1 = computedMap._computedRaw, _computedDep$1 = computedMap._computedDep; // refModuleCuDep 来自 ref.ctx.computedDep function writeRetKeyDep(refModuleCuDep, ref, module, retKey, isForModule) { // 所有组件都自动连接到$$global模块,但是未必有对$$global模块的retKey依赖 var retKey2stateKeys = refModuleCuDep.retKey2stateKeys || {}; var stateKeys = retKey2stateKeys[retKey] || []; stateKeys.forEach(function (stateKey) { updateDep(ref, module, stateKey, isForModule); }); // TODO: retKey_otherModStateKeys_ ---> updateDep(ref, module, stateKey, false); } /** 此函数被以下两种场景调用, 1 模块首次运行computed&watch时 2 实例首次运行computed&watch时 用于生成cuVal透传给计算函数fnCtx.cuVal, 用户读取cuVal的结果时,收集到当前计算函对其他计算函数的依赖关系 module: function fullName(n, o, f){ return n.firstName + n.lastName; } // 此时funnyName依赖是 firstName lastName age function funnyName(n, o, f){ const { fullName } = f.cuVal; return fullName + n.age; } ref: ctx.computed('fullName',(n, o, f)=>{ return n.firstName + n.lastName; }) // 此时funnyName依赖是 firstName lastName age ctx.computed('funnyName',(n, o, f)=>{ const { fullName } = f.cuVal; return fullName + n.age; }) */ function getSimpleObContainer(retKey, sourceType, fnType, module, /**@type ICtx*/ refCtx, retKeys, referInfo) { var oriCuContainer, oriCuObContainer, computedRaw; if (CATE_MODULE === sourceType) { oriCuContainer = _computedRawValues$1[module]; oriCuObContainer = _computedValues$1[module]; computedRaw = _computedRaw$1[module]; } else { oriCuContainer = refCtx.refComputedRawValues; oriCuObContainer = refCtx.refComputedValues; computedRaw = refCtx.computedRetKeyFns; } // create cuVal return new Proxy(oriCuContainer, { get: function get(target, otherRetKey) { var fnInfo = sourceType + " " + fnType + " retKey[" + retKey + "]"; // 1 防止用户从 cuVal读取不存在的key // 2 首次按序执行所有的computed函数时,前面的计算函数取取不到后面的计算结果,收集不到依赖,所以这里强制用户要注意计算函数的书写顺序 if (hasOwnProperty.call(oriCuContainer, otherRetKey)) { if (isAsyncFn(computedRaw[otherRetKey], module + "/" + otherRetKey)) { referInfo.hasAsyncCuRefer = true; // 不允许读取异步计算函数结果做二次计算,隔离一切副作用,确保依赖关系简单和纯粹 // throw new Error(`${fnInfo}, get an async retKey[${otherRetKey}] from cuVal is not allowed`); } retKeys.push(otherRetKey); } else { justWarning(fnInfo + " get cuVal invalid retKey[" + otherRetKey + "]"); } // 从已定义 defineProperty 的计算结果容器里获取结果 return oriCuObContainer[otherRetKey]; }, set: function set() { return true; } }); } /** * 创建一个具有依赖收集行为的计算结果获取容器 * @param {IRef} ref * @param {string} module - 模块名称 * @param {boolean} isForModule - true: belong to one module, false: connect other modules * @param {boolean} isRefCu - 为ref创建 */ function makeCuRefObContainer (ref, module, isForModule, isRefCu) { if (isForModule === void 0) { isForModule = true; } if (isRefCu === void 0) { isRefCu = false; } var ctx = ref.ctx; var moduleCuRetContainer = _computedValues$1[module]; // 注意isRefCu为true时,beforeMount时做了相关的赋值操作,保证了读取ref.ctx下目标属性是安全的 var oriCuContainer = isRefCu ? ctx.refComputedRawValues : _computedRawValues$1[module]; if (!oriCuContainer) return {}; // refComputed 的 cuRetWrapper 是在setup执行完毕后会被替换成填充满属性的新引用 refComputedValues // 见 before-mount里: ctx.refComputedValues =.... // 所以需要在get时现取,而不能在闭包作用域内提前缓存起来反复使用 var getCuRetContainer = function getCuRetContainer() { return isRefCu ? ctx.refComputedValues : moduleCuRetContainer; }; // 为普通的计算结果容器建立代理对象 return new Proxy(oriCuContainer, { get: function get(target, retKey) { // 防止用户从 cuVal读取不存在的key if (hasOwnProperty.call(oriCuContainer, retKey)) { // 由refComputed.{keyName}取值触发 if (isRefCu) { var computedDep = ref.ctx.computedDep; okeys(computedDep).forEach(function (m) { writeRetKeyDep(computedDep[m], ref, m, retKey, isForModule); }); } else { // 由moduleComputed.{keyName} 或者 connectedComputed.{moduleName}.{keyName} 取值触发 writeRetKeyDep(_computedDep$1[module], ref, module, retKey, isForModule); } } // 从已定义defineProperty的计算结果容器里获取结果 var cuRetWrapper = getCuRetContainer(); return cuRetWrapper[retKey]; }, set: function set(target, retKey, value) { target[retKey] = value; return true; } }); } /* eslint-disable camelcase */ var noCommit = function noCommit(tip, asIs) { return justWarning(tip + " call commit or commitCu as it is " + asIs); }; // 记录某个cuRetKey引用过哪些staticCuRetKeys // 直接引用或者间接引用过staticCuRetKey都会记录在列表内 var modCuRetKey_referStaticCuRetKeys_ = {}; var refCuRetKey_referStaticCuRetKeys_ = {}; function getCuRetKeyRSListMap(sourceType, module, ccUniqueKey) { if (sourceType == CATE_MODULE) { return safeGet(modCuRetKey_referStaticCuRetKeys_, module); } else { return safeGet(refCuRetKey_referStaticCuRetKeys_, ccUniqueKey); } } function getCuRetKeyRSList(cuRetKey, sourceType, module, ccUniqueKey) { var map = getCuRetKeyRSListMap(sourceType, module, ccUniqueKey); return safeGetArray(map, cuRetKey); } function clearCuRefer() { modCuRetKey_referStaticCuRetKeys_ = {}; refCuRetKey_referStaticCuRetKeys_ = {}; } function getCuDep(refCtx, sourceType) { return sourceType === CATE_REF ? refCtx.computedDep : computedMap._computedDep; } function setStateKeyRetKeysMap(refCtx, sourceType, fnType, stateModule, retKey, keys, isKeysDep) { if (isKeysDep === void 0) { isKeysDep = true; } if (keys.length === 0) return; var modDep, cuModDep; if (sourceType === CATE_REF) { // 由ref发起调用,refCtx是肯定有值的 var computedDep = refCtx.computedDep; var depDesc = fnType === FN_CU ? computedDep : refCtx.watchDep; cuModDep = safeGet(computedDep, stateModule); modDep = safeGet(depDesc, stateModule); } else { var cuDep = computedMap._computedDep; var _depDesc = fnType === FN_CU ? cuDep : watch._watchDep; cuModDep = safeGet(cuDep, stateModule); modDep = safeGet(_depDesc, stateModule); } var stateKey2retKeys = safeGet(modDep, 'stateKey2retKeys'); var retKey2stateKeys = safeGet(modDep, 'retKey2stateKeys'); var updateRelationship = function updateRelationship(depKeys) { var stateKeys = safeGetArray(retKey2stateKeys, retKey); depKeys.forEach(function (sKey) { var retKeys = safeGetArray(stateKey2retKeys, sKey); // 此处判断一下retKeys,谨防用户直接在computed里操作obState, 这里拿到的sKey是一堆原型链上key,如`valueOf`等 if (Array.isArray(retKeys) && !retKeys.includes(retKey)) retKeys.push(retKey); if (!stateKeys.includes(sKey)) stateKeys.push(sKey); }); }; if (isKeysDep) { // keys is depKeys updateRelationship(keys); } else { // keys is retKeys, 将retKeys里各自retKey的stateKeys转移给目标retKey keys.forEach(function (sourceRetKey) { // 这里取的是cu模块的retKey_stateKeys_ var retKey2stateKeys = safeGet(cuModDep, 'retKey2stateKeys'); var sourceStateKeys = retKey2stateKeys[sourceRetKey] || []; updateRelationship(sourceStateKeys); }); } } function getRetKeyFnMap(refCtx, sourceType, stateModule) { // 始终从_computedDep 取retKey_fn_,来判断commitCu提交的retKey是否合法 if (sourceType === CATE_REF) { return refCtx.computedRetKeyFns; } else { var moduleDep = computedMap._computedDep[stateModule] || {}; return moduleDep.retKey2fn || {}; } } function mapRSList(cuRetKey, referCuRetKeys, refCtx, ccUniqueKey, sourceType, stateModule) { var cuRetKey_referStaticCuRetKeys_ = getCuRetKeyRSListMap(cuRetKey, sourceType, stateModule, ccUniqueKey); var retKey2fn = getRetKeyFnMap(refCtx, sourceType, stateModule); var referStaticCuRetKeys = safeGetArray(cuRetKey_referStaticCuRetKeys_, cuRetKey); referCuRetKeys.forEach(function (referCuRetKey) { var fnDesc = retKey2fn[referCuRetKey]; // 直接引用 if (fnDesc.isStatic) { referStaticCuRetKeys.push(referCuRetKey); } else { var tmpRSList = safeGetArray(cuRetKey_referStaticCuRetKeys_, referCuRetKey); // 把引用的referCuRetKey对应的staticCuRetKey列表记录到当前cuRetKey的staticCuRetKey列表记录上 // 因为computed函数是严格按需执行的,所以此逻辑能够成立 tmpRSList.forEach(function (staticCuRetKey) { return noDupPush(referStaticCuRetKeys, staticCuRetKey); }); } }); } var STOP_FN = Symbol('sf'); // fnType: computed watch // sourceType: module ref // initialDeltaCommittedState 会在整个过程里收集所有的提交状态 function executeDepFns(ref, stateModule, refModule, oldState, finder, committedState, initialNewState, initialDeltaCommittedState, callInfo, isFirstCall, fnType, sourceType, computedContainer, mergeToDelta) { if (ref === void 0) { ref = {}; } if (mergeToDelta === void 0) { mergeToDelta = true; } var refCtx = ref.ctx; var ccUniqueKey = refCtx ? refCtx.ccUniqueKey : ''; // while循环结束后,收集到的所有的新增或更新state var committedStateInWhile = {}; var nextTickCuInfo = { sourceType: sourceType, ref: ref, module: stateModule, fns: [], fnAsync: [], fnRetKeys: [], cuRetContainer: computedContainer }; var whileCount = 0; var curStateForComputeFn = committedState; var hasDelta = false; var _loop = function _loop() { whileCount++; // 因为beforeMountFlag为true的情况下,finder里调用的pickDepFns会挑出所有函数, // 这里必需保证只有第一次循环的时候取isFirstCall的实际值,否则一定取false,(要不然就陷入无限死循环,每一次都是true,每一次都挑出所有dep函数执行) var beforeMountFlag = whileCount === 1 ? isFirstCall : false; var _finder = finder(curStateForComputeFn, beforeMountFlag), pickedFns = _finder.pickedFns, setted = _finder.setted, changed = _finder.changed, retKey2stateKeys = _finder.retKey2stateKeys; nextTickCuInfo.retKey2stateKeys = retKey2stateKeys; if (!pickedFns.length) return "break"; var _makeCommitHandler = makeCommitHandler(), commit = _makeCommitHandler.commit, getFnCommittedState = _makeCommitHandler.getFnCommittedState; var _makeCommitHandler2 = makeCommitHandler(), commitCu = _makeCommitHandler2.commit, getRetKeyCu = _makeCommitHandler2.getFnCommittedState, clearCu = _makeCommitHandler2.clear; pickedFns.forEach(function (_ref) { var retKey = _ref.retKey, fn = _ref.fn, depKeys = _ref.depKeys, isLazy = _ref.isLazy; var keyInfo = sourceType + " " + fnType + " retKey[" + retKey + "]"; var tip = keyInfo + " can't"; // 异步计算的初始值 var initialVal = ''; var isInitialValSetted = false; var fnCtx = { retKey: retKey, callInfo: callInfo, isFirstCall: isFirstCall, commit: commit, commitCu: commitCu, setted: setted, changed: changed, // 在sourceType为module时, 如果非首次计算 // computedContainer只是一个携带defineProperty的计算结果收集容器,没有收集依赖行为 cuVal: computedContainer, committedState: curStateForComputeFn, deltaCommittedState: initialDeltaCommittedState, stateModule: stateModule, refModule: refModule, oldState: oldState, refCtx: refCtx, setInitialVal: function setInitialVal() { beforeMountFlag && justWarning("non async " + keyInfo + " call setInitialVal is unnecessary"); } }; // 循环里的首次计算且是自动收集状态,注入代理对象,收集计算&观察依赖 var needCollectDep = beforeMountFlag && depKeys === '-'; // 用户通过cuVal读取其他计算结果时,记录cuRetKeys,用于辅助下面计算依赖 var collectedCuRetKeys = []; // 读取newState时,记录stateKeys,用于辅助下面计算依赖 var collectedDepKeys = []; // 对于computed,首次计算时会替换为obContainer用于收集依赖 // !!!对于watch,immediate为true才有机会替换为obContainer收集到依赖 var referInfo = { hasAsyncCuRefer: false }; if (needCollectDep) { // 替换cuVal,以便动态的收集到computed&watch函数里读取cuVal时计算相关依赖 fnCtx.cuVal = getSimpleObContainer(retKey, sourceType, fnType, stateModule, refCtx, collectedCuRetKeys, referInfo); } if (fnType === FN_CU) { var isCuFnAsync = isAsyncFn(fn, stateModule + "/" + retKey); if (isLazy || isCuFnAsync) { // lazyComputed 和 asyncComputed 不能调用commit commitCu,以隔绝副作用 var asIs = isLazy ? 'lazy' : 'async computed'; fnCtx.commit = function () { return noCommit(tip, asIs); }; fnCtx.commitCu = fnCtx.commit; if (isCuFnAsync) fnCtx.setInitialVal = function (val) { initialVal = val; isInitialValSetted = true; // 这里阻止异步计算函数的首次执行,交给executeAsyncCuInfo去触发 if (beforeMountFlag) throw STOP_FN; }; } if (isLazy) { computedContainer[retKey] = makeCuPackedValue(isLazy, null, true, fn, initialNewState, oldState, fnCtx); } else { var newStateArg = initialNewState, oldStateArg = oldState; // 首次计算时,new 和 old是同一个对象,方便用于收集depKeys if (needCollectDep) { oldStateArg = makeCuObState(initialNewState, collectedDepKeys); newStateArg = oldStateArg; } // TODO: fnCtx.connectedState 转为代理对象,用于收集到连接模块的依赖 // 让示例 https://codesandbox.io/s/ref-watch-read-connected-state-prb4v?file=/src/App.js 正常工作 // 不同的sourceType,创建的connectedState不一样 // for module: fnCtx.getComputed, fnCtx.getState, // 此处会检查模块加载顺序,然后appendState创建一个隐含的key,然后在目标模块创建一个watch函数 // for ref: fnCtx.connectedState, fnCtx.connectedComputed // 确保 (n,o,f)里的n o总是实例的state var computedRet; // 异步函数首次执行时才去调用它,仅为了收集依赖 if (isCuFnAsync) { if (beforeMountFlag) { fn(newStateArg, oldStateArg, fnCtx)["catch"](function (err) { if (err !== STOP_FN) throw err; }); } } else { computedRet = fn(newStateArg, oldStateArg, fnCtx); } if (isCuFnAsync || referInfo.hasAsyncCuRefer) { // 首次计算时需要赋初始化值 if (beforeMountFlag) { if (!isInitialValSetted) { throw new Error("async " + keyInfo + " forget call setInitialVal"); } computedRet = initialVal; } else { // 不做任何新的计算,还是赋值原来的结果 // 新的结果等待 asyncComputedMgr 来计算并触发相关实例重渲染 computedRet = computedContainer[retKey]; } // 替换掉setInitialVal,使其失效 fnCtx.setInitialVal = noop; fnCtx.commit = function () { return noCommit(tip, 'async computed or it refers async computed ret'); }; fnCtx.commitCu = fnCtx.commit; // 安排到nextTickCuInfo里,while结束后单独触发它们挨个按需计算 nextTickCuInfo.fns.push(function () { return fn(newStateArg, oldStateArg, fnCtx); }); nextTickCuInfo.fnAsync.push(isCuFnAsync); nextTickCuInfo.fnRetKeys.push(retKey); } // 记录计算结果 computedContainer[retKey] = makeCuPackedValue(false, computedRet); if (needCollectDep) { // 在computed函数里读取了newState的stateKey,需要将其记录到当前retKey的依赖列表上 // 以便能够在相应stateKey值改变时,能够正确命中该computed函数 setStateKeyRetKeysMap(refCtx, sourceType, FN_CU, stateModule, retKey, collectedDepKeys); // 在computed里读取cuVal里的其他retKey结果, 要将其他retKey对应的stateKeys写到当前retKey的依赖列表上, // 以便能够在相应stateKey值改变时,能够正确命中该computed函数 setStateKeyRetKeysMap(refCtx, sourceType, FN_CU, stateModule, retKey, collectedCuRetKeys, false); mapRSList(retKey, collectedCuRetKeys, refCtx, ccUniqueKey, sourceType, stateModule); } } } else { // watch var tmpInitialNewState = initialNewState; var tmpOldState = oldState; // 首次触发watch时,才传递ob对象,用于收集依赖 if (needCollectDep) { tmpInitialNewState = makeCuObState(initialNewState, collectedDepKeys); // new 和 old是同一个对象,方便用于收集depKeys tmpOldState = tmpInitialNewState; } fn(tmpInitialNewState, tmpOldState, fnCtx); // 首次触发watch时, 才记录依赖 if (needCollectDep) { // 在watch函数里读取了newState的stateKey,需要将其记录到当前watch retKey的依赖列表上 // 以便能够在相应stateKey值改变时,能够正确命中该watch函数 setStateKeyRetKeysMap(refCtx, sourceType, FN_WATCH, stateModule, retKey, collectedDepKeys); // 在watch里读取了cuVal里的retKey结果,要将这些retKey对应的stateKey依赖附加到当前watch retKey的依赖列表上, // 以便能够在相应stateKey值改变时,能够正确命中该watch函数 setStateKeyRetKeysMap(refCtx, sourceType, FN_WATCH, stateModule, retKey, collectedCuRetKeys, false); } } // refCompute&refWatch 里获取state、moduleState、connectedState的值收集到的depKeys要记录为ref的静态依赖 if (needCollectDep && sourceType === CATE_REF) { collectedDepKeys.forEach(function (key) { return refCtx.__$$staticWaKeys[makeWaKey(stateModule, key)] = 1; }); // 注:refWatch直接读取了moduleComputed 或者 connectedComputed的值时也收集到了依赖 // 逻辑在updateDep里判断__$$isBM来确定是不是首次触发 } // 对于模块计算过程,fn里调用committedCu,computedContainer是moduleComputed结果容器, // 对于实例计算过程,fn里调用committedCu来说,computedContainer是refComputed结果容器 // 每一个retKey返回的committedCu都及时处理掉,因为下面setStateKeyRetKeysMap需要对此时的retKey写依赖 var committedCuRet = getRetKeyCu(); if (committedCuRet) { var retKey2fn = getRetKeyFnMap(refCtx, sourceType, stateModule); okeys(committedCuRet).forEach(function (cuRetKey) { // 模块计算函数里调用commitCu只能修改模块计算retKey // 实例计算函数里调用commitCu只能修改实例计算retKey var fnDesc = retKey2fn[cuRetKey]; if (!fnDesc) justWarning("commitCu:" + tip + " commit [" + cuRetKey + "], it is not defined"); // 由committedCu提交的值,可以统一当作非lazy值set回去,方便取的时候直接取 else { // 检查提交目标只能是静态的cuRetKey if (fnDesc.isStatic) { var RSList = getCuRetKeyRSList(cuRetKey, sourceType, stateModule, ccUniqueKey); if (RSList.includes(cuRetKey)) { // 直接或间接引用了这个cuRetKey,就不能去改变它,以避免死循环 justWarning("commitCu:" + tip + " change [" + cuRetKey + "], [" + retKey + "] referred [" + cuRetKey + "]"); } else { computedContainer[cuRetKey] = makeCuPackedValue(false, committedCuRet[cuRetKey]); } } else { justWarning("commitCu:" + tip + " change [" + cuRetKey + "], it must have zero dep keys"); } } }); clearCu(); } }); // 这里一次性处理所有computed or watch函数提交了然后合并后的state curStateForComputeFn = getFnCommittedState(); if (curStateForComputeFn) { // toAssign may be null var assignCuState = function assignCuState(toAssign, mergeAssign) { if (mergeAssign === void 0) { mergeAssign = false; } // 确保finder函数只针对这一部分新提交的状态去触发computed or watch if (mergeAssign) Object.assign(curStateForComputeFn, toAssign);else curStateForComputeFn = toAssign; if (!curStateForComputeFn) return; Object.assign(committedStateInWhile, curStateForComputeFn); if (mergeToDelta) { Object.assign(initialNewState, curStateForComputeFn); Object.assign(initialDeltaCommittedState, curStateForComputeFn); } else { // 强行置为null,结束while循环 // mergeToDelta为false表示这是来自connectedRefs触发的 cu 或者 wa 函数 // 此时传入的 initialDeltaCommittedState 是模块state // 但是实例里 cu 或 wa 函数只能commit private state // 收集到 committedStateInWhile 后,在外面单独触发新的 computedForRef watchForRef过程 curStateForComputeFn = null; } hasDelta = true; }; var ensureCommittedState = function ensureCommittedState(fnCommittedState) { // !!! 确保实例里调用commit只能提交privState片段,模块里调用commit只能提交moduleState片段 // !!! 同时确保privState里的key是事先声明过的,而不是动态添加的 var stateKeys = sourceType === 'ref' ? refCtx.privStateKeys : moduleName2stateKeys[stateModule]; var _extractStateByKeys = extractStateByKeys(fnCommittedState, stateKeys, true), partialState = _extractStateByKeys.partialState, ignoredStateKeys = _extractStateByKeys.ignoredStateKeys; if (ignoredStateKeys.length) { var reason = "they are not " + (sourceType === CATE_REF ? 'private' : 'module') + ", fn is " + sourceType + " " + fnType; justWarning("these state keys[" + ignoredStateKeys.join(',') + "] are invalid, " + reason); } return partialState; // 返回合法的提交状态 }; var partialState = ensureCommittedState(curStateForComputeFn); if (partialState) { assignCuState(partialState); // watch里提交了新的片段state,再次过一遍computed、watch函数 if (fnType === FN_WATCH) { // const stateKey2retKeys = getStateKeyRetKeysMap(refCtx, sourceType, stateModule); var computedDep = getCuDep(refCtx, sourceType, stateModule); var _finder2 = function _finder2(committedState, isBeforeMount) { return pickDepFns(isBeforeMount, sourceType, FN_CU, computedDep, stateModule, oldState, committedState, ccUniqueKey); }; // 一轮watch函数执行结束,去触发对应的computed计算 var _executeDepFns = executeDepFns(ref, stateModule, refModule, oldState, _finder2, partialState, initialNewState, initialDeltaCommittedState, callInfo, false, // 再次由watch发起的computed函数查找调用,irFirstCall,一定是false FN_CU, sourceType, computedContainer), _hasDelta = _executeDepFns.hasDelta, newCommittedState = _executeDepFns.newCommittedState; if (_hasDelta) { // see https://codesandbox.io/s/complex-cu-watch-chain-s9wzt, // 输入 cc.setState('test', {k1:Date.now()}),确保k4 watch被触发 var validCommittedState = ensureCommittedState(newCommittedState); // 让validCommittedState合并到curStateForComputeFn里,确保下一轮循环相关watch能被computed里提交的状态触发 assignCuState(validCommittedState, true); } } } } if (whileCount > 2) { justWarning('fnCtx.commit may goes endless loop, please check your code'); justWarning(callInfo); // 清空,确保不再触发while循环 curStateForComputeFn = null; } }; while (curStateForComputeFn) { var _ret = _loop(); if (_ret === "break") break; } executeCuInfo(nextTickCuInfo); return { hasDelta: hasDelta, newCommittedState: committedStateInWhile }; } var _reducer; var _computedValues$2 = computedMap._computedValues; var okeys$1 = okeys, extractChangedState$1 = extractChangedState; var getDispatcher = function getDispatcher() { return ccContext.permanentDispatcher; }; var setStateByModule = function setStateByModule(module, committedState, opts) { if (opts === void 0) { opts = {}; } var _opts = opts, _opts$ref = _opts.ref, ref = _opts$ref === void 0 ? null : _opts$ref, _opts$callInfo = _opts.callInfo, callInfo = _opts$callInfo === void 0 ? {} : _opts$callInfo, _opts$noSave = _opts.noSave, noSave = _opts$noSave === void 0 ? false : _opts$noSave, force = _opts.force; var moduleState = _getState(module); var moduleComputedValue = _computedValues$2[module]; var rootComputedDep = computedMap.getRootComputedDep(); var curDepComputedFns = function curDepComputedFns(committedState, isFirstCall) { return pickDepFns(isFirstCall, CATE_MODULE, 'computed', rootComputedDep, module, moduleState, committedState); }; var rootWatchDep = watch.getRootWatchDep(); var curDepWatchFns = function curDepWatchFns(committedState, isFirstCall) { return pickDepFns(isFirstCall, CATE_MODULE, 'watch', rootWatchDep, module, moduleState, committedState); }; var callerRef = ref || getDispatcher(); var refModule = callerRef.module; var newState = Object.assign({}, moduleState, committedState); var deltaCommittedState = Object.assign({}, committedState); var _findDepFnsToExecute = executeDepFns(callerRef, module, refModule, moduleState, curDepComputedFns, deltaCommittedState, newState, deltaCommittedState, callInfo, false, FN_CU, CATE_MODULE, moduleComputedValue), hasDeltaInCu = _findDepFnsToExecute.hasDelta; var _findDepFnsToExecute2 = executeDepFns(callerRef, module, refModule, moduleState, curDepWatchFns, deltaCommittedState, newState, deltaCommittedState, callInfo, false, FN_WATCH, CATE_MODULE, moduleComputedValue), hasDeltaInWa = _findDepFnsToExecute2.hasDelta; if (!noSave) { saveSharedState(module, deltaCommittedState, null, force); } return { hasDelta: hasDeltaInCu || hasDeltaInWa, deltaCommittedState: deltaCommittedState }; }; var saveSharedState = function saveSharedState(module, toSave, needExtract, force) { if (needExtract === void 0) { needExtract = false; } var target = toSave; if (needExtract) { var _extractStateByKeys = extractStateByKeys(toSave, moduleName2stateKeys[module], true), partialState = _extractStateByKeys.partialState; target = partialState; } var moduleState = _getState(module); var prevModuleState = _getPrevState(module); incModuleVer(module); // 调用 extractChangedState 时会更新 moduleState return extractChangedState$1(moduleState, target, { prevStateContainer: prevModuleState, incStateVer: function incStateVer(key) { return _incStateVer(module, key); } }, force); }; var _getState = function getState(module) { return _state[module]; }; var _getPrevState = function getPrevState(module) { return _prevState[module]; }; var getModuleVer = function getModuleVer(module) { if (!module) return _moduleVer; return _moduleVer[module]; }; var incModuleVer = function incModuleVer(module, val) { if (val === void 0) { val = 1; } try { _moduleVer[module] += val; } catch (err) { _moduleVer[module] = val; } }; function replaceMV(mv) { _moduleVer = mv; } var getStateVer = function getStateVer(module) { if (!module) return _stateVer; return _stateVer[module]; }; var _incStateVer = function _incStateVer(module, key) { _stateVer[module][key]++; }; var getRootState = function getRootState() { var _ref; return _ref = {}, _ref[MODULE_CC] = {}, _ref[MODULE_VOID] = {}, _ref[MODULE_GLOBAL] = {}, _ref[MODULE_DEFAULT] = {}, _ref; }; /** ccContext section */ var _state = getRootState(); var _prevState = getRootState(); // record state version, to let ref effect avoid endless execute // 1 effect里的函数再次出发当前实例渲染,渲染完后检查prevModuleState curModuleState, 对应的key值还是不一样,又再次出发effect,造成死循环 // 2 确保引用型值是基于原有引用修改某个属性的值时,也能触发effect var _stateVer = {}; // 优化before-render里无意义的merge mstate导致冗余的set(太多的set会导致 Maximum call stack size exceeded) // https://codesandbox.io/s/happy-bird-rc1t7?file=/src/App.js concent below 2.4.18会触发 var _moduleVer = {}; var ccContext = { getDispatcher: getDispatcher, isHotReloadMode: function isHotReloadMode() { if (ccContext.isHot) return true; return window && (window.webpackHotUpdate || isOnlineEditor()); }, runtimeVar: rv, runtimeHandler: rh, isHot: false, reComputed: true, isStartup: false, moduleName2stateFn: {}, // 映射好模块的状态所有key并缓存住,用于提高性能 moduleName2stateKeys: moduleName2stateKeys, // 记录模块是不是通过configure配置的 moduleName2isConfigured: {}, /** * ccClassContext:{ * module, * ccClassKey, * // renderKey机制影响的类范围,默认只影响调用者所属的类,如果有别的类观察了同一个模块的某个key,这个类的实例是否触发渲染不受renderKey影响 * // 为 * 表示影响所有的类,即其他类实例都受renderKey机制影响。 * renderKeyClasses, * } */ ccClassKey2Context: {}, /** * globalStateKeys is maintained by cc automatically, * when user call cc.setGlobalState, or ccInstance.setGlobalState, * committedState will be checked strictly by cc with globalStateKeys, * committedState keys must been included in globalStateKeys */ globalStateKeys: [], // store里的setState行为会自动触发模块级别的computed、watch函数 store: { appendState: function appendState(module, state) { if (!moduleName2stateKeys[module]) throw new Error("module[" + module + "] not configured"); var stateKeys = safeGetArray(moduleName2stateKeys, module); okeys$1(state).forEach(function (k) { if (!stateKeys.includes(k)) { stateKeys.push(k); } }); ccContext.store.setState(module, state); }, _state: _state, _prevState: _prevState, // 辅助effect逻辑用 _stateVer: _stateVer, // 触发时,比较state版本,防止死循环 getState: function getState(module) { if (module) return _getState(module);else return _state; }, getPrevState: function getPrevState(module) { if (module) return _getPrevState(module);else return _prevState; }, getStateVer: getStateVer, getModuleVer: getModuleVer, incModuleVer: incModuleVer, replaceMV: replaceMV, setState: function setState(module, partialSharedState, options) { return setStateByModule(module, partialSharedState, options); }, setGlobalState: function setGlobalState(partialGlobalState) { return setStateByModule(MODULE_GLOBAL, partialGlobalState); }, saveSharedState: saveSharedState, getGlobalState: function getGlobalState() { return _state[MODULE_GLOBAL]; } }, reducer: { _reducer: (_reducer = {}, _reducer[MODULE_GLOBAL] = {}, _reducer[MODULE_CC] = {}, _reducer), _caller: {}, // _reducerRefCaller: {},//为实例准备的reducer caller _fnName2fullFnNames: {}, _module2fnNames: {}, _module2Ghosts: {} }, computed: computedMap, watch: watch, refStore: { _state: {}, setState: function setState(ccUniqueKey, partialStoredState) { var _state = ccContext.refStore._state; var fullStoredState = _state[ccUniqueKey]; var mergedState = Object.assign({}, fullStoredState, partialStoredState); _state[ccUniqueKey] = mergedState; } }, lifecycle: lifecycle, ccUKey2ref: refs, /** * key:eventName, value: Array<{ccKey, identity, handlerKey}> */ event2handlers: {}, ccUKey2handlerKeys: {}, /** * to avoid memory leak, the handlerItem of event2handlers just store handlerKey, * it is a ref that towards ccUniqueKeyEvent_handler_'s key * when component unmounted, its handler will been removed */ handlerKey2handler: {}, waKey2uKeyMap: waKey2uKeyMap, waKey2staticUKeyMap: waKey2staticUKeyMap, module2insCount: module2insCount, refs: refs, info: { packageLoadTime: Date.now(), firstStartupTime: '', latestStartupTime: '', version: '2.15.2', author: 'fantasticsoul', emails: ['[email protected]', '[email protected]'], tag: 'glory' }, featureStr2classKey: {}, userClassKey2featureStr: {}, middlewares: [], plugins: [], pluginNameMap: {}, permanentDispatcher: null, localStorage: null, recoverRefState: noop, getModuleStateKeys: function getModuleStateKeys(m) { return ccContext.moduleName2stateKeys[m]; } }; ccContext.recoverRefState = function () { var localStorage = ccContext.localStorage; if (!localStorage) return; var lsLen = localStorage.length; var _refStoreState = ccContext.refStore._state; try { for (var i = 0; i < lsLen; i++) { var lsKey = localStorage.key(i); if (!lsKey.startsWith('CCSS_')) return; _refStoreState[lsKey.substr(5)] = JSON.parse(localStorage.getItem(lsKey)); } } catch (err) { console.error(err); } }; /** * when user call configure bofore run, * target module will be pushed to pending modules array, * later they all will been configured by run api in startup process */ var pendingModules = []; var isModuleNameCcLike$1 = isModuleNameCcLike, isModuleNameValid$1 = isModuleNameValid, vbi = verboseInfo, makeError$1 = makeError, okeys$2 = okeys; var store = ccContext.store, getModuleStateKeys = ccContext.getModuleStateKeys; /** 检查模块名,名字合法,就算检查通过 */ function checkModuleNameBasically(moduleName, innerParams) { if (innerParams === void 0) { innerParams = {}; } if (!isModuleNameValid$1(moduleName)) { throw new Error("module[" + moduleName + "] writing is invalid!"); } // moduleName will be named starting with $cc while calling createModule if (innerParams[ALCC_KEY] === 1) return; if (isModuleNameCcLike$1(moduleName)) { throw new Error("'$$cc' is a built-in module name"); } } /** * 检查模块名, moduleMustNotExisted 默认为true, * true表示【module名字合法】且【对应的moduleState不存在】,才算检查通过 * false表示【module名字合法】且【对应的moduleState存在】,才算检查通过 * @param {string} moduleName * @param {boolean} [moduleMustNotExisted=true] - true 要求模块应该不存在 ,false 要求模块状态应该已存在 */ function checkModuleName(moduleName, moduleMustNotExisted, vbiMsg, innerParams) { if (moduleMustNotExisted === void 0) { moduleMustNotExisted = true; } if (vbiMsg === void 0) { vbiMsg = ''; } var _vbiMsg = vbiMsg || "module[" + moduleName + "]"; var _state = store._state; checkModuleNameBasically(moduleName, innerParams); if (moduleName !== MODULE_GLOBAL) { if (moduleMustNotExisted) { if (isObjectNotNull(_state[moduleName])) { // 但是却存在了 throw makeError$1(ERR.CC_MODULE_NAME_DUPLICATE, vbi(_vbiMsg)); } } else { if (!_state[moduleName]) { // 实际上却不存在 throw makeError$1(ERR.CC_MODULE_NOT_FOUND, vbi(_vbiMsg)); } } } } function checkModuleNameAndState(moduleName, moduleState, moduleMustNotExisted, innerParams) { checkModuleName(moduleName, moduleMustNotExisted, '', innerParams); if (!isPJO(moduleState)) { throw new Error("module[" + moduleName + "]'s state " + INAJ); } } function checkStoredKeys(belongModule, storedKeys) { if (storedKeys === '*') { return; } if (Array.isArray(storedKeys)) { checkKeys(belongModule, storedKeys, false, 'storedKeys invalid '); return; } throw new Error("storedKeys type err, " + STR_ARR_OR_STAR); } function checkKeys(module, keys, keyShouldBeModuleStateKey, extraInfo) { if (keyShouldBeModuleStateKey === void 0) { keyShouldBeModuleStateKey = true; } if (extraInfo === void 0) { extraInfo = ''; } var keyword = keyShouldBeModuleStateKey ? '' : 'not '; var keyTip = function keyTip(name, keyword) { return extraInfo + "key[" + name + "] must " + keyword + "be a module state key"; }; var moduleStateKeys = getModuleStateKeys(module); keys.forEach(function (sKey) { var keyInModuleState = moduleStateKeys.includes(sKey); var throwErr = function throwErr() { throw new Error(keyTip(sKey, keyword)); }; if (keyShouldBeModuleStateKey) { !keyInModuleState && throwErr(); } else { keyInModuleState && throwErr(); } }); } function checkConnectSpec(connectSpec) { var invalidConnect = "param connect is invalid,"; var invalidConnectItem = function invalidConnectItem(m) { return invalidConnect + " module[" + m + "]'s value " + STR_ARR_OR_STAR; }; okeys$2(connectSpec).forEach(function (m) { checkModuleName(m, false); var val = connectSpec[m]; if (typeof val === 'string') { if (val !== '*' && val !== '-') throw new Error(invalidConnectItem(m)); } else if (!Array.isArray(val)) { throw new Error(invalidConnectItem(m)); } else { checkKeys(m, val, true, "connect module[" + m + "] invalid,"); } }); } function checkRenderKeyClasses(regRenderKeyClasses) { if (!Array.isArray(regRenderKeyClasses) && regRenderKeyClasses !== '*') { throw new Error("renderKeyClasses type err, it " + STR_ARR_OR_STAR); } } var keyWord = '.checkModuleNameAndState'; function getDupLocation(errStack) { if (!errStack) errStack = ''; /** stack may like this: at CodeSandbox Error: module name duplicate! --verbose-info: module[SetupDemo] at makeError (https://xvcej.csb.app/node_modules/concent/src/support/util.js:128:15) at checkModuleName (https://xvcej.csb.app/node_modules/concent/src/core/param/checker.js:71:15) >> at Object.checkModuleNameAndState (https://xvcej.csb.app/node_modules/concent/src/core/param/checker.js:90:3) at _default (https://xvcej.csb.app/node_modules/concent/src/core/state/init-module-state.js:25:13) at _default (https://xvcej.csb.app/node_modules/concent/src/api/configure.js:96:35) >> at evaluate (https://xvcej.csb.app/src/pages/SetupDemo/model/index.js:13:24) at Jn (https://codesandbox.io/static/js/sandbox.fb6f2fde.js:1:146799) at e.value (https://codesandbox.io/static/js/sandbox.fb6f2fde.js:1:162063) at e.value (https://codesandbox.io/static/js/sandbox.fb6f2fde.js:1:202119) at t (https://codesandbox.io/static/js/sandbox.fb6f2fde.js:1:161805) ... or: at local web-dev-server Error: module name duplicate! --verbose-info: module[batchAddGroup] at makeError (http://localhost:3001/static/js/main.chunk.js:20593:17) at checkModuleName (http://localhost:3001/static/js/main.chunk.js:17256:15) >> at Module.checkModuleNameAndState (http://localhost:3001/static/js/main.chunk.js:17273:3) at http://localhost:3001/static/js/main.chunk.js:19804:106 at Object.configure (http://localhost:3001/static/js/main.chunk.js:13750:80) >> at Module../src/components/layer/BatchOpGroup/model/index.js (http://localhost:3001/static/js/main.chunk.js:8374:55) at __webpack_require__ (http://localhost:3001/static/js/bundle.js:782:30) at fn (http://localhost:3001/static/js/bundle.js:150:20) */ var arr = errStack.split('\n'); var len = arr.length; var locationStr = ''; for (var i = 0; i < len; i++) { var strPiece = arr[i]; if (strPiece.includes(keyWord)) { var _ret = function () { var callConfigureIdx = i + 3; // 向下3句就是调用处 // 这句话是具体调用configure的地方 // at Module../src/components/layer/BatchOpGroup/model/index.js (http://localhost:3001/static/js/main.chunk.js:8374:55) var targetStrPiece = arr[callConfigureIdx]; var arr2 = targetStrPiece.split(':'); var lastIdx = arr2.length - 1; var locationStrArr = []; arr2.forEach(function (str, idx) { if (idx !== lastIdx) locationStrArr.push(str); }); // at Module../src/components/layer/BatchOpGroup/model/index.js (http://localhost:3001/static/js/main.chunk.js:8374 locationStr = locationStrArr.join(':'); return "break"; }(); break; } } return locationStr; } var module2dupLocation = {}; var guessDuplicate = (function (err, module, tag) { if (err.code === ERR.CC_MODULE_NAME_DUPLICATE && ccContext.isHotReloadMode()) { var dupLocation = getDupLocation(err.stack); var key = tag + "|--link--|" + module; var prevLocation = module2dupLocation[key]; if (!prevLocation) { // 没有记录过 module2dupLocation[key] = dupLocation; } else if (dupLocation !== prevLocation) { throw err; } } else { throw err; } }); var key2findResult = {}; function createModuleNode(moduleName) { key2findResult[moduleName] = {}; } function getCacheKey(moduleName, sharedStateKeys, renderKeys, renderKeyClasses) { if (renderKeyClasses === void 0) { renderKeyClasses = []; } var renderKeyStr = renderKeys ? renderKeys.join(',') : ''; var featureStr1 = sharedStateKeys.sort().join(','); var featureStr2 = renderKeyClasses === '*' ? '*' : renderKeyClasses.sort().join(','); return moduleName + "/" + featureStr1 + "/" + renderKeyStr + "/" + featureStr2; } function getCache(moduleName, key) { return key2findResult[moduleName][key]; } function setCache(moduleName, key, result) { key2findResult[moduleName][key] = result; } var safeAssignToMap$1 = safeAssignToMap, okeys$3 = okeys, safeGet$1 = safeGet; function initModuleState (module, mState, moduleMustNotExisted, innerParams) { if (moduleMustNotExisted === void 0) { moduleMustNotExisted = true; } // force MODULE_VOID state as {} var state = module === MODULE_VOID ? {} : mState; try { checkModuleNameAndState(module, state, moduleMustNotExisted, innerParams); } catch (err) { guessDuplicate(err, module, 'state'); } createModuleNode(module); var ccStore = ccContext.store; var rootState = ccStore.getState(); var rootStateVer = ccStore.getStateVer(); var rootModuleVer = ccStore.getModuleVer(); var prevRootState = ccStore.getPrevState(); safeAssignToMap$1(rootState, module, state); safeAssignToMap$1(prevRootState, module, state); rootStateVer[module] = okeys$3(state).reduce(function (map, key) { map[key] = 1; return map; }, {}); rootModuleVer[module] = 1; // 把_computedValueOri safeGet从init-module-computed调整到此处 // 防止用户不定义任何computed,而只是定义watch时报错undefined var cu = ccContext.computed; safeGet$1(cu._computedDep, module, makeCuDepDesc()); safeGet$1(cu._computedValues, module); safeGet$1(cu._computedRawValues, module); var stateKeys = okeys$3(state); ccContext.moduleName2stateKeys[module] = stateKeys; if (module === MODULE_GLOBAL) { var globalStateKeys = ccContext.globalStateKeys; stateKeys.forEach(function (key) { if (!globalStateKeys.includes(key)) globalStateKeys.push(key); }); } ccContext.module2insCount[module] = 0; } /** @typedef {import('../../types').ICtxBase} ICtxBase */ var ignoreIt = "if this message doesn't matter, you can ignore it"; /**** * 尽可能优先找module的实例,找不到的话在根据mustBelongToModule值来决定要不要找其他模块的实例 * pick one ccInstance ref randomly */ function pickOneRef (module, mustBelongToModule) { if (mustBelongToModule === void 0) { mustBelongToModule = false; } var ccUKey2ref = ccContext.ccUKey2ref; var oneRef = null; if (module) { checkModuleName(module, false); var ukeys = okeys(ccUKey2ref); var len = ukeys.length; for (var i = 0; i < len; i++) { /** @type {{ctx:ICtxBase}} */ var ref = ccUKey2ref[ukeys[i]]; if (ref.ctx.module === module) { oneRef = ref; break; } } } if (!oneRef) { if (mustBelongToModule) { throw new Error("[[pickOneRef]]: no ref found for module[" + module + "]!," + ignoreIt); } else { oneRef = ccContext.permanentDispatcher; } } return oneRef; } var makeUniqueCcKey$1 = makeUniqueCcKey, justWarning$1 = justWarning; var resolve = function resolve() { return Promise.resolve(); }; function ccDispatch (action, payLoadWhenActionIsString, rkOrOptions, delay$$1, options) { if (rkOrOptions === void 0) { rkOrOptions = ''; } if (options === void 0) { options = {}; } var _options = options, ccClassKey = _options.ccClassKey, ccKey = _options.ccKey, _options$throwError = _options.throwError, throwError = _options$throwError === void 0 ? true : _options$throwError, _options$refModule = _options.refModule, refModule = _options$refModule === void 0 ? '' : _options$refModule; if (action === undefined && payLoadWhenActionIsString === undefined) { throw new Error("params type error"); } var dispatchFn, module = '', fnName = ''; try { if (ccClassKey && ccKey) { var uKey = makeUniqueCcKey$1(ccClassKey, ccKey); var targetRef = ccContext.refs[uKey]; if (!targetRef) { justWarning$1("no ref found for ccUniqueKey:" + uKey + "!"); return resolve(); } else { dispatchFn = targetRef.ctx.dispatch; } } else { if (typeof action == 'string') { if (action.includes('/')) { var _action$split = action.split('/'), m = _action$split[0], name = _action$split[1]; module = m; fnName = name; } else { fnName = action; } } var ref; if (module && module !== '*') { try { ref = pickOneRef(module); } catch (err) {// do nothing } } else if (refModule) { ref = pickOneRef(refModule); } if (!ref) { ref = pickOneRef(); } dispatchFn = ref.ctx.dispatch; } if (module === '*') { var fullFnNames = ccContext.reducer._fnName2fullFnNames[fnName]; if (!fullFnNames) return; var tasks = []; fullFnNames.forEach(function (fullFnName) { tasks.push(dispatchFn(fullFnName, payLoadWhenActionIsString, rkOrOptions, delay$$1)); }); return Promise.all(tasks); } else { return dispatchFn(action, payLoadWhenActionIsString, rkOrOptions, delay$$1); } } catch (err) { if (throwError) throw err;else { justWarning$1(err.message); return resolve(); } } } function dispatch (action, maybePayload, rkOrOptions, delay, extra) { return ccDispatch(action, maybePayload, rkOrOptions, delay, extra); } function initModuleReducer (module, reducer, ghosts) { if (reducer === void 0) { reducer = {}; } if (ghosts === void 0) { ghosts = []; } if (!isPJO(reducer)) { throw new Error("module[" + module + "] reducer " + INAJ); } var _ccContext$reducer = ccContext.reducer, _reducer = _ccContext$reducer._reducer, _caller = _ccContext$reducer._caller, _fnName2fullFnNames = _ccContext$reducer._fnName2fullFnNames, _module2fnNames = _ccContext$reducer._module2fnNames, _module2Ghosts = _ccContext$reducer._module2Ghosts; // 防止同一个reducer被载入到不同模块时,setState附加逻辑不正确 var newReducer = Object.assign({}, reducer); _reducer[module] = newReducer; var subReducerCaller = safeGet(_caller, module); // const subReducerRefCaller = util.safeGet(_reducerRefCaller, module); var fnNames = safeGetArray(_module2fnNames, module); safeGet(_module2Ghosts, module, ghosts.slice()); ghosts.forEach(function (ghostFnName) { if (!reducer[ghostFnName]) throw new Error("ghost[" + ghostFnName + "] not exist"); }); // 自动附加一个setState在reducer里 if (!newReducer.setState) newReducer.setState = function (payload) { return payload; }; var reducerFnNames = okeys(newReducer); reducerFnNames.forEach(function (name) { // avoid hot reload noDupPush(fnNames, name); var fullFnName = module + "/" + name; var list = safeGetArray(_fnName2fullFnNames, name); // avoid hot reload noDupPush(list, fullFnName); subReducerCaller[name] = function (payload, renderKeyOrOptions, delay$$1) { return dispatch(fullFnName, payload, renderKeyOrOptions, delay$$1); }; var reducerFn = newReducer[name]; if (!isFn(reducerFn)) { throw new Error("module[" + module + "] reducer[" + name + "] " + INAF); } else { var targetFn = reducerFn; if (reducerFn.__fnName) { // 将某个已载入到模块a的reducer再次载入到模块b targetFn = function targetFn(payload, moduleState, actionCtx) { return reducerFn(payload, moduleState, actionCtx); }; newReducer[name] = targetFn; } targetFn.__fnName = name; // !!! 很重要,将真正的名字附记录上,否则名字是编译后的缩写名 // 给函数绑上模块名,方便dispatch可以直接调用函数时,也能知道是更新哪个模块的数据, targetFn.__stateModule = module; // AsyncFunction GeneratorFunction Function targetFn.__ctName = reducerFn.__ctName || reducerFn.constructor.name; targetFn.__isAsync = isAsyncFn(reducerFn); } }); } /** eslint-disable */ var _currentIndex = 0; var letters = ['a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z']; function genNonceStr(length) { if (length === void 0) { length = 6; } var ret = ''; for (var i = 0; i < length; i++) { ret += letters[randomNumber()]; } return ret; } function uuid (tag) { _currentIndex++; var nonceStr = tag || genNonceStr(); return nonceStr + "_" + _currentIndex; } /** @typedef {import('../../types-inner').IRefCtx} Ctx */ var moduleName2stateKeys$1 = ccContext.moduleName2stateKeys, runtimeVar = ccContext.runtimeVar, runtimeHandler = ccContext.runtimeHandler, store$1 = ccContext.store; var sortFactor = 1; /** computed('foo/firstName', ()=>{}); //or computed('firstName', ()=>{}, ['foo/firstName']); computed('foo/firstName', { fn: ()=>{}, compare: false, depKeys: ['firstName'], }); computed({ 'foo/firstName':()=>{}, 'foo/fullName':{ fn:()=>{}, depKeys:['firstName', 'lastName'] } }); // or computed({ 'foo/firstName':()=>{}, 'fullName':{ fn:()=>{}, depKeys:['foo/firstName', 'foo/lastName'] } }); computed(ctx=>{ return cuDesc} */ // cate: module | ref function configureDepFns (cate, confMeta, item, handler, depKeysOrOpt) { /** @type Ctx */ var ctx = confMeta.refCtx; var type = confMeta.type; if (cate === CATE_REF && !ctx.__$$inBM) { var tip = cate + " " + type + " must been called in setup block"; runtimeHandler.tryHandleWarning(new Error(tip)); return; } if (!item) return; var itype = typeof item; var _descObj; if (itype === 'string') { var _descObj2, _descObj3; // retKey if (isPJO(handler)) _descObj = (_descObj2 = {}, _descObj2[item] = handler, _descObj2);else if (typeof handler === FN) _descObj = (_descObj3 = {}, _descObj3[item] = makeFnDesc(handler, depKeysOrOpt), _descObj3); } else if (isPJO(item)) { _descObj = item; } else if (itype === FN) { _descObj = item(ctx); if (!isPJO(_descObj)) { runtimeHandler.tryHandleWarning(new Error("type of " + type + " callback result must be an object")); return; } } if (!_descObj) { runtimeHandler.tryHandleWarning(new Error(cate + " " + type + " param type error")); return; } _parseDescObj(cate, confMeta, _descObj); } function _parseDescObj(cate, confMeta, descObj) { var computedCompare = runtimeVar.computedCompare, watchCompare = runtimeVar.watchCompare, watchImmediate = runtimeVar.watchImmediate; var tryHandleWarning = runtimeHandler.tryHandleWarning; // 读全局的默认值 var defaultCompare = confMeta.type === FN_CU ? computedCompare : watchCompare; var callerModule = confMeta.module; okeys(descObj).forEach(function (retKey) { var val = descObj[retKey]; var targetItem = val; if (isFn(val)) { targetItem = { fn: val }; } // 有可能是空模块,如未写任何内容的computed.js文件,babel编译后为 { default: {} } // 所以此处需进一步判断 targetItem.fn if (isPJO(targetItem) && isFn(targetItem.fn)) { var _targetItem = targetItem, fn = _targetItem.fn, _targetItem$immediate = _targetItem.immediate, immediate = _targetItem$immediate === void 0 ? watchImmediate : _targetItem$immediate, _targetItem$compare = _targetItem.compare, compare = _targetItem$compare === void 0 ? defaultCompare : _targetItem$compare, lazy = _targetItem.lazy, _targetItem$retKeyDep = _targetItem.retKeyDep, retKeyDep = _targetItem$retKeyDep === void 0 ? true : _targetItem$retKeyDep, allowSlash = _targetItem.allowSlash, depKeyModule = _targetItem.depKeyModule; // 确保用户显示的传递null、undefined、0、都置为依赖收集状态 var depKeys = targetItem.depKeys || '-'; // 作为动态的依赖收集函数,作用于watch函数 if (isFn(depKeys)) { // ctx.watchModule 在内部会显式的传递depKeyModule // 而ctx.watch 是不传递 depKeyModule的,所以此处这样写 var targetDepModule = depKeyModule || callerModule; var moduleState = store$1.getState(targetDepModule); var collectedDepKeys = []; depKeys(makeCuObState(moduleState, collectedDepKeys)); depKeys = collectedDepKeys.map(function (key) { return targetDepModule + "/" + key; }); } // if user don't pass sort explicitly, computed fn will been called orderly by sortFactor var sort = targetItem.sort || sortFactor++; var fnUid = uuid('mark'); if (depKeys === '*' || depKeys === '-') { // 处于依赖收集,且用户没有显式的通过设置retKeyDep为false来关闭同名依赖规则时,会自动设置同名依赖 var mapSameName = depKeys === '-' && retKeyDep; var _resolveKey2 = _resolveKey(confMeta, callerModule, retKey, mapSameName, allowSlash), pureKey = _resolveKey2.pureKey, module = _resolveKey2.module; var err = _checkRetKeyDup(cate, confMeta, fnUid, pureKey); if (err) return tryHandleWarning(err); // when retKey is '/xxxx', here need pass xxxx as retKey _mapDepDesc(cate, confMeta, module, pureKey, fn, depKeys, immediate, compare, lazy, sort); } else { if (depKeys.length === 0) { var _resolveKey3 = _resolveKey(confMeta, callerModule, retKey, false, allowSlash), _pureKey = _resolveKey3.pureKey, _module2 = _resolveKey3.module; // consume retKey is stateKey var _err = _checkRetKeyDup(cate, confMeta, fnUid, _pureKey); if (_err) return tryHandleWarning(_err); _mapDepDesc(cate, confMeta, _module2, _pureKey, fn, depKeys, immediate, compare, lazy, sort); } else { // ['foo/b1', 'bar/b1'] or ['b1', 'b2'] var _resolveKey4 = _resolveKey(confMeta, callerModule, retKey, false, allowSlash), _pureKey2 = _resolveKey4.pureKey, moduleOfKey = _resolveKey4.moduleOfKey; var stateKeyModule = moduleOfKey; var _err2 = _checkRetKeyDup(cate, confMeta, fnUid, _pureKey2); if (_err2) return tryHandleWarning(_err2); // 给depKeys按module分类,此时它们都指向同一个retKey,同一个fn,但是会被分配ctx.computedDep或者watchDep的不同映射里 var module2depKeys = {}; // ['foo/b1', 'bar/b1'] depKeys.forEach(function (depKey) { // !!!这里只是单纯的解析depKey,不需要有映射同名依赖的行为,映射同名依赖仅发生在传入retKey的时候 // consume depKey is stateKey var _resolveKey5 = _resolveKey(confMeta, callerModule, depKey, false, allowSlash), isStateKey = _resolveKey5.isStateKey, pureKey = _resolveKey5.pureKey, module = _resolveKey5.module; // ok: retKey: 'xxxx' depKeys:['foo/f1', 'foo/f2', 'bar/b1', 'bar/b2'], // some stateKey belong to foo, some belong to bar // ok: retKey: 'foo/xxxx' depKeys:['f1', 'f2'], all stateKey belong to foo // ok: retKey: 'foo/xxxx' depKeys:['foo/f1', 'foo/f2'], all stateKey belong to foo // both left and right include module but they are not equal, this situation is not ok! // not ok: retKey: 'foo/xxxx' depKeys:['foo/f1', 'foo/f2', 'bar/b1', 'bar/b2'] if (stateKeyModule && module !== stateKeyModule) { throw new Error("found slash both in retKey[" + retKey + "] and depKey[" + depKey + "], but their module is different"); } var depKeys = safeGetArray(module2depKeys, module); if (!isStateKey) { throw new Error("depKey[" + depKey + "] invalid, module[" + module + "] doesn't include its stateKey[" + pureKey + "]"); } else { // 当一个实例里 ctx.computed ctx.watch 的depKeys里显示的标记了依赖时 // 在这里需要立即记录依赖了 _mapIns$1(confMeta, module, pureKey); } depKeys.push(pureKey); }); okeys(module2depKeys).forEach(function (m) { // 指向同一个fn,允许重复 _mapDepDesc(cate, confMeta, m, _pureKey2, fn, module2depKeys[m], immediate, compare, lazy, sort); }); } } } else if (retKey !== 'default') { // default 是空模块导出导致的,这里就不打印了 tryHandleWarning("module[" + callerModule + "] " + confMeta.type + " retKey[" + retKey + "] type error"); } }); } // just return an error if key dup function _checkRetKeyDup(cate, confMeta, fnUid, retKey) { if (cate === CATE_REF) { var _confMeta$refCtx = confMeta.refCtx, ccUniqueKey = _confMeta$refCtx.ccUniqueKey, retKey2fnUid = _confMeta$refCtx.retKey2fnUid; var type = confMeta.type; var typedRetKey = type + "_" + retKey; var mappedFn = retKey2fnUid[typedRetKey]; if (mappedFn) { return new Error("ccUKey[" + ccUniqueKey + "] retKey[" + retKey + "] duplicate in ref " + type); } retKey2fnUid[typedRetKey] = fnUid; } } // !!!由实例调用computed或者watch,监听同名的retKey,更新stateKey与retKey的关系映射 function _mapSameNameRetKey(confMeta, module, retKey, isModuleStateKey) { var dep = confMeta.dep; var moduleDepDesc = safeGet(dep, module, makeCuDepDesc()); var stateKey2retKeys = moduleDepDesc.stateKey2retKeys, retKey2stateKeys = moduleDepDesc.retKey2stateKeys; safeGetThenNoDupPush(stateKey2retKeys, retKey, retKey); safeGetThenNoDupPush(retKey2stateKeys, retKey, retKey); // 记录依赖 isModuleStateKey && _mapIns$1(confMeta, module, retKey); } function _mapIns$1(confMeta, module, retKey) { var ctx = confMeta.refCtx; if (ctx) { ctx.__$$staticWaKeys[makeWaKey(module, retKey)] = 1; } } // 映射依赖描述对象, module即是取的dep里的key function _mapDepDesc(cate, confMeta, module, retKey, fn, depKeys, immediate, compare, lazy, sort) { var dep = confMeta.dep; var moduleDepDesc = safeGet(dep, module, makeCuDepDesc()); var retKey2fn = moduleDepDesc.retKey2fn, stateKey2retKeys = moduleDepDesc.stateKey2retKeys, retKey2lazy = moduleDepDesc.retKey2lazy, retKey2stateKeys = moduleDepDesc.retKey2stateKeys; var isStatic = Array.isArray(depKeys) && depKeys.length === 0; // 确保static computed优先优先执行 var targetSort = sort; if (isStatic) { if (targetSort >= 0) targetSort = -1; } else { if (sort < 0) targetSort = 0; } var fnDesc = { fn: fn, immediate: immediate, compare: compare, depKeys: depKeys, sort: targetSort, isStatic: isStatic }; // retKey作为将计算结果映射到refComputed | moduleComputed 里的key if (retKey2fn[retKey]) { if (cate !== CATE_REF) { // 因为热加载,对于module computed 定义总是赋值最新的, retKey2fn[retKey] = fnDesc; retKey2lazy[retKey] = lazy; } // do nothing } else { retKey2fn[retKey] = fnDesc; retKey2lazy[retKey] = lazy; moduleDepDesc.fnCount++; } if (cate === CATE_REF) { confMeta.retKeyFns[retKey] = retKey2fn[retKey]; } var refCtx = confMeta.refCtx; if (refCtx) { if (confMeta.type === 'computed') refCtx.hasComputedFn = true;else refCtx.hasWatchFn = true; } //处于自动收集依赖状态,首次遍历完计算函数后之后再去写stateKey_retKeys_, retKey2stateKeys // in find-dep-fns-to-execute.js setStateKeyRetKeysMap if (depKeys === '-') return; var allKeyDep = depKeys === '*'; var targetDepKeys = allKeyDep ? ['*'] : depKeys; if (allKeyDep) { retKey2stateKeys[retKey] = moduleName2stateKeys$1[module]; } targetDepKeys.forEach(function (sKey) { if (!allKeyDep) safeGetThenNoDupPush(retKey2stateKeys, retKey, sKey); //一个依赖key列表里的stateKey会对应着多个结果key safeGetThenNoDupPush(stateKey2retKeys, sKey, retKey); }); } // 分析retKey或者depKey是不是stateKey, // 返回的是净化后的key function _resolveKey(confMeta, module, retKey, mapSameName, allowSlash) { if (mapSameName === void 0) { mapSameName = false; } var targetModule = module, targetRetKey = retKey, moduleOfKey = ''; if (retKey.includes('/')) { if (allowSlash !== true) { throw new Error("key[" + retKey + "] can't contains /, please use (computedModule,watchModule) instead of (computed, watch) if you want to operate another module"); } var _retKey$split = retKey.split('/'), _module = _retKey$split[0], _stateKey = _retKey$split[1]; if (_module) { moduleOfKey = _module; targetModule = _module; // '/name' 支持这种申明方式 } targetRetKey = _stateKey; } var stateKeys; var moduleStateKeys = moduleName2stateKeys$1[targetModule]; if (targetModule === confMeta.module) { // 此时computed & watch观察的是对象的所有stateKeys stateKeys = confMeta.stateKeys; } else { // 对于属于bar的ref 配置key 'foo/a'时,会走入到此块 stateKeys = moduleStateKeys; if (!stateKeys) { throw makeError(ERR.CC_MODULE_NOT_FOUND, verboseInfo("module[" + targetModule + "]")); } if (!confMeta.connect[targetModule]) { throw makeError(ERR.CC_MODULE_NOT_CONNECTED, verboseInfo("module[" + targetModule + "], retKey[" + targetRetKey + "]")); } } var isStateKey = stateKeys.includes(targetRetKey); if (mapSameName && isStateKey) { _mapSameNameRetKey(confMeta, targetModule, targetRetKey, moduleStateKeys.includes(targetRetKey)); } return { isStateKey: isStateKey, pureKey: targetRetKey, module: targetModule, moduleOfKey: moduleOfKey }; } /** * 提供给用户使用,从存储的打包计算对象里获取目标计算结果的容器 * ------------------------------------------------------------------------------------ * 触发get时,会从打包对象里获取目标计算结果, * 打包对象按 ${retKey} 放置在originalCuContainer里, * 对于refComputed,rawComputedValues 是 ctx.refComputedRawValues * 对于moduleComputed,rawComputedValues 是 concentContext.ccComputed._computedRawValues.{$module} */ function makeCuRetContainer (computed, rawComputedValues) { // prepare for refComputed or moduleComputed var computedValues = {}; okeys(computed).forEach(function (key) { // 用这个对象来存其他信息, 避免get无限递归, rawComputedValues[key] = makeCuPackedValue(); Object.defineProperty(computedValues, key, { get: function get() { // 防止用户传入未定义的key var value = rawComputedValues[key] || {}; var needCompute = value.needCompute, fn = value.fn, newState = value.newState, oldState = value.oldState, fnCtx = value.fnCtx, isLazy = value.isLazy, result = value.result; if (!isLazy) { return result; } if (isLazy && needCompute) { var ret = fn(newState, oldState, fnCtx); value.result = ret; value.needCompute = false; } return value.result; }, set: function set(input) { var value = rawComputedValues[key]; if (!input[CU_KEY]) { justWarning("computed value can not been changed manually"); return; } if (input.isLazy) { value.isLazy = true; value.needCompute = true; value.newState = input.newState; value.oldState = input.oldState; value.fn = input.fn; value.fnCtx = input.fnCtx; } else { value.isLazy = false; value.result = input.result; } } }); }); return computedValues; } var isPJO$1 = isPJO; function initModuleComputed (module, computed) { if (computed === void 0) { computed = {}; } if (!isPJO$1(computed)) { throw new Error("module[" + module + "] computed " + INAJ); } var ccComputed = ccContext.computed; var rootState = ccContext.store.getState(); var rootComputedValue = ccComputed.getRootComputedValue(); var rootComputedDep = ccComputed.getRootComputedDep(); var rootComputedRaw = ccComputed.getRootComputedRaw(); // 在init-module-state那里已safeGet, 这里可以安全的直接读取 var cuOri = ccComputed._computedRawValues[module]; rootComputedRaw[module] = computed; var moduleState = rootState[module]; configureDepFns(CATE_MODULE, { type: FN_CU, module: module, stateKeys: okeys(moduleState), dep: rootComputedDep }, computed); var d = ccContext.getDispatcher(); var curDepComputedFns = function curDepComputedFns(committedState, isBeforeMount) { return pickDepFns(isBeforeMount, CATE_MODULE, FN_CU, rootComputedDep, module, moduleState, committedState); }; rootComputedValue[module] = makeCuRetContainer(computed, cuOri); var moduleComputedValue = rootComputedValue[module]; try { executeDepFns(d, module, d && d.ctx.module, moduleState, curDepComputedFns, moduleState, moduleState, moduleState, makeCallInfo(module), true, FN_CU, CATE_MODULE, moduleComputedValue); } catch (err) { ccContext.runtimeHandler.tryHandleError(err); } } var isPJO$2 = isPJO, safeGet$2 = safeGet, okeys$4 = okeys; /** * 设置watch值,过滤掉一些无效的key */ function initModuleWatch (module, moduleWatch, append) { if (moduleWatch === void 0) { moduleWatch = {}; } if (append === void 0) { append = false; } if (!isPJO$2(moduleWatch)) { throw new Error("module[" + module + "] watch " + INAJ); } var rootWatchDep = ccContext.watch.getRootWatchDep(); var rootWatchRaw = ccContext.watch.getRootWatchRaw(); var rootComputedValue = ccContext.computed.getRootComputedValue(); if (append) { var ori = rootWatchRaw[module]; if (ori) Object.assign(ori, moduleWatch);else rootWatchRaw[module] = moduleWatch; } else { rootWatchRaw[module] = moduleWatch; } var getState = ccContext.store.getState; var moduleState = getState(module); configureDepFns(CATE_MODULE, { module: module, stateKeys: okeys$4(moduleState), dep: rootWatchDep }, moduleWatch); var d = ccContext.getDispatcher(); var curDepWatchFns = function curDepWatchFns(committedState, isFirstCall) { return pickDepFns(isFirstCall, CATE_MODULE, FN_WATCH, rootWatchDep, module, moduleState, committedState); }; var moduleComputedValue = safeGet$2(rootComputedValue, module); executeDepFns(d, module, d && d.ctx.module, moduleState, curDepWatchFns, moduleState, moduleState, moduleState, makeCallInfo(module), true, FN_WATCH, CATE_MODULE, moduleComputedValue); } /* eslint-disable camelcase */ var id = 0; /** 针对lazy的reducer调用链状态记录缓存map */ var chainId2moduleStateMap = {}; var chainId2isExited = {}; var chainId2isLazy = {}; /** 所有的reducer调用链状态记录缓存map */ var normalChainId_moduleStateMap_ = {}; function getChainId() { id++; return id; } function __setChainState(chainId, targetModule, partialState, targetId_msMap) { if (partialState) { var moduleStateMap = targetId_msMap[chainId]; if (!moduleStateMap) { moduleStateMap = {}; targetId_msMap[chainId] = moduleStateMap; } var state = moduleStateMap[targetModule]; if (!state) { moduleStateMap[targetModule] = partialState; } else { Object.assign(state, partialState); } } } function setChainState(chainId, targetModule, partialState) { __setChainState(chainId, targetModule, partialState, chainId2moduleStateMap); } function setAllChainState(chainId, targetModule, partialState) { __setChainState(chainId, targetModule, partialState, normalChainId_moduleStateMap_); } function setAndGetChainStateList(isC2Result, chainId, targetModule, partialState) { if (!isC2Result) setChainState(chainId, targetModule, partialState); return getChainStateList(chainId); } function getChainStateMap(chainId) { return chainId2moduleStateMap[chainId]; } function getAllChainStateMap(chainId) { return normalChainId_moduleStateMap_[chainId]; } function getChainStateList(chainId) { var moduleStateMap = getChainStateMap(chainId); return okeys(moduleStateMap).map(function (m) { return { module: m, state: moduleStateMap[m] }; }); } function removeChainState(chainId) { delete chainId2moduleStateMap[chainId]; } function removeAllChainState(chainId) { delete normalChainId_moduleStateMap_[chainId]; } function isChainExited(chainId) { return chainId2isExited[chainId] === true; } function setChainIdLazy(chainId) { chainId2isLazy[chainId] = true; } function isChainIdLazy(chainId) { return chainId2isLazy[chainId] === true; } var feature2timerId = {}; var runLater = (function (cb, feature, delay) { if (delay === void 0) { delay = 1000; } var timerId = feature2timerId[feature]; if (timerId) clearTimeout(timerId); feature2timerId[feature] = setTimeout(function () { delete feature2timerId[feature]; cb(); }, delay); }); function watchKeyForRef (ref, stateModule, oldState, deltaCommittedState, callInfo, isBeforeMount, mergeToDelta) { if (isBeforeMount === void 0) { isBeforeMount = false; } var refCtx = ref.ctx; if (!refCtx.hasWatchFn) return { hasDelta: false, newCommittedState: {} }; var newState = Object.assign({}, oldState, deltaCommittedState); var watchDep = refCtx.watchDep, refModule = refCtx.module, ccUniqueKey = refCtx.ccUniqueKey, computedContainer = refCtx.refComputed; var curDepWatchFns = function curDepWatchFns(committedState, isBeforeMount) { return pickDepFns(isBeforeMount, CATE_REF, FN_WATCH, watchDep, stateModule, oldState, committedState, ccUniqueKey); }; // 触发有stateKey依赖列表相关的watch函数 var _findDepFnsToExecute = executeDepFns(ref, stateModule, refModule, oldState, curDepWatchFns, deltaCommittedState, newState, deltaCommittedState, callInfo, isBeforeMount, FN_WATCH, CATE_REF, computedContainer, mergeToDelta), hasDelta = _findDepFnsToExecute.hasDelta; return { hasDelta: hasDelta }; } function computeValueForRef (ref, stateModule, oldState, deltaCommittedState, callInfo, isBeforeMount, mergeToDelta) { if (isBeforeMount === void 0) { isBeforeMount = false; } var refCtx = ref.ctx; if (!refCtx.hasComputedFn) return { hasDelta: false, newCommittedState: {} }; var computedDep = refCtx.computedDep, refModule = refCtx.module, ccUniqueKey = refCtx.ccUniqueKey, computedContainer = refCtx.refComputed; var newState = Object.assign({}, oldState, deltaCommittedState); var curDepComputedFns = function curDepComputedFns(committedState, isBeforeMount) { return pickDepFns(isBeforeMount, CATE_REF, FN_CU, computedDep, stateModule, oldState, committedState, ccUniqueKey); }; // 触发依赖stateKeys相关的computed函数 return executeDepFns(ref, stateModule, refModule, oldState, curDepComputedFns, deltaCommittedState, newState, deltaCommittedState, callInfo, isBeforeMount, FN_CU, CATE_REF, computedContainer, mergeToDelta); } var okeys$5 = okeys, isEmptyVal$1 = isEmptyVal; var ccUKey2ref = ccContext.ccUKey2ref, waKey2uKeyMap$2 = ccContext.waKey2uKeyMap, waKey2staticUKeyMap$2 = ccContext.waKey2staticUKeyMap; function findUpdateRefs (moduleName, partialSharedState, renderKeys, renderKeyClasses) { var sharedStateKeys = okeys$5(partialSharedState); var cacheKey = getCacheKey(moduleName, sharedStateKeys, renderKeys, renderKeyClasses); var cachedResult = getCache(moduleName, cacheKey); if (cachedResult) { return { sharedStateKeys: sharedStateKeys, result: cachedResult }; } var targetUKeyMap = {}; var belongRefKeys = []; var connectRefKeys = []; sharedStateKeys.forEach(function (stateKey) { var waKey = moduleName + "/" + stateKey; // 利用assign不停的去重 Object.assign(targetUKeyMap, waKey2uKeyMap$2[waKey], waKey2staticUKeyMap$2[waKey]); }); var uKeys = okeys$5(targetUKeyMap); var putRef = function putRef(isBelong, ccUniqueKey) { isBelong ? belongRefKeys.push(ccUniqueKey) : connectRefKeys.push(ccUniqueKey); }; var tryMatch = function tryMatch(ref, toBelong) { var _ref$ctx = ref.ctx, refRenderKey = _ref$ctx.renderKey, refCcClassKey = _ref$ctx.ccClassKey, ccUniqueKey = _ref$ctx.ccUniqueKey, props = _ref$ctx.props; // 如果调用方携带renderKey发起修改状态动作,则需要匹配renderKey做更新 if (renderKeys.length) { var isRenderKeyMatched = renderKeys.includes(refRenderKey); // 所有的类实例都受renderKey匹配机制影响 // or 携带id生成了renderKey if (renderKeyClasses === '*' || !isEmptyVal$1(props.id)) { if (isRenderKeyMatched) { putRef(toBelong, ccUniqueKey); } return; } // 这些指定类实例受renderKey机制影响 if (renderKeyClasses.includes(refCcClassKey)) { if (isRenderKeyMatched) { putRef(toBelong, ccUniqueKey); } } else { // 这些实例则不受renderKey机制影响 putRef(toBelong, ccUniqueKey); } } else { putRef(toBelong, ccUniqueKey); } }; var missRef = false; uKeys.forEach(function (key) { var ref = ccUKey2ref[key]; if (!ref) { missRef = true; return; } var refCtx = ref.ctx; var refModule = refCtx.module, refConnect = refCtx.connect; var isBelong = refModule === moduleName; var isConnect = refConnect[moduleName] ? true : false; if (isBelong) { tryMatch(ref, true); } // 一个实例如果既属于模块x同时也连接了模块x,这是不推荐的,在buildCtx里面已给出警告 // 会造成冗余的渲染 if (isConnect) { tryMatch(ref, false); } }); var result = { belong: belongRefKeys, connect: connectRefKeys }; // 没有miss的ref才存缓存,防止直接标记了watchedKeys的实例此时还没有记录ref, // 但是此时刚好有变更状态的命令的话,如果这里缓存了查询结果,这这个实例挂上后,没有机会响应状态变更了 if (!missRef) { setCache(moduleName, cacheKey, result); } return { sharedStateKeys: sharedStateKeys, result: result }; } /* eslint-disable camelcase */ var isPJO$3 = isPJO, justWarning$2 = justWarning, isObjectNull$1 = isObjectNull, computeFeature$1 = computeFeature, okeys$6 = okeys; var FOR_CUR_MOD$1 = FOR_CUR_MOD, FOR_ANOTHER_MOD$1 = FOR_ANOTHER_MOD, FORCE_UPDATE$1 = FORCE_UPDATE, SET_STATE$1 = SET_STATE, SIG_STATE_CHANGED$1 = SIG_STATE_CHANGED, RENDER_NO_OP$1 = RENDER_NO_OP, RENDER_BY_KEY$1 = RENDER_BY_KEY, RENDER_BY_STATE$1 = RENDER_BY_STATE, UNMOUNTED$1 = UNMOUNTED, MOUNTED$1 = MOUNTED; var _ccContext$store = ccContext.store, storeSetState = _ccContext$store.setState, getPrevState = _ccContext$store.getPrevState, saveSharedState$1 = _ccContext$store.saveSharedState, middlewares = ccContext.middlewares, ccClassKey2Context = ccContext.ccClassKey2Context, refStore = ccContext.refStore, getModuleStateKeys$1 = ccContext.getModuleStateKeys, runtimeVar$1 = ccContext.runtimeVar; // 触发修改状态的实例所属模块和目标模块不一致的时候,stateFor是 FOR_ANOTHER_MOD function getStateFor(targetModule, refModule) { return targetModule === refModule ? FOR_CUR_MOD$1 : FOR_ANOTHER_MOD$1; } function callMiddlewares(skipMiddleware, passToMiddleware, cb) { if (skipMiddleware !== true) { var len = middlewares.length; if (len > 0) { var index = 0; var next = function next() { if (index === len) { // all middlewares been executed cb(); } else { var middlewareFn = middlewares[index]; index++; if (isFn(middlewareFn)) middlewareFn(passToMiddleware, next);else { justWarning$2("found one middleware " + INAF); next(); } } }; next(); } else { cb(); } } else { cb(); } } // 调用者优先取 alwaysRenderCaller,再去force参数 function getCallerForce(force) { return runtimeVar$1.alwaysRenderCaller || force; } /** * 修改状态入口函数 */ function changeRefState(state, _temp, targetRef) { var _ref = _temp === void 0 ? {} : _temp, module = _ref.module, _ref$skipMiddleware = _ref.skipMiddleware, skipMiddleware = _ref$skipMiddleware === void 0 ? false : _ref$skipMiddleware, payload = _ref.payload, stateChangedCb = _ref.stateChangedCb, _ref$force = _ref.force, force = _ref$force === void 0 ? false : _ref$force, _ref$keys = _ref.keys, keys = _ref$keys === void 0 ? [] : _ref$keys, _ref$keyPath = _ref.keyPath, keyPath = _ref$keyPath === void 0 ? '' : _ref$keyPath, reactCallback = _ref.reactCallback, type = _ref.type, _ref$calledBy = _ref.calledBy, calledBy = _ref$calledBy === void 0 ? SET_STATE$1 : _ref$calledBy, _ref$fnName = _ref.fnName, fnName = _ref$fnName === void 0 ? '' : _ref$fnName, renderKey = _ref.renderKey, _ref$delay = _ref.delay, delay$$1 = _ref$delay === void 0 ? -1 : _ref$delay; if (!state) return; if (!isPJO$3(state)) { justWarning$2("your committed state " + INAJ); return; } var targetRenderKey = extractRenderKey(renderKey); var targetDelay = renderKey && renderKey.delay ? renderKey.delay : delay$$1; var _targetRef$ctx = targetRef.ctx, refModule = _targetRef$ctx.module, ccUniqueKey = _targetRef$ctx.ccUniqueKey, ccKey = _targetRef$ctx.ccKey; var stateFor = getStateFor(module, refModule); var callInfo = { calledBy: calledBy, payload: payload, renderKey: targetRenderKey, force: force, ccKey: ccKey, module: module, fnName: fnName, keys: keys, keyPath: keyPath }; // 在triggerReactSetState之前把状态存储到store, // 防止属于同一个模块的父组件套子组件渲染时,父组件修改了state,子组件初次挂载是不能第一时间拿到state // const passedRef = stateFor === FOR_CUR_MOD ? targetRef : null; // 标记noSave为true,延迟到后面可能存在的中间件执行结束后才save var _syncCommittedStateTo = syncCommittedStateToStore(module, state, { ref: targetRef, callInfo: callInfo, noSave: true, force: force }), sharedState = _syncCommittedStateTo.partialState, hasDelta = _syncCommittedStateTo.hasDelta, hasPrivState = _syncCommittedStateTo.hasPrivState; if (hasDelta) { Object.assign(state, sharedState); } // 不包含私有状态,仅包含模块状态,交给belongRefs那里去触发渲染,这样可以让已失去依赖的当前实例减少一次渲染 // 因为belongRefs那里是根据有无依赖来确定要不要渲染,这样的话如果失去了依赖不把它查出来就不触发它渲染了 var ignoreRender = !hasPrivState && !!sharedState; // source ref will receive the whole committed state triggerReactSetState(targetRef, callInfo, targetRenderKey, calledBy, state, stateFor, ignoreRender, reactCallback, getCallerForce(force), function (renderType, committedState, updateRef) { // committedState means final committedState var passToMiddleware = { calledBy: calledBy, type: type, payload: payload, renderKey: targetRenderKey, delay: targetDelay, ccKey: ccKey, ccUniqueKey: ccUniqueKey, committedState: committedState, refModule: refModule, module: module, fnName: fnName, sharedState: sharedState || {} // 给一个空壳对象,防止用户直接用的时候报错null }; var modStateCalled = false; // 修改或新增状态值 // 修改并不会再次触发compute&watch过程,请明确你要修改的目的 passToMiddleware.modState = function (key, val) { modStateCalled = true; passToMiddleware.committedState[key] = val; passToMiddleware.sharedState[key] = val; }; callMiddlewares(skipMiddleware, passToMiddleware, function () { // 到这里才触发调用saveSharedState存储模块状态和updateRef更新调用实例,注这两者前后顺序不能调换 // 因为updateRef里的beforeRender需要把最新的模块状态合进来 // 允许在中间件过程中使用「modState」修改某些key的值,会影响到实例的更新结果,且不会再触发computed&watch // 调用此接口请明确知道后果, // 注不要直接修改sharedState或committedState,两个对象一起修改某个key才是正确的 var midSharedState = passToMiddleware.sharedState; var realShare = saveSharedState$1(module, midSharedState, modStateCalled, force); // TODO: 查看其它模块的cu函数里读取了当前模块的state或computed作为输入产生了的新的计算结果 // 然后做相应的关联更新 {'$$global/key1': {foo: ['cuKey1', 'cuKey2'] } } // code here // 执行完毕所有的中间件,才更新触发调用的源头实例 updateRef && updateRef(); if (renderType === RENDER_NO_OP$1 && !realShare) { if (ignoreRender) { // 此时updateRef 为 null, 需要给补上一次机会为caller执行 triggerReactSetState triggerReactSetState(targetRef, callInfo, [], SET_STATE$1, midSharedState, stateFor, false, reactCallback, getCallerForce(force)); } } else { send(SIG_STATE_CHANGED$1, { calledBy: calledBy, type: type, committedState: committedState, sharedState: realShare || {}, module: module, ccUniqueKey: ccUniqueKey, renderKey: targetRenderKey }); } // 无论是否真的有状态改变,此回调都会被触发 if (stateChangedCb) stateChangedCb(); // 当前上下文的ignoreRender 为true 等效于这里的入参 allowOriInsRender 为true,允许查询出oriIns后触发它渲染 if (realShare) triggerBroadcastState(stateFor, callInfo, targetRef, realShare, ignoreRender, module, reactCallback, targetRenderKey, targetDelay, force); }); }); } function triggerReactSetState(targetRef, callInfo, renderKeys, calledBy, state, stateFor, ignoreRender, reactCallback, force, next) { var nextNoop = function nextNoop() { return next && next(RENDER_NO_OP$1, state); }; var refCtx = targetRef.ctx; var refState = refCtx.unProxyState; if (ignoreRender) { return nextNoop(); } if (targetRef.__$$ms === UNMOUNTED$1 // 已卸载 || stateFor !== FOR_CUR_MOD$1 // 确保forceUpdate能够刷新cc实例,因为state可能是{},此时用户调用forceUpdate也要触发render || calledBy !== FORCE_UPDATE$1 && isObjectNull$1(state)) { return nextNoop(); } var stateModule = refCtx.module, storedKeys = refCtx.storedKeys, ccUniqueKey = refCtx.ccUniqueKey; var renderType = RENDER_BY_STATE$1; if (renderKeys.length) { // if user specify renderKeys renderType = RENDER_BY_KEY$1; if (renderKeys.includes(refCtx.renderKey)) { // current instance can been rendered only if ctx.renderKey included in renderKeys return nextNoop(); } } if (storedKeys.length > 0) { var _extractStateByKeys = extractStateByKeys(state, storedKeys), partialState = _extractStateByKeys.partialState, isStateEmpty = _extractStateByKeys.isStateEmpty; if (!isStateEmpty) { if (refCtx.persistStoredKeys === true) { var _extractStateByKeys2 = extractStateByKeys(refState, storedKeys), entireStoredState = _extractStateByKeys2.partialState; var currentStoredState = Object.assign({}, entireStoredState, partialState); if (ccContext.localStorage) { ccContext.localStorage.setItem("CCSS_" + ccUniqueKey, JSON.stringify(currentStoredState)); } } refStore.setState(ccUniqueKey, partialState); } } var deltaCommittedState = Object.assign({}, state); computeValueForRef(targetRef, stateModule, refState, deltaCommittedState, callInfo); watchKeyForRef(targetRef, stateModule, refState, deltaCommittedState, callInfo); var ccSetState = function ccSetState() { // 使用 unProxyState ,避免触发get var myChangedState; if (force === true) myChangedState = deltaCommittedState;else myChangedState = extractChangedState(refCtx.unProxyState, deltaCommittedState); if (myChangedState) { // 记录stateKeys,方便triggerRefEffect之用 refCtx.__$$settedList.push({ module: stateModule, keys: okeys$6(myChangedState) }); refCtx.__$$ccSetState(myChangedState, reactCallback); } }; if (next) { next(renderType, deltaCommittedState, ccSetState); } else { ccSetState(); } } function syncCommittedStateToStore(moduleName, committedState, options) { var stateKeys = getModuleStateKeys$1(moduleName); // extract shared state var _extractStateByKeys3 = extractStateByKeys(committedState, stateKeys, true), partialState = _extractStateByKeys3.partialState, hasPrivState = _extractStateByKeys3.missKeyInState; // save state to store if (partialState) { var _storeSetState = storeSetState(moduleName, partialState, options), hasDelta = _storeSetState.hasDelta, deltaCommittedState = _storeSetState.deltaCommittedState; return { partialState: deltaCommittedState, hasDelta: hasDelta, hasPrivState: hasPrivState }; } return { partialState: partialState, hasDelta: false, hasPrivState: hasPrivState }; } function triggerBroadcastState(stateFor, callInfo, targetRef, sharedState, allowOriInsRender, moduleName, reactCallback, renderKeys, delay$$1, force) { var passAllowOri = allowOriInsRender; if (delay$$1 > 0) { if (passAllowOri) { // 优先将当前实例渲染了 triggerReactSetState(targetRef, callInfo, [], SET_STATE$1, sharedState, stateFor, false, reactCallback, getCallerForce(force)); } passAllowOri = false; // 置为false,后面的runLater里不会再次触发当前实例渲染 } var startBroadcastState = function startBroadcastState() { broadcastState(callInfo, targetRef, sharedState, passAllowOri, moduleName, reactCallback, renderKeys, force); }; if (delay$$1 > 0) { var feature = computeFeature$1(targetRef.ctx.ccUniqueKey, sharedState); runLater(startBroadcastState, feature, delay$$1); } else { startBroadcastState(); } } function broadcastState(callInfo, targetRef, partialSharedState, allowOriInsRender, moduleName, reactCallback, renderKeys, force) { if (!partialSharedState) { // null return; } var ccUKey2ref = ccContext.ccUKey2ref; /** @type ICtxBase */ var _targetRef$ctx2 = targetRef.ctx, currentCcUKey = _targetRef$ctx2.ccUniqueKey, ccClassKey = _targetRef$ctx2.ccClassKey; var renderKeyClasses = ccClassKey2Context[ccClassKey].renderKeyClasses; var _findUpdateRefs = findUpdateRefs(moduleName, partialSharedState, renderKeys, renderKeyClasses), sharedStateKeys = _findUpdateRefs.sharedStateKeys, _findUpdateRefs$resul = _findUpdateRefs.result, belongRefKeys = _findUpdateRefs$resul.belong, connectRefKeys = _findUpdateRefs$resul.connect; var renderedInBelong = {}; belongRefKeys.forEach(function (refKey) { var ref = ccUKey2ref[refKey]; if (!ref) return; var refUKey = ref.ctx.ccUniqueKey; var rcb = null; // 这里的calledBy直接用'broadcastState',仅供concent内部运行时用 var calledBy = 'broadcastState'; if (refUKey === currentCcUKey) { if (!allowOriInsRender) return; rcb = reactCallback; calledBy = callInfo.calledBy; } triggerReactSetState(ref, callInfo, [], calledBy, partialSharedState, FOR_CUR_MOD$1, false, rcb, force); renderedInBelong[refKey] = 1; }); var prevModuleState = getPrevState(moduleName); connectRefKeys.forEach(function (refKey) { // 对于即属于又连接的实例,避免一次重复的渲染 if (renderedInBelong[refKey]) { return; } var ref = ccUKey2ref[refKey]; if (!ref) return; // 对于挂载好了还未卸载的实例,才有必要触发重渲染 if (ref.__$$ms === MOUNTED$1) { var refCtx = ref.ctx; var _computeValueForRef = computeValueForRef(ref, moduleName, prevModuleState, partialSharedState, callInfo, false, false), hasDeltaInCu = _computeValueForRef.hasDelta, cuCommittedState = _computeValueForRef.newCommittedState; var _watchKeyForRef = watchKeyForRef(ref, moduleName, prevModuleState, partialSharedState, callInfo, false, false), hasDeltaInWa = _watchKeyForRef.hasDelta, waCommittedState = _watchKeyForRef.newCommittedState; // computed & watch 过程中提交了新的state,合并到 unProxyState 里 // 注意这里,computeValueForRef watchKeyForRef 调用的 findDepFnsToExecute内部 // 保证了实例里cu或者wa函数commit提交的状态只能是 privateStateKey,所以合并到unProxyState是安全的 if (hasDeltaInCu || hasDeltaInWa) { var changedRefPrivState = Object.assign(cuCommittedState, waCommittedState); var refModule = refCtx.module; var refState = refCtx.unProxyState; computeValueForRef(ref, refModule, refState, changedRefPrivState, callInfo); watchKeyForRef(ref, refModule, refState, changedRefPrivState, callInfo); Object.assign(refState, changedRefPrivState); Object.assign(refCtx.state, changedRefPrivState); refCtx.__$$settedList.push({ module: refModule, keys: okeys$6(changedRefPrivState) }); } // 记录sharedStateKeys,方便triggerRefEffect之用 refCtx.__$$settedList.push({ module: moduleName, keys: sharedStateKeys }); refCtx.__$$ccForceUpdate(); } }); } function startChangeRefState(state, options, ref) { /** * 避免死循环,利用 setTimeout 将执行流程放到下一轮事件循环里 * 在 <= v2.10.13之前 * 1 watch回调里执行 setState 导致无限死循环 * 2 setup 块里直接执行 setState 导致无限死循环 * * 以 watch为例: * function setup({watch, setState, initState}){ * initState({privKey: 2}); * watch('num', ()=>{ * // 因为watch是在组件渲染前执行,当设置immediate为true时 * // 组件处于 beforeMount 步骤,cUKey2Ref并未记录具体的ref, * // 此时回调里调用setState会导致 use-concent 140判断失败后 * // 然后一直触发 cref函数,一直进入新的 beforeMount流程 * setState({privKey:1}); * }, {immediate:true}); * } */ if (ref.ctx.__$$inBM) { setTimeout(function () { return startChangeRefState(state, options, ref); }, 0); return; } changeRefState(state, options, ref); } function _setState(state, options) { try { var ref = pickOneRef(options.module); ref.ctx.changeState(state, options); } catch (err) { strictWarning(err); } } function innerSetState(module, state, stateChangedCb) { _setState(state, { module: module, stateChangedCb: stateChangedCb }); } function setState (module, state, renderKey, delay$$1, skipMiddleware) { if (delay$$1 === void 0) { delay$$1 = -1; } _setState(state, { ccKey: '[[top api:setState]]', module: module, renderKey: renderKey, delay: delay$$1, skipMiddleware: skipMiddleware }); } // import hoistNonReactStatic from 'hoist-non-react-statics'; var verboseInfo$1 = verboseInfo, makeError$2 = makeError, justWarning$3 = justWarning, isPJO$4 = isPJO, okeys$7 = okeys, isValueNotNull$1 = isValueNotNull; var _ccContext$store$1 = ccContext.store, getState = _ccContext$store$1.getState, storeSetState$1 = _ccContext$store$1.setState, _reducer$1 = ccContext.reducer._reducer, _computedValues$3 = ccContext.computed._computedValues, runtimeHandler$1 = ccContext.runtimeHandler, runtimeVar$2 = ccContext.runtimeVar; var me = makeError$2; var vbi$1 = verboseInfo$1; function handleError(err, throwError) { if (throwError === void 0) { throwError = true; } if (throwError) throw err;else { handleCcFnError(err); } } function checkStoreModule(module, throwError) { if (throwError === void 0) { throwError = true; } try { checkModuleName(module, false, "module[" + module + "] is not configured in store"); return true; } catch (err) { handleError(err, throwError); return false; } } function paramCallBackShouldNotSupply(module, currentModule) { return "param module[" + module + "] must equal current ref's module[" + currentModule + "] when pass param reactCallback, or it will never been triggered! "; } function _promiseErrorHandler(resolve, reject) { return function (err) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return err ? reject(err) : resolve.apply(void 0, args); }; } //忽略掉传递进来的chainId,chainDepth,重新生成它们,源头调用了lazyDispatch或者ctx里调用了lazyDispatch,就会触发此逻辑 function getNewChainData(isLazy, chainId, oriChainId, chainId2depth) { var _chainId; if (isLazy === true) { _chainId = getChainId(); setChainIdLazy(_chainId); chainId2depth[_chainId] = 1; //置为1 } else { _chainId = chainId || getChainId(); if (!chainId2depth[_chainId]) chainId2depth[_chainId] = 1; } //源头函数会触发创建oriChainId, 之后就一直传递下去了 var _oriChainId = oriChainId || _chainId; return { _chainId: _chainId, _oriChainId: _oriChainId }; } // any error in this function will not been throw, cc just warning, function isStateModuleValid(inputModule, currentModule, reactCallback, cb) { var targetCb = reactCallback; if (checkStoreModule(inputModule, false)) { if (inputModule !== currentModule && reactCallback) { // ???strict justWarning$3(paramCallBackShouldNotSupply(inputModule, currentModule)); targetCb = null; //let user's reactCallback has no chance to be triggered } cb(null, targetCb); } else { cb(new Error("inputModule:" + inputModule + " invalid"), null); } } function handleCcFnError(err, __innerCb) { if (err) { if (__innerCb) __innerCb(err);else { ccContext.runtimeHandler.tryHandleError(err); } } } function _promisifyCcFn(ccFn, userLogicFn, executionContext, payload) { return new Promise(function (resolve, reject) { var _executionContext = Object.assign(executionContext, { __innerCb: _promiseErrorHandler(resolve, reject) }); ccFn(userLogicFn, _executionContext, payload); })["catch"](runtimeHandler$1.tryHandleError); } function __promisifiedInvokeWith(userLogicFn, executionContext, payload) { return _promisifyCcFn(invokeWith, userLogicFn, executionContext, payload); } function __invoke(userLogicFn, option, payload) { var callerRef = option.callerRef, delay$$1 = option.delay, renderKey = option.renderKey, force = option.force, calledBy = option.calledBy, module = option.module, chainId = option.chainId, oriChainId = option.oriChainId, chainId2depth = option.chainId2depth, isSilent = option.isSilent; return __promisifiedInvokeWith(userLogicFn, { callerRef: callerRef, context: true, module: module, calledBy: calledBy, fnName: userLogicFn.name, delay: delay$$1, renderKey: renderKey, force: force, chainId: chainId, oriChainId: oriChainId, chainId2depth: chainId2depth, isSilent: isSilent }, payload); } // 后面会根据具体组件形态给reactSetState赋值 // 直接写为 makeCcSetStateHandler = (ref)=> ref.ctx.reactSetState, 是错误的 // ref.ctx.reactSetState是在后面的流程里被赋值的,所以此处多用一层函数包裹再调用 function makeCcSetStateHandler(ref) { return function (state, cb) { ref.ctx.reactSetState(state, cb); }; } function makeCcForceUpdateHandler(ref) { return function (cb) { ref.ctx.reactForceUpdate(cb); }; } // last param: chainData function makeInvokeHandler(callerRef, _temp) { var _ref = _temp === void 0 ? {} : _temp, chainId = _ref.chainId, oriChainId = _ref.oriChainId, isLazy = _ref.isLazy, _ref$delay = _ref.delay, delay$$1 = _ref$delay === void 0 ? -1 : _ref$delay, _ref$isSilent = _ref.isSilent, isSilent = _ref$isSilent === void 0 ? false : _ref$isSilent, _ref$chainId2depth = _ref.chainId2depth, chainId2depth = _ref$chainId2depth === void 0 ? {} : _ref$chainId2depth; return function (firstParam, payload, inputRKey, inputDelay) { var _isLazy = isLazy, _isSilent = isSilent; var _renderKey = '', _delay = inputDelay != undefined ? inputDelay : delay$$1; var _force = false; if (isPJO$4(inputRKey)) { var lazy = inputRKey.lazy, silent = inputRKey.silent, renderKey = inputRKey.renderKey, _delay2 = inputRKey.delay, force = inputRKey.force; lazy !== undefined && (_isLazy = lazy); silent !== undefined && (_isSilent = silent); renderKey !== undefined && (_renderKey = renderKey); _delay2 !== undefined && (_delay = _delay2); _force = force; } else { _renderKey = inputRKey; } var _getNewChainData = getNewChainData(_isLazy, chainId, oriChainId, chainId2depth), _chainId = _getNewChainData._chainId, _oriChainId = _getNewChainData._oriChainId; var firstParamType = typeof firstParam; var option = { callerRef: callerRef, calledBy: INVOKE, module: callerRef.ctx.module, isSilent: _isSilent, chainId: _chainId, oriChainId: _oriChainId, chainId2depth: chainId2depth, delay: _delay, renderKey: _renderKey, force: _force }; // eslint-disable-next-line var err = new Error("param type error, correct usage: invoke(userFn:function, ...args:any[]) or invoke(option:[module:string, fn:function], ...args:any[])"); if (firstParamType === 'function') { // 可能用户直接使用invoke调用了reducer函数 if (firstParam.__fnName) firstParam.name = firstParam.__fnName; // 这里不修改option.module,concent明确定义了dispatch和invoke规则 /** invoke调用函数引用时 无论组件有无注册模块,一定走调用方模块 dispatch调用函数引用时 优先走函数引用的模块(此时函数是一个reducer函数),没有(此函数不是reducer函数)则走调用方的模块并降级为invoke调用 */ // if (firstParam.__stateModule) option.module = firstParam.__stateModule; return __invoke(firstParam, option, payload); } else if (firstParamType === 'object') { var _fn, _module; if (Array.isArray(firstParam)) { var module = firstParam[0], fn = firstParam[1]; _fn = fn; _module = module; } else { var _module2 = firstParam.module, _fn2 = firstParam.fn; _fn = _fn2; _module = _module2; } if (!isFn(_fn)) throw err; if (_module) option.module = _module; //某个模块的实例修改了另外模块的数据 return __invoke(_fn, option, payload); } else { throw err; } }; } function invokeWith(userLogicFn, executionContext, payload) { var callerRef = executionContext.callerRef; var callerModule = callerRef.ctx.module; var _executionContext$mod = executionContext.module, targetModule = _executionContext$mod === void 0 ? callerModule : _executionContext$mod, _executionContext$con = executionContext.context, context = _executionContext$con === void 0 ? false : _executionContext$con, cb = executionContext.cb, __innerCb = executionContext.__innerCb, type = executionContext.type, calledBy = executionContext.calledBy, _executionContext$fnN = executionContext.fnName, fnName = _executionContext$fnN === void 0 ? '' : _executionContext$fnN, _executionContext$del = executionContext.delay, delay$$1 = _executionContext$del === void 0 ? -1 : _executionContext$del, renderKey = executionContext.renderKey, _executionContext$for = executionContext.force, force = _executionContext$for === void 0 ? false : _executionContext$for, chainId = executionContext.chainId, oriChainId = executionContext.oriChainId, chainId2depth = executionContext.chainId2depth, isSilent = executionContext.isSilent; isStateModuleValid(targetModule, callerModule, cb, function (err, newCb) { if (err) return handleCcFnError(err, __innerCb); var moduleState = getState(targetModule); var actionContext = {}; var isSourceCall = false; isSourceCall = chainId === oriChainId && chainId2depth[chainId] === 1; if (context) { // 调用前先加1 chainId2depth[chainId] = chainId2depth[chainId] + 1; // !!!makeDispatchHandler的dispatch lazyDispatch将源头的isSilent 一致透传下去 var _dispatch = makeDispatchHandler(callerRef, false, isSilent, targetModule, renderKey, delay$$1, chainId, oriChainId, chainId2depth); var silentDispatch = makeDispatchHandler(callerRef, false, true, targetModule, renderKey, delay$$1, chainId, oriChainId, chainId2depth); var lazyDispatch = makeDispatchHandler(callerRef, true, isSilent, targetModule, renderKey, delay$$1, chainId, oriChainId, chainId2depth); // oriChainId, chainId2depth 一直携带下去,设置isLazy,会重新生成chainId var invoke = makeInvokeHandler(callerRef, { delay: delay$$1, chainId: chainId, oriChainId: oriChainId, chainId2depth: chainId2depth }); var lazyInvoke = makeInvokeHandler(callerRef, { isLazy: true, delay: delay$$1, oriChainId: oriChainId, chainId2depth: chainId2depth }); var silentInvoke = makeInvokeHandler(callerRef, { isLazy: false, delay: delay$$1, isSilent: true, oriChainId: oriChainId, chainId2depth: chainId2depth }); // 首次调用时是undefined,这里做个保护 var committedStateMap = getAllChainStateMap(chainId) || {}; var committedState = committedStateMap[targetModule] || {}; actionContext = { callInfo: { renderKey: renderKey, delay: delay$$1, fnName: fnName, type: type, calledBy: calledBy, force: force }, module: targetModule, callerModule: callerModule, committedStateMap: committedStateMap, // 一次ref dispatch调用,所经过的所有reducer的返回结果收集 committedState: committedState, invoke: invoke, lazyInvoke: lazyInvoke, silentInvoke: silentInvoke, invokeLazy: lazyInvoke, invokeSilent: silentInvoke, dispatch: _dispatch, lazyDispatch: lazyDispatch, silentDispatch: silentDispatch, dispatchLazy: lazyDispatch, dispatchSilent: silentDispatch, rootState: getState(), globalState: getState(MODULE_GLOBAL), // 指的是目标模块的state moduleState: moduleState, // 指的是目标模块的的moduleComputed moduleComputed: _computedValues$3[targetModule] || {}, // 利用dispatch调用自动生成的setState setState: function setState$$1(state, r, d) { var targetR = r !== 0 ? r || renderKey : r; var targetD = d !== 0 ? d || delay$$1 : d; return _dispatch('setState', state, { silent: isSilent, renderKey: targetR, delay: targetD }); }, // !!!指的是调用源cc实例的ctx refCtx: callerRef.ctx, // 方便直接获取并标记 refState 类型 refState: callerRef.ctx.state // concent不鼓励用户在reducer使用ref相关数据书写业务逻辑,除非用户确保是同一个模块的实例触发调用该函数, // 因为不同调用方传递不同的refCtx值,会引起用户不注意的bug }; } if (isSilent === false) { send(SIG_FN_START, { isSourceCall: isSourceCall, calledBy: calledBy, module: targetModule, chainId: chainId, fn: userLogicFn }); } var handleReturnState = function handleReturnState(partialState) { chainId2depth[chainId] = chainId2depth[chainId] - 1; // 调用结束减1 var curDepth = chainId2depth[chainId]; var isFirstDepth = curDepth === 1; var isC2Result = stOrPromisedSt && stOrPromisedSt.__c2Result; // 调用结束就记录 setAllChainState(chainId, targetModule, partialState); var commitStateList = []; if (isSilent === false) { send(SIG_FN_END, { isSourceCall: isSourceCall, calledBy: calledBy, module: targetModule, chainId: chainId, fn: userLogicFn }); // targetModule, sourceModule相等与否不用判断了,chainState里按模块为key去记录提交到不同模块的state if (isChainIdLazy(chainId)) { // 来自于惰性派发的调用 if (!isFirstDepth) { // 某条链还在往下调用中,没有回到第一层,暂存状态,直到回到第一层才提交 setChainState(chainId, targetModule, partialState); } else { // 合并状态一次性提交到store并派发到组件实例 if (isChainExited(chainId)) ; else { commitStateList = setAndGetChainStateList(isC2Result, chainId, targetModule, partialState); removeChainState(chainId); } } } else { if (!isC2Result) commitStateList = [{ module: targetModule, state: partialState }]; } } commitStateList.forEach(function (v) { startChangeRefState(v.state, { renderKey: renderKey, module: v.module, reactCallback: newCb, type: type, calledBy: calledBy, fnName: fnName, delay: delay$$1, payload: payload, force: force }, callerRef); }); if (isSourceCall) { // 源头 dispatch 或 invoke 结束调用 removeChainState(chainId); removeAllChainState(chainId); } if (__innerCb) __innerCb(null, partialState); }; var handleFnError = function handleFnError(err) { send(SIG_FN_ERR, { isSourceCall: isSourceCall, calledBy: calledBy, module: targetModule, chainId: chainId, fn: userLogicFn }); handleCcFnError(err, __innerCb); }; var stOrPromisedSt = userLogicFn(payload, moduleState, actionContext); if (userLogicFn.__isAsync) { Promise.resolve(stOrPromisedSt).then(handleReturnState)["catch"](handleFnError); } else { // 防止输入中文时,因为隔了一个Promise而出现抖动 try { if (userLogicFn.__isReturnJudged) { handleReturnState(stOrPromisedSt); return; } // 再判断一次,有可能会被编译器再包一层,形如: // function getServerStore(_x2) { // return _getServerStore.apply(this, arguments); // } if (isAsyncFn(stOrPromisedSt)) { userLogicFn.__isAsync = true; Promise.resolve(stOrPromisedSt).then(handleReturnState)["catch"](handleFnError); return; } else { userLogicFn.__isReturnJudged = true; } handleReturnState(stOrPromisedSt); } catch (err) { handleFnError(err); } } }); } function dispatch$1(_temp2) { var _ref2 = _temp2 === void 0 ? {} : _temp2, callerRef = _ref2.callerRef, inputModule = _ref2.module, renderKey = _ref2.renderKey, isSilent = _ref2.isSilent, force = _ref2.force, type = _ref2.type, payload = _ref2.payload, reactCallback = _ref2.cb, __innerCb = _ref2.__innerCb, _ref2$delay = _ref2.delay, delay$$1 = _ref2$delay === void 0 ? -1 : _ref2$delay, chainId = _ref2.chainId, oriChainId = _ref2.oriChainId, chainId2depth = _ref2.chainId2depth; var targetReducerFns = _reducer$1[inputModule] || {}; var reducerFn = targetReducerFns[type]; if (!reducerFn) { var fns = okeys$7(targetReducerFns); var err = new Error("reducer fn [" + inputModule + "/" + type + "] not found, you may call:" + fns); return __innerCb(err); } var executionContext = { callerRef: callerRef, module: inputModule, type: type, force: force, cb: reactCallback, context: true, __innerCb: __innerCb, calledBy: DISPATCH, delay: delay$$1, renderKey: renderKey, isSilent: isSilent, chainId: chainId, oriChainId: oriChainId, chainId2depth: chainId2depth }; invokeWith(reducerFn, executionContext, payload); } function makeDispatchHandler(callerRef, inputIsLazy, inputIsSilent, defaultModule, defaultRenderKey, delay$$1, chainId, oriChainId, chainId2depth // sourceModule, oriChainId, oriChainDepth ) { if (defaultRenderKey === void 0) { defaultRenderKey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } if (chainId2depth === void 0) { chainId2depth = {}; } // return Promise<any> return function (paramObj, payload, userInputRKey, userInputDelay) { if (!isValueNotNull$1(paramObj)) { return Promise.reject(new Error('dispatch param is null/undefined')); } var isLazy = inputIsLazy, isSilent = inputIsSilent; var _renderKey = ''; var _delay = userInputDelay || delay$$1; var _force = false; if (isPJO$4(userInputRKey)) { _renderKey = defaultRenderKey; var lazy = userInputRKey.lazy, silent = userInputRKey.silent, renderKey = userInputRKey.renderKey, _delay3 = userInputRKey.delay, force = userInputRKey.force; lazy !== undefined && (isLazy = lazy); silent !== undefined && (isSilent = silent); renderKey !== undefined && (_renderKey = renderKey); _delay3 !== undefined && (_delay = _delay3); _force = force; } else { _renderKey = userInputRKey || defaultRenderKey; } var _getNewChainData2 = getNewChainData(isLazy, chainId, oriChainId, chainId2depth), _chainId = _getNewChainData2._chainId, _oriChainId = _getNewChainData2._oriChainId; var paramObjType = typeof paramObj; var _type, _cb; var _module = defaultModule; var callInvoke = function callInvoke() { var iHandler = makeInvokeHandler(callerRef, { chainId: _chainId, oriChainId: _oriChainId, isLazy: isLazy, isSilent: isSilent, chainId2depth: chainId2depth }); return iHandler(paramObj, payload, { renderKey: _renderKey, delay: _delay, force: _force }); }; if (paramObjType === 'object') { if (Array.isArray(paramObj)) { var mInArr = paramObj[0], rInArr = paramObj[1]; if (rInArr && rInArr.__fnName) { _module = mInArr; _type = rInArr.__fnName; } else { return callInvoke(); } } else { var module = paramObj.module, fn = paramObj.fn, type = paramObj.type, cb = paramObj.cb; if (module) _module = module; if (fn && fn.__fnName) { _type = fn.__fnName; // 未指定module,才默认走 reducer函数的所属模块 if (!module) _module = fn.__stateModule; } else { if (typeof type !== 'string') { console.log('ffffffffuuuuuuuuccccccccckkkkkkkkk......'); return Promise.reject(new Error('dispatchDesc.type must be string')); } _type = type; } _cb = cb; } } else if (paramObjType === 'string' || paramObjType === 'function') { var targetFirstParam = paramObj; if (paramObjType === 'function') { var fnName = paramObj.__fnName; if (!fnName) { // 此函数是一个普通函数,没有配置到某个模块的reducer里,降级为invoke调用 return callInvoke(); } targetFirstParam = fnName; // 这里非常重要,只有处于第一层的调用时,才获取函数对象上的__stateModule参数 // 防止克隆自模块a的模块b在reducer文件里基于函数引用直接调用时,取的是a的模块相关参数了,但是源头由b发起,应该是b才对 if (chainId2depth[_oriChainId] == 1) { // let dispatch can apply reducer function directly!!! // !!! 如果用户在b模块的组件里dispatch直接调用a模块的函数,但是确实想修改的是b模块的数据,只是想复用a模块的那个函数的逻辑 // 那么千万要注意,写为{module:'b', fn:xxxFoo}的模式 _module = paramObj.__stateModule; } } var slashCount = targetFirstParam.split('').filter(function (v) { return v === '/'; }).length; if (slashCount === 0) { _type = targetFirstParam; } else if (slashCount === 1) { var _targetFirstParam$spl = targetFirstParam.split('/'), _module3 = _targetFirstParam$spl[0], _type2 = _targetFirstParam$spl[1]; if (_module3) _module = _module3; //targetFirstParam may like: /foo/changeName _type = _type2; } else { return Promise.reject(me(ERR.CC_DISPATCH_STRING_INVALID, vbi$1(targetFirstParam))); } } else { return Promise.reject(me(ERR.CC_DISPATCH_PARAM_INVALID)); } if (_module === '*') { return ccDispatch("*/" + _type, payload, { silent: isSilent, lazy: isLazy, renderKey: _renderKey, force: _force }, _delay, { refModule: callerRef.ctx.module } // in name of refModule to call dispatch handler ); } var p = new Promise(function (resolve, reject) { dispatch$1({ callerRef: callerRef, module: _module, type: _type, payload: payload, cb: _cb, __innerCb: _promiseErrorHandler(resolve, reject), delay: _delay, renderKey: _renderKey, isSilent: isSilent, force: _force, chainId: _chainId, oriChainId: _oriChainId, chainId2depth: chainId2depth // oriChainId: _oriChainId, oriChainDepth: _oriChainDepth, sourceModule: _sourceModule, }); })["catch"](function (err) { // 强烈不建议用户配置 unsafe_moveReducerErrToErrorHandler 为 true,转发 reducer 错误到 errorHandler 里 // 保留这个参数是为了让老版本的concent工程能够正常工作 if (runtimeVar$2.unsafe_moveReducerErrToErrorHandler) { // 非严格模式,如果未配置 errorHandler,错误会被静默掉 runtimeHandler$1.tryHandleError(err, !runtimeVar$2.isStrict); } else { throw err; } }); /** * 用于帮助concent识别出这是用户直接返回的Promise对象,减少一次冗余的渲染 * function demoMethod(p,m,ac){ * // ac.setState已经触发了一次渲染 * // demoMethod可以不用再触发渲染了 * return ac.setState({num1:1}); * } */ p.__c2Result = true; return p; }; } function makeModuleDispatcher(module) { return function (action) { var _action = typeof action === 'string' && !action.includes('/') ? module + "/" + action : action; for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } return ccDispatch.apply(void 0, [_action].concat(args)); }; } // for moduleConf.init(legency) moduleConf.lifecycle.initState(v2.9+) function makeSetStateHandler(module, initStateDone) { return function (state) { var execInitDoneWrap = function execInitDoneWrap() { return initStateDone && initStateDone(makeModuleDispatcher(module), getState(module)); }; try { if (!state) return void execInitDoneWrap(); innerSetState(module, state, execInitDoneWrap); } catch (err) { var moduleState = getState(module); if (!moduleState) { return justWarning$3("invalid module " + module); } var keys = okeys$7(moduleState); var _extractStateByKeys = extractStateByKeys(state, keys, false, true), partialState = _extractStateByKeys.partialState, isStateEmpty = _extractStateByKeys.isStateEmpty, ignoredStateKeys = _extractStateByKeys.ignoredStateKeys; if (!isStateEmpty) storeSetState$1(module, partialState); //store this valid state; if (ignoredStateKeys.length > 0) { justWarning$3("invalid keys:" + ignoredStateKeys.join(',') + ", their value is undefined or they are not declared in module" + module); } justTip("no ccInstance found for module[" + module + "] currently, cc will just store it, lately ccInstance will pick this state to render"); execInitDoneWrap(); } }; } var makeRefSetState = function makeRefSetState(ref) { return function (partialState, cb) { var ctx = ref.ctx; var newState = Object.assign({}, ctx.unProxyState, partialState); ctx.unProxyState = newState; // 和class setState(partialState, cb); 保持一致 var cbNewState = function cbNewState() { return cb && cb(newState); }; // 让ctx.state始终保持同一个引用,使setup里可以安全的解构state反复使用 ctx.state = Object.assign(ctx.state, partialState); var act = runtimeHandler$1.act; var update = function update() { if (ctx.type === CC_HOOK) { ctx.__boundSetState(newState); // 保持和class组件callback一样的行为,即组件渲染后再触发callback setTimeout(cbNewState, 0); } else { // 此处注意原始的react class setSate [,callback] 不会提供latestState ctx.__boundSetState(partialState, cbNewState); } }; // for rest-test-utils if (act) act(update);else update(); }; }; var makeRefForceUpdate = function makeRefForceUpdate(ref) { return function (cb) { var ctx = ref.ctx; var newState = Object.assign({}, ctx.unProxyState, ctx.__$$mstate); var cbNewState = function cbNewState() { return cb && cb(newState); }; if (ctx.type === CC_HOOK) { ctx.__boundSetState(newState); cbNewState(); } else { ctx.__boundForceUpdate(cbNewState); } }; }; var getState$1 = ccContext.store.getState; function initModuleLifecycle (moduleName, lifecycle) { if (lifecycle === void 0) { lifecycle = {}; } var _lifecycle = lifecycle, initState = _lifecycle.initState, initStateDone = _lifecycle.initStateDone, loaded = _lifecycle.loaded, willUnmount = _lifecycle.willUnmount, mounted = _lifecycle.mounted; // 对接原来的 moduleConf.init initPost var validLifecycle = {}; if (isFn(willUnmount)) validLifecycle.willUnmount = willUnmount; if (isFn(mounted)) validLifecycle.mounted = mounted; ccContext.lifecycle._lifecycle[moduleName] = validLifecycle; var moduleState = getState$1(moduleName); var d = makeModuleDispatcher(moduleName); // loaded just means that module state、reducer、watch、computed configuration were recorded to ccContext // so it is called before initState if (isFn(loaded)) { loaded(d, moduleState); } if (isFn(initState)) { Promise.resolve().then(function () { return initState(moduleState); }).then(function (state) { makeSetStateHandler(moduleName, initStateDone)(state); })["catch"](ccContext.runtimeHandler.tryHandleError); } else { // make sure initStateDone will be alway called no matther initState difined or not isFn(initStateDone) && initStateDone(d, moduleState); } } /** * 兼容v2.8之前的 moduleConf.init、initPost * 2.9之后不在types.d.ts的ModuleConf类型里暴露init、initPost,仅为了让老版本的js工程升级到2.9能正常工作 * 如果是ts工程,则需要将init逻辑迁移到 lifecycle.initState 里,initPost 迁移到 lifecycle.initStateDone 里 */ function getLifecycle (legencyModuleConf) { var lifeCycleCopy = Object.assign({}, legencyModuleConf.lifecycle); // 优先取lifecycle里的initState、initStateDone,不存在的话再去对接原来外层的init、initPost定义 if (!lifeCycleCopy.initState) lifeCycleCopy.initState = legencyModuleConf.init; if (!lifeCycleCopy.initStateDone) lifeCycleCopy.initStateDone = legencyModuleConf.initPost; return lifeCycleCopy; } /** @typedef {import('../types').ModuleConfig} ModuleConfig */ var isPJO$5 = isPJO, evalState$1 = evalState, okeys$8 = okeys, isFn$1 = isFn; /** * @description configure module associate params * @author zzk * @export * @param {string | {[module:string]: ModuleConfig}} moduleNameOrNamedModuleConf * @param {ModuleConfig} config - when module type is string */ function configure (moduleNameOrNamedModuleConf, config, innerParams) { if (config === void 0) { config = {}; } var confOneModule = function confOneModule(module, /** @type ModuleConfig*/ config) { if (!ccContext.isStartup) { pendingModules.push({ module: module, config: config }); return; } if (!isPJO$5(config)) { throw new Error("param config " + INAJ); } if (module === MODULE_GLOBAL) { throw new Error('configuring global module is not allowed'); } var state = config.state, reducer = config.reducer, computed = config.computed, watch = config.watch, _config$ghosts = config.ghosts, ghosts = _config$ghosts === void 0 ? [] : _config$ghosts; var eState = evalState$1(state); if (isFn$1(state)) ccContext.moduleName2stateFn[module] = state; initModuleState(module, eState, true, innerParams); initModuleReducer(module, reducer, ghosts); initModuleComputed(module, computed); initModuleWatch(module, watch); initModuleLifecycle(module, getLifecycle(config)); ccContext.moduleName2isConfigured[module] = true; send(SIG_MODULE_CONFIGURED, module); }; // now module is an object that includes partial store conf if (isPJO$5(moduleNameOrNamedModuleConf)) { okeys$8(moduleNameOrNamedModuleConf).forEach(function (moduleName) { return confOneModule(moduleName, moduleNameOrNamedModuleConf[moduleName]); }); } else { confOneModule(moduleNameOrNamedModuleConf, config); } } function tagReducerFn(reducerFns, moduleName) { var taggedReducer = {}; if (reducerFns) { okeys(reducerFns).forEach(function (fnName) { var oldFn = reducerFns[fnName]; var fn = function fn() { return oldFn.apply(void 0, arguments); }; fn.__fnName = fnName; fn.__stateModule = moduleName; taggedReducer[fnName] = fn; }); } return taggedReducer; } /** * @param {string} newModule * @param {string} existingModule */ var _cloneModule = (function (newModule, existingModule, moduleOverideConf) { if (moduleOverideConf === void 0) { moduleOverideConf = {}; } var _moduleOverideConf = moduleOverideConf, state = _moduleOverideConf.state, reducer = _moduleOverideConf.reducer, computed = _moduleOverideConf.computed, watch = _moduleOverideConf.watch; if (!ccContext.isStartup) { throw new Error('concent is not running'); } checkModuleNameBasically(newModule); checkModuleName(existingModule, false); var stateFn = ccContext.moduleName2stateFn[existingModule]; if (!stateFn) { throw new Error("target module[" + existingModule + "] state must be a function when use cloneModule"); } var stateCopy = stateFn(); Object.assign(stateCopy, evalState(state)); var originalReducer = ccContext.reducer._reducer[existingModule]; // attach __fnName __stateModule, 不能污染原函数的dispatch逻辑里需要的__stateModule var taggedReducerCopy = Object.assign(tagReducerFn(originalReducer, newModule), tagReducerFn(reducer, newModule)); var computedCopy = Object.assign({}, ccContext.computed._computedRaw[existingModule], computed); var watchCopy = Object.assign({}, ccContext.watch._watchRaw[existingModule], watch); var lifecycleCopy = Object.assign({}, ccContext.lifecycle._lifecycle[existingModule], getLifecycle(moduleOverideConf)); var confObj = { state: stateCopy, reducer: taggedReducerCopy, computed: computedCopy, watch: watchCopy, lifecycle: lifecycleCopy }; configure(newModule, confObj); }); var event2handlers = ccContext.event2handlers, handlerKey2handler = ccContext.handlerKey2handler, ccUKey2handlerKeys = ccContext.ccUKey2handlerKeys, ccUKey2ref$1 = ccContext.ccUKey2ref; var makeHandlerKey$1 = makeHandlerKey, safeGetArray$1 = safeGetArray, justWarning$4 = justWarning; function _findEventHandlers(event, module, ccClassKey, ccUniqueKey, identity) { // 不用默认参数写法了 // codesandbox lost default value var _identity = identity == undefined ? null : identity; // 查找的时候,只负责取,不负责隐式的生成,此次不需要用safeGetArray var handlers = event2handlers[event]; if (handlers) { var filteredHandlers = handlers; if (ccUniqueKey) filteredHandlers = handlers.filter(function (v) { return v.ccUniqueKey === ccUniqueKey; });else if (ccClassKey) filteredHandlers = handlers.filter(function (v) { return v.ccClassKey === ccClassKey; });else if (module) filteredHandlers = handlers.filter(function (v) { return v.module === module; }); // identity is null means user call emit like emit('eventName') // identity is not null means user call emit like emit(['eventName', 'idtName']) if (_identity !== undefined) { filteredHandlers = filteredHandlers.filter(function (v) { return v.identity === _identity; }); } return filteredHandlers; } return []; } function _deleteEventHandlers(handlers) { var toDeleteCcUniqueKeyMap = {}; var toDeleteEventNames = []; handlers.forEach(function (item) { var handlerKey = item.handlerKey, ccUniqueKey = item.ccUniqueKey, event = item.event; delete handlerKey2handler[handlerKey]; // delete mapping of handlerKey2handler; toDeleteCcUniqueKeyMap[ccUniqueKey] = 1; if (!toDeleteEventNames.includes(event)) toDeleteEventNames.push(event); }); toDeleteEventNames.forEach(function (event) { var eHandlers = event2handlers[event]; if (eHandlers) { eHandlers.forEach(function (h, idx) { var ccUniqueKey = h.ccUniqueKey; if (toDeleteCcUniqueKeyMap[ccUniqueKey] === 1) { eHandlers[idx] = null; delete ccUKey2handlerKeys[ccUniqueKey]; // delete mapping of ccUKey2handlerKeys; } }); event2handlers[event] = eHandlers.filter(function (v) { return v !== null; }); // delete eHandlers null element } }); } function bindEventHandlerToCcContext(module, ccClassKey, ccUniqueKey, event, identity, handler) { var handlers = safeGetArray$1(event2handlers, event); if (!isFn(handler)) { return justWarning$4("event " + event + "'s handler " + INAF + "!"); } var handlerKey = makeHandlerKey$1(ccUniqueKey, event, identity); var handlerKeys = safeGetArray$1(ccUKey2handlerKeys, ccUniqueKey); var targetHandlerIndex = handlers.findIndex(function (v) { return v.handlerKey === handlerKey; }); // user call ctx.on for a same event in a same instance more than once var handlerItem = { event: event, module: module, ccClassKey: ccClassKey, ccUniqueKey: ccUniqueKey, identity: identity, handlerKey: handlerKey, fn: handler }; if (targetHandlerIndex > -1) { // will alway use the latest handler handlers[targetHandlerIndex] = handlerItem; } else { handlers.push(handlerItem); handlerKeys.push(handlerKey); } handlerKey2handler[handlerKey] = handlerItem; } function findEventHandlersToPerform(event) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var _event, _identity = null, _module, _ccClassKey, _ccUniqueKey; var canPerform = null; if (typeof event === 'string') { _event = event; } else { _event = event.name; _identity = event.identity; _module = event.module; _ccClassKey = event.ccClassKey; _ccUniqueKey = event.ccUniqueKey; canPerform = event.canPerform; } var handlers = _findEventHandlers(_event, _module, _ccClassKey, _ccUniqueKey, _identity); handlers.forEach(function (_ref) { var ccUniqueKey = _ref.ccUniqueKey, handlerKey = _ref.handlerKey; var ref = ccUKey2ref$1[ccUniqueKey]; if (ref && handlerKey) { // confirm the instance is mounted and handler is not been offed if (ref.__$$ms !== MOUNTED) return; var handler = handlerKey2handler[handlerKey]; if (handler) { if (canPerform && !canPerform(ref)) { return; } handler.fn.apply(handler, args); } } }); } function findEventHandlersToOff(event, _ref2) { var module = _ref2.module, ccClassKey = _ref2.ccClassKey, ccUniqueKey = _ref2.ccUniqueKey, identity = _ref2.identity; var handlers = _findEventHandlers(event, module, ccClassKey, ccUniqueKey, identity); _deleteEventHandlers(handlers); } function offEventHandlersByCcUniqueKey(ccUniqueKey) { var handlerKeys = ccUKey2handlerKeys[ccUniqueKey]; if (handlerKeys) { var toDeleteHandlers = []; handlerKeys.forEach(function (k) { return toDeleteHandlers.push(handlerKey2handler[k]); }); _deleteEventHandlers(toDeleteHandlers); } } function getEventItem(event) { var outputEv; if (event && typeof event === 'object') { var _event; if (Array.isArray(event)) { var name = event[0], identity = event[1]; _event = { name: name, identity: identity }; } else { _event = Object.assign({}, event); } if (!_event.identity) _event.identity = null; //否则就允许用户传如自己定义的module, ccClassKey outputEv = _event; } else { outputEv = { name: event, identity: null }; } return outputEv; } var ev = /*#__PURE__*/Object.freeze({ bindEventHandlerToCcContext: bindEventHandlerToCcContext, findEventHandlersToPerform: findEventHandlersToPerform, findEventHandlersToOff: findEventHandlersToOff, offEventHandlersByCcUniqueKey: offEventHandlersByCcUniqueKey, getEventItem: getEventItem }); var getModuleVer$1 = ccContext.store.getModuleVer; function makeObState (ref, state, module, isForModule) { return new Proxy(state, { get: function get(target, key) { // ensureStateNotExpired, 当实例失去模块数据依赖,回调方法直接使用ctx.state时,state里的模块数据可能已过期 if (isForModule) { var modVer = getModuleVer$1(module); var ctx = ref.ctx; if (modVer !== ctx.__$$prevModuleVer) { ctx.__$$prevModuleVer = modVer; Object.assign(state, ctx.__$$mstate); } } updateDep(ref, module, key, isForModule); return target[key]; }, set: function set(target, key, value) { // 这个warning暂时关闭,因为buildRefCtx阶段就生成了obState, refComputed里可能会调用commit向obState写入新的state // justWarning(`warning: state key[${key}] can not been changed manually, use api setState or dispatch instead`); // 允许赋最新值,否则silentUpdate状态合并会失效 target[key] = value; // avoid Uncaught TypeError: 'set' on proxy: trap returned falsish for property '***' return true; } }); } function getDefineWatchHandler (refCtx) { return function (watchItem, watchHandler, depKeysOrOpt) { var confMeta = { type: FN_WATCH, refCtx: refCtx, stateKeys: refCtx.stateKeys, retKeyFns: refCtx.watchRetKeyFns, module: refCtx.module, connect: refCtx.connect, dep: refCtx.watchDep }; refCtx.__$$cuOrWaCalled = true; configureDepFns(CATE_REF, confMeta, watchItem, watchHandler, depKeysOrOpt); }; } /** @typedef {import('../../types-inner').IRefCtx} IRefCtx */ function getDefineComputedHandler ( /** @type IRefCtx */ refCtx) { return function (computedItem, computedHandler, depKeysOrOpt) { var confMeta = { type: FN_CU, refCtx: refCtx, stateKeys: refCtx.stateKeys, retKeyFns: refCtx.computedRetKeyFns, module: refCtx.module, connect: refCtx.connect, dep: refCtx.computedDep }; refCtx.__$$cuOrWaCalled = true; configureDepFns(CATE_REF, confMeta, computedItem, computedHandler, depKeysOrOpt); return refCtx.refComputed; }; } var makeUniqueCcKey$2 = makeUniqueCcKey; function computeCcUniqueKey (ccClassKey, ccKey, tag) { var featureStr = ccKey || uuid(tag); return makeUniqueCcKey$2(ccClassKey, featureStr); } function getOutProps (props) { if (props) { return props.props || props; //把最外层的props传递给用户 } else { return {}; } } var getState$2 = ccContext.store.getState; function getValFromEvent(e) { var se = convertToStandardEvent(e); if (se) { return se.currentTarget.value; } else { return e; } } var buildMockEvent = (function (spec, e, refCtx) { var refModule = refCtx.module, refState = refCtx.state; var ccint = false, ccsync = '', ccrkey = '', value = '', extraState = null, ccdelay = -1, isToggleBool = false; var syncKey = spec[CCSYNC_KEY]; var type = spec.type; var noAutoExtract = false; if (syncKey !== undefined) { // 来自sync生成的setter函数调用 即 sync('xxxKey') ccsync = syncKey; ccdelay = spec.delay; ccrkey = spec.rkey; // type 'bool', 'val', 'int', 'as' ccint = type === 'int'; // convert to int isToggleBool = type === 'bool'; var keyPath, fullKeyPath, module; if (ccsync.includes('/')) { var _ccsync$split = ccsync.split('/'), _module = _ccsync$split[0], _keyPath = _ccsync$split[1]; keyPath = _keyPath; fullKeyPath = ccsync; module = _module; } else { keyPath = ccsync; fullKeyPath = refModule + "/" + keyPath; module = refModule; } var mState = getState$2(module); // 布尔值需要对原来的值取反 var fullState = module !== refModule ? mState : refState; value = type === 'bool' ? !getValueByKeyPath(fullState, keyPath) : getValFromEvent(e); // 优先从spec里取,取不到的话,从e里面分析并提取 var val = spec.val; if (val === undefined) ; else { if (isFn(val)) { // moduleState指的是所修改的目标模块的state var syncRet = val( // TODO: syncCtx 填写函数 setVal(keyPath, value) value, keyPath, { event: e, module: module, moduleState: mState, fullKeyPath: fullKeyPath, state: refState, refCtx: refCtx }); if (syncRet != undefined) { if (type === 'as') value = syncRet; // value is what cb returns; else { var retType = typeof syncRet; if (retType === 'boolean') { // if return true, let noAutoExtract = false, // so this cb will not block state update, and cc will extract partial state automatically // if return false, let noAutoExtract = true, but now extraState is still null, // so this cb will block state update noAutoExtract = !syncRet; } else if (retType === 'object') { noAutoExtract = true; extraState = syncRet; } else { justWarning("syncKey[" + syncKey + "] cb result type error."); } } } else { if (type === 'as') noAutoExtract = true; // if syncAs return undefined, will block update // else continue update and value is just extracted above } } else { value = val; } } } else { // 来自于sync直接调用 <input data-ccsync="foo/f1" onChange={this.sync} /> var se = convertToStandardEvent(e); if (se) { // e is event var currentTarget = se.currentTarget; value = currentTarget.value; var dataset = currentTarget.dataset; if (type === 'int') ccint = true;else ccint = dataset.ccint !== undefined; ccsync = dataset.ccsync; if (!ccsync) return null; ccrkey = dataset.ccrkey; var dataSetDelay = dataset.ccdelay; if (dataSetDelay) { try { ccdelay = parseInt(dataSetDelay); } catch (err) {// do nothing } } } else { // <Input onChange={this.sync}/> is invalid return null; } } return { currentTarget: { value: value, extraState: extraState, noAutoExtract: noAutoExtract, dataset: { ccsync: ccsync, ccint: ccint, ccdelay: ccdelay, ccrkey: ccrkey } }, isToggleBool: isToggleBool }; }); function setValue(obj, keys, lastKeyIndex, keyIndex, value, isToggleBool) { if (isToggleBool === void 0) { isToggleBool = false; } var key = keys[keyIndex]; var oriVal = obj[key]; if (lastKeyIndex === keyIndex) { if (isToggleBool === true) { if (typeof oriVal !== 'boolean') { justWarning("key[" + key + "]'s value type is not boolean"); } else { obj[key] = !oriVal; } } else { obj[key] = value; } } else { var newVal = shallowCopy(oriVal); obj[key] = newVal; setValue(newVal, keys, lastKeyIndex, ++keyIndex, value, isToggleBool); } } var extractStateByCcsync = (function (ccsync, value, ccint, oriState, isToggleBool, refModule) { var _value = value; if (ccint === true) { _value = parseInt(value); // strict? if (Number.isNaN(_value)) { justWarning(value + " can not convert to int but you set ccint as true!\uFF01"); _value = value; } } var module = refModule, keys = []; if (ccsync.includes('/')) { var _ccsync$split = ccsync.split('/'), _module = _ccsync$split[0], keyOrKeyPath = _ccsync$split[1]; module = _module; if (keyOrKeyPath.includes('.')) { keys = keyOrKeyPath.split('.'); } else { keys = [keyOrKeyPath]; } } else if (ccsync.includes('.')) { keys = ccsync.split('.'); } else { keys = [ccsync]; } var keyPath = keys.join('.'); if (keys.length === 1) { var targetStateKey = keys[0]; if (isToggleBool === true) { var _state; return { module: module, keys: keys, keyPath: keyPath, state: (_state = {}, _state[targetStateKey] = !oriState[targetStateKey], _state) }; } else { var _state2; return { module: module, keys: keys, keyPath: keyPath, state: (_state2 = {}, _state2[targetStateKey] = _value, _state2) }; } } else { var _state3; var _keys = keys, key = _keys[0], restKeys = _keys.slice(1); var subState = shallowCopy(oriState[key]); setValue(subState, restKeys, restKeys.length - 1, 0, _value, isToggleBool); return { module: module, keys: keys, keyPath: keyPath, state: (_state3 = {}, _state3[key] = subState, _state3) }; } }); var getState$3 = ccContext.store.getState; function __sync (spec, ref, e) { var refCtx = ref.ctx; var mockE = buildMockEvent(spec, e, refCtx); if (!mockE) return; // 参数无效 例如 <input onChange={this.sync}/> 导致 var ccKey = refCtx.ccKey, ccUniqueKey = refCtx.ccUniqueKey, refModule = refCtx.module; var currentTarget = mockE.currentTarget; var dataset = currentTarget.dataset, value = currentTarget.value, extraState = currentTarget.extraState, noAutoExtract = currentTarget.noAutoExtract; if (e && e.stopPropagation) e.stopPropagation(); var ccint = dataset.ccint, ccdelay = dataset.ccdelay, ccrkey = dataset.ccrkey; var ccsync = dataset.ccsync; if (ccsync.startsWith('/')) { ccsync = "" + refModule + ccsync; // 附加上默认模块值 } var options = { calledBy: SYNC, ccKey: ccKey, ccUniqueKey: ccUniqueKey, module: refModule, renderKey: ccrkey, delay: ccdelay }; var doExtract = function doExtract(fullState) { return extractStateByCcsync(ccsync, value, ccint, fullState, mockE.isToggleBool, refModule); }; if (ccsync.includes('/')) { // syncModuleState 同步模块的state状态 var targetModule = ccsync.split('/')[0]; checkModuleName(targetModule, false); options.module = targetModule; if (noAutoExtract) { if (extraState) startChangeRefState(extraState, options, ref); return; } var fullState = targetModule !== refModule ? getState$3(targetModule) : ref.state; var _doExtract = doExtract(fullState), state = _doExtract.state, module = _doExtract.module, keys = _doExtract.keys, keyPath = _doExtract.keyPath; Object.assign(options, { module: module, keys: keys, keyPath: keyPath }); startChangeRefState(state, options, ref); } else { // 调用自己的setState句柄触发更新,key可能属于local的,也可能属于module的 if (noAutoExtract) { if (extraState) ref.setState(extraState, null, options); return; } var _doExtract2 = doExtract(ref.state), _state = _doExtract2.state, _module = _doExtract2.module, _keys = _doExtract2.keys, _keyPath = _doExtract2.keyPath; Object.assign(options, { module: _module, keys: _keys, keyPath: _keyPath }); ref.setState(_state, null, options); } } var getModuleStateKeys$2 = ccContext.getModuleStateKeys; var verifyKeys$1 = verifyKeys, vbi$2 = verboseInfo, okeys$9 = okeys; function getStoredKeys(belongMotule, refPrivState, ccOptionStoredKeys, regStoredKeys) { var targetStoredKeys = ccOptionStoredKeys || regStoredKeys; if (!targetStoredKeys) { return []; } var moduleStateKeys = getModuleStateKeys$2(belongMotule); if (targetStoredKeys === '*') { // refPrivState里可能含有moduleStateKey,需要进一步过滤 return okeys$9(refPrivState).filter(function (k) { return !moduleStateKeys.includes(k); }); } else { checkStoredKeys(belongMotule, targetStoredKeys); return targetStoredKeys; } } function getWatchedStateKeys(module, ccClassKey, regWatchedKeys) { if (ccClassKey === CC_DISPATCHER) return []; if (!regWatchedKeys) return []; if (regWatchedKeys === '*') { return getModuleStateKeys$2(module); } if (regWatchedKeys === '-') { return regWatchedKeys; } var _verifyKeys = verifyKeys$1(regWatchedKeys, []), notArray = _verifyKeys.notArray, keyElementNotString = _verifyKeys.keyElementNotString; if (notArray || keyElementNotString) { var vbiInfo = vbi$2("ccClassKey:" + ccClassKey); throw new Error("watchedKeys " + STR_ARR_OR_STAR + " " + vbiInfo); } return regWatchedKeys; } function getConnect(regConnect) { var targetConnect = regConnect || {}; // codesandbox lost default value if (!isPJO(targetConnect, true)) { throw new Error("param connect type error, it " + INAJ + " or string array"); } var isArr = Array.isArray(targetConnect); var finalConnect = {}; if (isArr || typeof targetConnect === 'string') { var connectedModules = isArr ? targetConnect : targetConnect.split(','); connectedModules.forEach(function (m) { finalConnect[m] = '-'; //标识自动收集观察依赖 }); } else { finalConnect = regConnect; } // 未设定连接$$global模块的watchedKeys参数时,自动连接$$global模块,并默认采用依赖收集 if (!finalConnect[MODULE_GLOBAL]) { finalConnect[MODULE_GLOBAL] = '-'; } checkConnectSpec(finalConnect); return finalConnect; } /** @typedef {import('../../types-inner').IRefCtx} ICtx */ var _ccContext$reducer = ccContext.reducer, _caller = _ccContext$reducer._caller, _module2fnNames = _ccContext$reducer._module2fnNames, _module2Ghosts = _ccContext$reducer._module2Ghosts, refStore$1 = ccContext.refStore, getModuleStateKeys$3 = ccContext.getModuleStateKeys, _ccContext$store$2 = ccContext.store, getState$4 = _ccContext$store$2.getState, getModuleVer$2 = _ccContext$store$2.getModuleVer; var noop$1 = noop; var okeys$a = okeys, me$1 = makeError, vbi$3 = verboseInfo, isObject$1 = isObject, isBool$1 = isBool, justWarning$5 = justWarning, isObjectNull$2 = isObjectNull, isValueNotNull$2 = isValueNotNull, noDupPush$1 = noDupPush; var idSeq = 0; function getEId() { idSeq += 1; return Symbol("__autoGen_" + idSeq + "__"); } var fnKey = 0; function getFnKey() { fnKey += 1; return "" + fnKey; } var eType = function eType(th) { return "type of defineEffect " + th + " param must be"; }; var getWatchedKeys = function getWatchedKeys(ctx) { if (ctx.watchedKeys === '-') { if (ctx.__$$renderStatus === START) return okeys$a(ctx.__$$compareWaKeys); return okeys$a(ctx.__$$curWaKeys); } return ctx.watchedKeys; }; var getConnectWatchedKeys = function getConnectWatchedKeys(ctx, moduleName) { var connect = ctx.connect, connectedModules = ctx.connectedModules; var isConnectArr = Array.isArray(connect); var getModuleWaKeys = function getModuleWaKeys(m) { if (ctx.__$$renderStatus === START) return okeys$a(ctx.__$$compareConnWaKeys[m]); return okeys$a(ctx.__$$curConnWaKeys[m]); }; var getWKeys = function getWKeys(moduleName) { if (isConnectArr) { // auto observe connect modules return getModuleWaKeys(moduleName); } else { var waKeys = connect[moduleName]; if (waKeys === '*') return getModuleStateKeys$3(moduleName);else if (waKeys === '-') return getModuleWaKeys(moduleName);else return waKeys; } }; if (moduleName) return getWKeys(moduleName);else { var cKeys = {}; connectedModules.forEach(function (m) { cKeys[m] = getWKeys(m); }); return cKeys; } }; function recordDep(ccUniqueKey, moduleName, watchedKeys) { var waKeys = watchedKeys === '*' ? getModuleStateKeys$3(moduleName) : watchedKeys; waKeys.forEach(function (stateKey) { return mapIns(moduleName, stateKey, ccUniqueKey); }); } function makeProxyReducer(m, dispatch, reducerFnType, ghostFnName) { if (reducerFnType === void 0) { reducerFnType = 0; } // 让绑定到组件上的mr.{xxx} 方法始终指向同一个,让 memo 优化可以生效 var name2wrapFn = {}; // 此处代理对象仅用于log时可以打印出目标模块reducer函数集合 return new Proxy(_caller[m] || {}, { get: function get(target, fnName) { var fnNames = _module2fnNames[m]; if (fnNames.includes(fnName)) { var _fnKey = m + "/" + fnName; var wrapFn = name2wrapFn[_fnKey]; if (!wrapFn) { wrapFn = function wrapFn(payload, renderKey, delay$$1) { var callerParams = { module: m, fnName: fnName, payload: payload, renderKey: renderKey, delay: delay$$1 }; if (reducerFnType === 0) return dispatch(_fnKey, payload, renderKey, delay$$1); if (reducerFnType === 1) return callerParams; if (reducerFnType === 2) { if (fnName === ghostFnName) return justWarning$5("the target fn[" + fnName + "] can't be a ghost"); return dispatch(m + "/" + ghostFnName, callerParams, renderKey, delay$$1); } }; name2wrapFn[_fnKey] = wrapFn; } return wrapFn; } else { // 可能是原型链上的其他方法或属性调用 return target[fnName]; } } }); } function bindCtxToRef(isCtxNull, ref, ctx) { if (isCtxNull) return ref.ctx = ctx; // 适配热加载或者异步渲染里, 需要清理ctx里运行时收集的相关数据,重新分配即可 // 这里需要把第一次渲染期间已经收集好的依赖再次透传给ref.ctx var _ref$ctx = ref.ctx, __$$curWaKeys = _ref$ctx.__$$curWaKeys, __$$compareWaKeys = _ref$ctx.__$$compareWaKeys, __$$compareWaKeyCount = _ref$ctx.__$$compareWaKeyCount, __$$nextCompareWaKeys = _ref$ctx.__$$nextCompareWaKeys, __$$nextCompareWaKeyCount = _ref$ctx.__$$nextCompareWaKeyCount, __$$curConnWaKeys = _ref$ctx.__$$curConnWaKeys, __$$compareConnWaKeys = _ref$ctx.__$$compareConnWaKeys, __$$compareConnWaKeyCount = _ref$ctx.__$$compareConnWaKeyCount, __$$nextCompareConnWaKeys = _ref$ctx.__$$nextCompareConnWaKeys, __$$nextCompareConnWaKeyCount = _ref$ctx.__$$nextCompareConnWaKeyCount; Object.assign(ref.ctx, ctx, { __$$curWaKeys: __$$curWaKeys, __$$compareWaKeys: __$$compareWaKeys, __$$compareWaKeyCount: __$$compareWaKeyCount, __$$nextCompareWaKeys: __$$nextCompareWaKeys, __$$nextCompareWaKeyCount: __$$nextCompareWaKeyCount, __$$curConnWaKeys: __$$curConnWaKeys, __$$compareConnWaKeys: __$$compareConnWaKeys, __$$compareConnWaKeyCount: __$$compareConnWaKeyCount, __$$nextCompareConnWaKeys: __$$nextCompareConnWaKeys, __$$nextCompareConnWaKeyCount: __$$nextCompareConnWaKeyCount }); } function bindInitStateHandler(ref, ctx, registryState, refStoredState, mstate, modStateKeys) { // allow user have a chance to define state in setup block ctx.initState = function (initialStateOrCb) { var initialState = initialStateOrCb; if (isFn(initialStateOrCb)) { initialState = initialStateOrCb(); } if (!ctx.__$$inBM) { return justWarning$5("initState must been called in setup block!"); } if (!isPJO(registryState)) { return justWarning$5("state " + INAJ); } if (ctx.__$$cuOrWaCalled) { return justWarning$5("initState must been called before computed or watch"); } var newRefState = Object.assign({}, registryState, initialState, refStoredState, mstate); // 更新stateKeys,防止遗漏新的私有stateKey ctx.stateKeys = okeys$a(newRefState); ctx.privStateKeys = removeArrElements(okeys$a(newRefState), modStateKeys); ctx.prevState = Object.assign({}, newRefState); ctx.unProxyState = newRefState; ref.state = Object.assign(ctx.state, newRefState); // 扩展私有属性后,type.d.ts里会自动计算新的fullState, // 这里直接返回ctx, 但类型文件仅描述了可解构使用的有 state、setState、computed、watch 四个属性 // 导出这四个属性可方便直接使用推导出的合并类型 return ctx; }; } function bindModApis(ref, ctx, stateModule, liteLevel, setState) { // 创建dispatch需要ref.ctx里的ccClassKey相关信息, 所以这里放在ref.ctx赋值之后在调用makeDispatchHandler var dispatch = makeDispatchHandler(ref, false, false, stateModule); ctx.dispatch = dispatch; if (liteLevel > 1) { // level 2, assign these mod data api ctx.lazyDispatch = makeDispatchHandler(ref, true, false, stateModule); ctx.silentDispatch = makeDispatchHandler(ref, false, true, stateModule); ctx.dispatchLazy = ctx.lazyDispatch; // alias of lazyDispatch ctx.dispatchSilent = ctx.silentDispatch; // alias of silentDispatch ctx.invoke = makeInvokeHandler(ref); ctx.lazyInvoke = makeInvokeHandler(ref, { isLazy: true }); ctx.silentInvoke = makeInvokeHandler(ref, { isLazy: false, isSilent: true }); ctx.invokeLazy = ctx.lazyInvoke; // alias of lazyInvoke ctx.invokeSilent = ctx.silentInvoke; // alias of silentInvoke ctx.setGlobalState = function (state, reactCallback, renderKey, delay$$1) { setState(MODULE_GLOBAL, state, SET_STATE, reactCallback, renderKey, delay$$1); }; } return dispatch; } function bindSyncApis(ref, ctx, liteLevel) { if (liteLevel > 2) { // level 3, assign async api var cachedBoundFns = {}; var doSync = function doSync(type, e, val, rkey, delay$$1) { if (typeof e === 'string') { var valType = typeof val; // now val is syncCb if (isValueNotNull$2(val) && (valType === OBJ || valType === FN)) { var _sync$bind; return __sync.bind(null, (_sync$bind = {}, _sync$bind[CCSYNC_KEY] = e, _sync$bind.type = type, _sync$bind.val = val, _sync$bind.delay = delay$$1, _sync$bind.rkey = rkey, _sync$bind), ref); } var key = e + "|" + val + "|" + rkey + "|" + delay$$1; var boundFn = cachedBoundFns[key]; if (!boundFn) { var _sync$bind2; cachedBoundFns[key] = __sync.bind(null, (_sync$bind2 = {}, _sync$bind2[CCSYNC_KEY] = e, _sync$bind2.type = type, _sync$bind2.val = val, _sync$bind2.delay = delay$$1, _sync$bind2.rkey = rkey, _sync$bind2), ref); boundFn = cachedBoundFns[key]; } return boundFn; } // case: <input data-ccsync="foo/f1" onChange={ctx.sync} /> __sync({ type: 'val' }, ref, e); }; // syncer series var makeTrap = function makeTrap(type) { return { get: function get(target, key) { if (isKeyValid(target, key)) return doSync(type, key); return noop$1; } }; }; ctx.syncer = new Proxy(ctx.state, makeTrap('val')); ctx.syncerOfBool = new Proxy(ctx.state, makeTrap('bool')); ctx.sybo = ctx.syncerOfBool; // alias of syncerOfBool // sync series ctx.sync = function (e, val, rkey, delay$$1) { if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } return doSync('val', e, val, rkey, delay$$1); }; ctx.syncBool = function (e, val, rkey, delay$$1) { if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } return doSync('bool', e, val, rkey, delay$$1); }; ctx.syncInt = function (e, val, rkey, delay$$1) { if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } return doSync('int', e, val, rkey, delay$$1); }; ctx.syncAs = function (e, val, rkey, delay$$1) { if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } return doSync('as', e, val, rkey, delay$$1); }; ctx.set = function (ccsync, val, rkey, delay$$1) { var _sync; if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } __sync((_sync = {}, _sync[CCSYNC_KEY] = ccsync, _sync.type = 'val', _sync.val = val, _sync.delay = delay$$1, _sync.rkey = rkey, _sync), ref); }; ctx.setBool = function (ccsync, rkey, delay$$1) { var _sync2; if (rkey === void 0) { rkey = ''; } if (delay$$1 === void 0) { delay$$1 = -1; } __sync((_sync2 = {}, _sync2[CCSYNC_KEY] = ccsync, _sync2.type = 'bool', _sync2.delay = delay$$1, _sync2.rkey = rkey, _sync2), ref); }; } } function bindEventApis(ctx, liteLevel, ccUniqueKey) { if (liteLevel > 3) { // level 4, assign event api ctx.emit = function (event) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } findEventHandlersToPerform.apply(ev, [getEventItem(event)].concat(args)); }; // 默认off掉当前实例对某个事件名的所有监听 ctx.off = function (event, _temp) { var _ref = _temp === void 0 ? {} : _temp, module = _ref.module, ccClassKey = _ref.ccClassKey, _ref$ccUniqueKey = _ref.ccUniqueKey, inputCcUkey = _ref$ccUniqueKey === void 0 ? ccUniqueKey : _ref$ccUniqueKey; var targetCcUkey = inputCcUkey; // 传递了 module 或者 ccClassKey的话,清理掉targetCcUkey,表示off的目标要扩大 if (module || ccClassKey) targetCcUkey = ''; // 这里刻意不为identity赋默认值,如果是undefined,表示off掉所有监听 var _ev$getEventItem = getEventItem(event), name = _ev$getEventItem.name, identity = _ev$getEventItem.identity; findEventHandlersToOff(name, { module: module, ccClassKey: ccClassKey, ccUniqueKey: targetCcUkey, identity: identity }); }; ctx.on = function (inputEvent, handler) { ctx.__$$onEvents.push({ inputEvent: inputEvent, handler: handler }); }; } } function _makeCuWaDesc(moduleName, fnKeyOrDesc, cb, cbOptions) { var newDesc = {}; var makeFnDesc$$1 = function makeFnDesc$$1(fn, cbOptions) { if (cbOptions === void 0) { cbOptions = {}; } var fnDesc = isObject(fn) ? fn : { fn: fn }; // 因为加上 / 后,cb的state类型会和模块相关了,types文件目前不方便推导含 / 的cb参数类型 // 所以types文件里不允许传递 allowSlash 标记,让用户定义的retKey包含 / 会报运行时错误 // 同时额外提供的 watchModule方法和 computedModule 方法需要用到 / 携带模块的特性 // 故需内部放过不允许key包含slash的校验,所以这里加上 allowSlash 标记 var opts = {}; if (cbOptions) opts = isObject(cbOptions) ? cbOptions : { depKeys: cbOptions }; return Object.assign({ allowSlash: true, depKeyModule: moduleName }, opts, fnDesc); }; if (typeof fnKeyOrDesc === 'string') { newDesc[moduleName + "/" + fnKeyOrDesc] = makeFnDesc$$1(cb, cbOptions); } else if (isObject(fnKeyOrDesc)) { okeys(fnKeyOrDesc).forEach(function (key) { newDesc[moduleName + "/" + key] = makeFnDesc$$1(fnKeyOrDesc[key]); }); } return newDesc; } function bindEnhanceApis(ctx, liteLevel, stateModule) { var effectItems = [], effectPropsItems = []; // {fn:function, status:0, eId:'', immediate:true} var eid2effectReturnCb = {}, eid2effectPropsReturnCb = {}; // fn ctx.effectMeta = { effectItems: effectItems, eid2effectReturnCb: eid2effectReturnCb, effectPropsItems: effectPropsItems, eid2effectPropsReturnCb: eid2effectPropsReturnCb }; if (liteLevel > 4) { // level 5, assign enhance api ctx.execute = function (handler) { return ctx.execute = handler; }; ctx.watch = getDefineWatchHandler(ctx); ctx.computed = getDefineComputedHandler(ctx); // 方便type文件定义类型时能够推导出cb的参数类型为已连接的模块状态类型 ctx.watchModule = function (moduleName, cb, cbOptions) { if (cbOptions === void 0) { cbOptions = {}; } if (isFn(cb)) { ctx.watch(_makeCuWaDesc(moduleName, getFnKey(), cb, cbOptions)); } else { ctx.watch(_makeCuWaDesc(moduleName, cb)); } }; // 方便type文件定义类型时能够推导出cb的参数类型为已连接的模块状态类型 ctx.computedModule = function (moduleName, retKey, cb, cbOptions) { return ctx.computed(_makeCuWaDesc(moduleName, retKey, cb, cbOptions)); }; var makeEffectHandler = function makeEffectHandler(targetEffectItems, isProp) { return function (fn, depKeysOrOpt, compare, immediate) { if (immediate === void 0) { immediate = true; } if (!isFn(fn)) throw new Error(eType('first') + " function"); var compareForEf = compare === undefined ? false : compare; // 对于effectProps 第三位参数就是immediate, 不传的话,默认是true var immediateForEfProp = compare === undefined ? true : compare; // depKeys 为 null 和 undefined, 表示无任何依赖,每一轮都执行的副作用 var _depKeys = depKeysOrOpt; var _compare = compareForEf; var _immediate = isProp ? immediateForEfProp : immediate; if (isObject$1(depKeysOrOpt)) { _depKeys = depKeysOrOpt.depKeys; _compare = isBool$1(depKeysOrOpt.compare) ? depKeysOrOpt.compare : compare; _immediate = isBool$1(depKeysOrOpt.immediate) ? depKeysOrOpt.immediate : immediate; } if (_depKeys !== undefined && _depKeys !== null && !Array.isArray(_depKeys)) { throw new Error(eType('second') + " array, null, or undefined"); } var modDepKeys = []; if (!isProp && _depKeys) { _depKeys.forEach(function (depKey) { var modDepKey; if (depKey.includes('/')) { modDepKey = depKey; var _depKey$split = depKey.split('/'), m = _depKey$split[0]; if (!ctx.connect[m]) { throw me$1(ERR.CC_MODULE_NOT_CONNECTED, vbi$3("depKey[" + depKey + "]")); } } else { // 这里要注意, 私有的key modDepKey = stateModule + "/" + depKey; } modDepKeys.push(modDepKey); // 先暂时保持起来,组件挂载时才映射依赖 ctx.__$$staticWaKeys[modDepKey] = 1; }); } // 对于effectProps来说是不会读取compare属性来用的 var effectItem = { fn: fn, isProp: isProp, depKeys: _depKeys, modDepKeys: modDepKeys, eId: getEId(), compare: _compare, immediate: _immediate }; targetEffectItems.push(effectItem); }; }; ctx.effect = makeEffectHandler(effectItems, false); ctx.effectProps = makeEffectHandler(effectPropsItems, true); } } function fillCtxOtherAttrs(ref, ctx, connect, watchedKeys, ccUniqueKey, stateModule, allModules, dispatch) { // 构造完毕ctx后,开始创建 reducer,和可观察 connectedState var connectedReducer = ctx.connectedReducer, connectedState = ctx.connectedState, __$$curConnWaKeys = ctx.__$$curConnWaKeys, __$$compareConnWaKeys = ctx.__$$compareConnWaKeys, __$$compareConnWaKeyCount = ctx.__$$compareConnWaKeyCount, __$$nextCompareConnWaKeys = ctx.__$$nextCompareConnWaKeys, __$$nextCompareConnWaKeyCount = ctx.__$$nextCompareConnWaKeyCount; // 实例所属模块或连接模块是否处于自动观察状态 var __$$autoWatch = false; // 向实例的reducer里绑定方法,key:{module} value:{reducerFn} // 只绑定所属的模块和已连接的模块的reducer方法 allModules.forEach(function (m) { var rd = makeProxyReducer(m, dispatch); if (m === stateModule) { ctx.moduleReducer = rd; ctx.mrc = makeProxyReducer(m, dispatch, 1); var ghosts = _module2Ghosts[m] || []; ghosts.forEach(function (ghostFnName) { ctx.mrg[ghostFnName] = makeProxyReducer(m, dispatch, 2, ghostFnName); }); if (m === MODULE_GLOBAL) connectedReducer[m] = rd; } else { connectedReducer[m] = rd; } var connectDesc = connect[m]; if (connectDesc) { var moduleState = getState$4(m); if (connectDesc === '-') { // auto watch __$$autoWatch = true; __$$curConnWaKeys[m] = {}; __$$compareConnWaKeys[m] = {}; __$$compareConnWaKeyCount[m] = 0; __$$nextCompareConnWaKeys[m] = {}; __$$nextCompareConnWaKeyCount[m] = 0; if (m === MODULE_GLOBAL) moduleState = ctx.globalState;else moduleState = makeObState(ref, moduleState, m); } else { // 非自动收集,这里就需要写入waKey2uKeyMap来记录依赖关系了 recordDep(ccUniqueKey, m, connectDesc); } connectedState[m] = moduleState; } }); ctx.reducer = _caller; ctx.globalReducer = connectedReducer[MODULE_GLOBAL]; // alias ctx.mr = ctx.moduleReducer; ctx.gr = ctx.globalReducer; ctx.cr = ctx.connectedReducer; ctx.r = ctx.reducer; if (watchedKeys === '-') { __$$autoWatch = true; } else { // 开始记录依赖 recordDep(ccUniqueKey, stateModule, watchedKeys); } ctx.__$$autoWatch = __$$autoWatch; } /** * 构建refCtx,附加到ref上 * liteLevel 越小,绑定的方法越少 */ function buildRefCtx (ref, params, liteLevel) { if (liteLevel === void 0) { liteLevel = 5; } // 能省赋默认值的就省,比如state,外层调用都保证赋值过了 var _params$ccKey = params.ccKey, ccKey = _params$ccKey === void 0 ? '' : _params$ccKey, state = params.state, id = params.id, _params$ccOption = params.ccOption, ccOption = _params$ccOption === void 0 ? {} : _params$ccOption, module = params.module, ccClassKey = params.ccClassKey, type = params.type, insType = params.insType, _params$tag = params.tag, tag = _params$tag === void 0 ? '' : _params$tag, _params$storedKeys = params.storedKeys, storedKeys = _params$storedKeys === void 0 ? [] : _params$storedKeys, _params$persistStored = params.persistStoredKeys, persistStoredKeys = _params$persistStored === void 0 ? false : _params$persistStored, _params$watchedKeys = params.watchedKeys, watchedKeys = _params$watchedKeys === void 0 ? '-' : _params$watchedKeys, _params$connect = params.connect, connect = _params$connect === void 0 ? {} : _params$connect, _params$staticExtra = params.staticExtra, staticExtra = _params$staticExtra === void 0 ? {} : _params$staticExtra; var stateModule = module; var existedCtx = ref.ctx; var isCtxNull = isObjectNull$2(existedCtx); // 做个保护判断,防止 ctx = {} var modStateKeys = getModuleStateKeys$3(stateModule); var __boundSetState = ref.setState, __boundForceUpdate = ref.forceUpdate; // 如果已存在ctx,则直接指向原来的__bound,否则会造成无限递归调用栈溢出 // 做个保护判断,防止 ctx = {} // const act = runtimeHandler.act;// for react-test-utils if (!isCtxNull && existedCtx.ccUniqueKey) { __boundSetState = existedCtx.__boundSetState; __boundForceUpdate = existedCtx.__boundForceUpdate; } else if (type !== CC_HOOK) { __boundSetState = ref.setState.bind(ref); __boundForceUpdate = ref.forceUpdate.bind(ref); } var refOption = {}; refOption.persistStoredKeys = ccOption.persistStoredKeys === undefined ? persistStoredKeys : ccOption.persistStoredKeys; refOption.tag = ccOption.tag || tag; // pick ccOption tag first, register tag second var ccUniqueKey = computeCcUniqueKey(ccClassKey, ccKey, refOption.tag); // 没有设定renderKey的话读id,最后才默认renderKey为ccUniqueKey refOption.renderKey = ccOption.renderKey || id || ccUniqueKey; refOption.storedKeys = getStoredKeys(stateModule, state, ccOption.storedKeys, storedKeys); // 用户使用ccKey属性的话,必需显示的指定ccClassKey if (ccKey && !ccClassKey) { throw new Error("missing ccClassKey while init a cc ins with ccKey[" + ccKey + "]"); } if (refOption.storedKeys.length > 0) { if (!ccKey) throw me$1(ERR.CC_STORED_KEYS_NEED_CCKEY, vbi$3("ccClassKey[" + ccClassKey + "]")); } var mstate = getState$4(module); // recover ref state var refStoredState = refStore$1._state[ccUniqueKey] || {}; var mergedState = Object.assign({}, state, refStoredState, mstate); ref.state = mergedState; var stateKeys = okeys$a(mergedState); var connectedModules = okeys$a(connect); var connectedComputed = {}; connectedModules.forEach(function (m) { connectedComputed[m] = makeCuRefObContainer(ref, m, false); }); var moduleComputed = makeCuRefObContainer(ref, module); // 所有实例都自动连接上了global模块,这里可直接取connectedComputed已做好的结果 var globalComputed = connectedComputed[MODULE_GLOBAL]; var globalState = makeObState(ref, getState$4(MODULE_GLOBAL), MODULE_GLOBAL, false); // extract privStateKeys var privStateKeys = removeArrElements(okeys$a(state), modStateKeys); var moduleState = module === MODULE_GLOBAL ? globalState : makeObState(ref, mstate, module, true); // declare cc state series api var changeState = function changeState(state, options) { startChangeRefState(state, options, ref); }; var _setState = function _setState(module, state, calledBy, reactCallback, renderKey, delay$$1) { var options = { calledBy: calledBy, module: module, reactCallback: reactCallback }; if (isObject(renderKey)) Object.assign(options, renderKey); // 丢弃delay,renderKeyAsOpt里的delay else Object.assign(options, { renderKey: renderKey, delay: delay$$1 }); changeState(state, options); }; var setModuleState = function setModuleState(module, state, reactCallback, renderKey, delay$$1) { _setState(module, state, SET_MODULE_STATE, reactCallback, renderKey, delay$$1); }; var setState = function setState(p1, p2, p3, p4, p5) { var p1Type = typeof p1; if (p1Type === 'string') { // p1: module, p2: state, p3: cb, p4: rkey, p5: delay setModuleState(p1, p2, p3, p4, p5); } else if (p1Type === 'function') { // p1: stateFn, p2: rkey, p3: delay var newState = p1(Object.assign({}, ctx.unProxyState), ctx.props); _setState(stateModule, newState, SET_STATE, p2, p3, p4); } else { // p1: state, p2: cb, p3: rkey, p4: delay _setState(stateModule, p1, SET_STATE, p2, p3, p4); } }; var forceUpdate = function forceUpdate(reactCallback, renderKey, delay$$1) { _setState(stateModule, ref.unProxyState, FORCE_UPDATE, reactCallback, renderKey, delay$$1); }; var refs = {}; var allModules = connectedModules.slice(); // 已在change-ref-state里做优化,支持组件即属于又连接同一个模块,不会照成冗余渲染, // 所以此处allModules包含了module对渲染性能无影响,不过代码的语义上会照成重复的表达 noDupPush$1(allModules, module); var props = getOutProps(ref.props); var now = Date.now(); var ctx = { // static params type: type, insType: insType, module: module, ccClassKey: ccClassKey, ccKey: ccKey, ccUniqueKey: ccUniqueKey, renderCount: 0, initTime: now, watchedKeys: watchedKeys, privStateKeys: privStateKeys, connect: connect, connectedModules: connectedModules, allModules: allModules, // dynamic meta, I don't want user know these props, so let field name start with __$$ __$$onEvents: [], // 当组件还未挂载时,将事件存到__$$onEvents里,当组件挂载时才开始真正监听事件 __$$hasModuleState: modStateKeys.length > 0, __$$renderStatus: UNSTART, __$$curWaKeys: {}, __$$compareWaKeys: {}, __$$compareWaKeyCount: 0, // write before render __$$nextCompareWaKeys: {}, __$$nextCompareWaKeyCount: 0, __$$curConnWaKeys: {}, __$$compareConnWaKeys: {}, __$$compareConnWaKeyCount: {}, __$$nextCompareConnWaKeys: {}, __$$nextCompareConnWaKeyCount: {}, __$$staticWaKeys: {}, // 用于快速的去重记录 __$$staticWaKeyList: [], // 在实例didMount时由__$$staticWaKeys计算得出,用于辅助清理依赖映射 persistStoredKeys: refOption.persistStoredKeys, storedKeys: refOption.storedKeys, renderKey: refOption.renderKey, tag: refOption.tag, prevProps: props, props: props, // collected mapProps result mapped: {}, prevState: Object.assign({}, mergedState), // state state: makeObState(ref, mergedState, stateModule, true), unProxyState: mergedState, // 没有proxy化的state moduleState: moduleState, __$$mstate: mstate, // 用于before-render里避免merge moduleState而导致的冗余触发get,此属性不暴露给用户使用,因其不具备依赖收集能力 globalState: globalState, connectedState: {}, // for function: pass value to extra in every render period // for class: pass value to extra one time extra: isObject$1(params.extra) ? params.extra : {}, // pass value to staticExtra only one time for both function and class staticExtra: staticExtra, settings: {}, /** @type ICtx['refComputedValues'] */ refComputedValues: {}, /** @type ICtx['refComputedRawValues'] */ refComputedRawValues: {}, moduleComputed: moduleComputed, globalComputed: globalComputed, connectedComputed: connectedComputed, moduleReducer: null, mrc: null, // 仅生成描述体,moduleReducerCaller /** ghost reducer map */ mrg: {}, globalReducer: null, connectedReducer: {}, reducer: {}, // api meta data stateKeys: stateKeys, /** @type ICtx['computedDep'] */ computedDep: {}, computedRetKeyFns: {}, /** @type ICtx['watchDep'] */ watchDep: {}, watchRetKeyFns: {}, // 不按模块分类,映射的 watchRetKey2fns execute: null, retKey2fnUid: {}, // api reactSetState: noop$1, // 等待重写 __boundSetState: __boundSetState, reactForceUpdate: noop$1, // 等待重写 __boundForceUpdate: __boundForceUpdate, setState: setState, setModuleState: setModuleState, forceUpdate: forceUpdate, changeState: changeState, // not expose in d.ts refs: refs, getRef: function getRef(refName) { return refs[refName] || null; }, useRef: function useRef(refName) { return function (nodeRef) { // keep the same shape with hook useRef refs[refName] = { current: nodeRef }; }; }, // below methods only can be called by cc or updated by cc in existed period, not expose in d.ts __$$ccSetState: makeCcSetStateHandler(ref), __$$ccForceUpdate: makeCcForceUpdateHandler(ref), __$$settedList: [], // [{module:string, keys:string[]}, ...] __$$prevMoStateVer: {}, __$$prevModuleVer: getModuleVer$2(stateModule), __$$cuOrWaCalled: false }; bindCtxToRef(isCtxNull, ref, ctx); ctx.refComputed = makeCuRefObContainer(ref, null, true, true); ref.setState = setState; ref.forceUpdate = forceUpdate; bindInitStateHandler(ref, ctx, state, refStoredState, mstate, modStateKeys); var dispatch = bindModApis(ref, ctx, stateModule, liteLevel, _setState); bindSyncApis(ref, ctx, liteLevel); bindEventApis(ctx, liteLevel, ccUniqueKey); bindEnhanceApis(ctx, liteLevel, stateModule); fillCtxOtherAttrs(ref, ctx, connect, watchedKeys, ccUniqueKey, stateModule, allModules, dispatch); // 始终优先取ref上指向的ctx,对于在热加载模式下的hook组件实例,那里面有的最近一次渲染收集的依赖信息才是正确的 ctx.getWatchedKeys = function () { return getWatchedKeys(ref.ctx || ctx); }; ctx.getConnectWatchedKeys = function (moduleName) { return getConnectWatchedKeys(ref.ctx || ctx, moduleName); }; } var okeys$b = okeys; /** * 根据connect,watchedKeys,以及用户提供的原始renderKeyClasses 计算 特征值 */ function getFeatureStr (belongModule, connectSpec, renderKeyClasses) { var moduleNames = okeys$b(connectSpec); moduleNames.sort(); var classesStr; if (renderKeyClasses === '*') classesStr = '*';else classesStr = renderKeyClasses.slice().join(','); return belongModule + "/" + moduleNames.join(',') + "/" + classesStr; } var isObjectNull$3 = isObjectNull, me$2 = makeError; var featureStr2classKey = ccContext.featureStr2classKey, userClassKey2featureStr = ccContext.userClassKey2featureStr, ccClassKey2Context$1 = ccContext.ccClassKey2Context; var cursor = 0; function getCcClassKey (allowNamingDispatcher, module, connect, prefix, featureStr, classKey) { if (classKey === void 0) { classKey = ''; } // 未指定classKey if (!classKey) { // 未指定所属模块,也未连接到其他模块 if (module === MODULE_DEFAULT && isObjectNull$3(connect)) { return prefix + "0"; } var prefixedFeatureStr = prefix + ":" + featureStr; var _classKey = featureStr2classKey[prefixedFeatureStr]; if (_classKey) { return _classKey; } cursor++; _classKey = "" + prefix + cursor; featureStr2classKey[prefixedFeatureStr] = _classKey; return _classKey; } // verify user input classKey if (classKey.startsWith(CC_PREFIX)) { throw new Error("user can not specify a classKey[" + classKey + "] starts with $$Cc"); } if (!allowNamingDispatcher) { if (classKey.toLowerCase() === CC_DISPATCHER.toLowerCase()) { // throw new Error(`${CC_DISPATCHER} is cc built-in ccClassKey name, if you want to customize your dispatcher, // you can set autoCreateDispatcher=false in StartupOption, and use createDispatcher then.`) // currently createDispatcher is not allowed.. throw new Error(CC_DISPATCHER + " is cc built-in ccClassKey name."); } } var clsCtx = ccClassKey2Context$1[classKey]; if (clsCtx) { var fStr = userClassKey2featureStr[classKey]; if (fStr !== featureStr) { // 不允许,特征值不一样的class指定相同的ccClassKey throw me$2(ERR.CC_CLASS_KEY_DUPLICATE, "ccClassKey:[" + classKey + "] duplicate"); } } else { userClassKey2featureStr[classKey] = featureStr; } return classKey; } function getRenderKeyClasses(ccClassKey, regRenderKeyClasses) { var _renderKeyClasses; if (!regRenderKeyClasses) { _renderKeyClasses = [ccClassKey]; } else { if (!Array.isArray(regRenderKeyClasses) && regRenderKeyClasses !== '*') { throw new Error("renderKeyClasses type err, it " + STR_ARR_OR_STAR); } _renderKeyClasses = regRenderKeyClasses; } return _renderKeyClasses; } var ccClassKey2Context$2 = ccContext.ccClassKey2Context; function checkCcStartupOrNot() { if (ccContext.isStartup !== true) { throw new Error('you must call run api to startup concent before register Class!'); } } /** * map registration info to ccContext */ function mapRegistrationInfo (module, ccClassKey, regRenderKeyClasses, classKeyPrefix, regWatchedKeys, regConnect, __checkStartUp, __calledBy) { if (module === void 0) { module = MODULE_DEFAULT; } if (__checkStartUp === true) checkCcStartupOrNot(); var allowNamingDispatcher = __calledBy === 'cc'; var renderKeyClasses = regRenderKeyClasses || []; checkModuleName(module, false, "module[" + module + "] not configured"); checkRenderKeyClasses(renderKeyClasses); var _connect = getConnect(regConnect); var _watchedKeys = getWatchedStateKeys(module, ccClassKey, regWatchedKeys); // 注意此处用户不指定renderKeyClasses时,算出来的特征值和renderKeyClasses无关 var featureStr = getFeatureStr(module, _connect, renderKeyClasses); var _ccClassKey = getCcClassKey(allowNamingDispatcher, module, _connect, classKeyPrefix, featureStr, ccClassKey); // 此处再次获得真正的renderKeyClasses var _renderKeyClasses = getRenderKeyClasses(_ccClassKey, regRenderKeyClasses); var ccClassContext = ccClassKey2Context$2[_ccClassKey]; //做一个判断,有可能是热加载调用 if (!ccClassContext) { ccClassContext = makeCcClassContext(module, _ccClassKey, _renderKeyClasses); ccClassKey2Context$2[_ccClassKey] = ccClassContext; } return { _module: module, _connect: _connect, _ccClassKey: _ccClassKey, _watchedKeys: _watchedKeys }; } function createDispatcher () { var ccClassKey = CC_DISPATCHER; mapRegistrationInfo(MODULE_DEFAULT, ccClassKey, '', CC_CLASS, [], [], false, 'cc'); var mockRef = { setState: noop, forceUpdate: noop }; buildRefCtx(mockRef, { module: MODULE_DEFAULT, ccClassKey: ccClassKey, state: {} }); ccContext.permanentDispatcher = mockRef; } var isPJO$6 = isPJO, okeys$c = okeys, isObject$2 = isObject; function checkObj(rootObj, tag) { if (!isPJO$6(rootObj)) { throw new Error(tag + " " + INAJ); } } function configStoreState(storeState) { checkObj(storeState, 'state'); delete storeState[MODULE_VOID]; delete storeState[MODULE_CC]; if (!isObject$2(storeState[MODULE_GLOBAL])) storeState[MODULE_GLOBAL] = {}; if (!isObject$2(storeState[MODULE_DEFAULT])) storeState[MODULE_DEFAULT] = {}; var moduleNames = okeys$c(storeState); var len = moduleNames.length; for (var i = 0; i < len; i++) { var moduleName = moduleNames[i]; var moduleState = storeState[moduleName]; initModuleState(moduleName, moduleState); } } /** * @param {{[moduleName:string]:{[reducerFnType:string]:function}}} rootReducer */ function configRootReducer(rootReducer, rootGhost) { checkObj(rootReducer, 'reducer'); if (!isObject$2(rootReducer[MODULE_DEFAULT])) rootReducer[MODULE_DEFAULT] = {}; if (!isObject$2(rootReducer[MODULE_GLOBAL])) rootReducer[MODULE_GLOBAL] = {}; okeys$c(rootReducer).forEach(function (m) { return initModuleReducer(m, rootReducer[m], rootGhost[m]); }); } function configRootComputed(rootComputed) { checkObj(rootComputed, 'computed'); okeys$c(rootComputed).forEach(function (m) { return initModuleComputed(m, rootComputed[m]); }); } function configRootWatch(rootWatch) { checkObj(rootWatch, 'watch'); okeys$c(rootWatch).forEach(function (m) { return initModuleWatch(m, rootWatch[m]); }); } function configRootLifecycle(rootLifecycle) { checkObj(rootLifecycle, 'lifecycle'); okeys$c(rootLifecycle).forEach(function (m) { return initModuleLifecycle(m, rootLifecycle[m]); }); } function configMiddlewares(middlewares) { if (middlewares.length > 0) { var ccMiddlewares = ccContext.middlewares; ccMiddlewares.length = 0; // 防止热加载重复多次载入middlewares middlewares.forEach(function (m) { return ccMiddlewares.push(m); }); } } function configPlugins(plugins) { if (plugins.length > 0) { var ccPlugins = ccContext.plugins; ccPlugins.length = 0; // 防止热加载重复多次载入plugins clearCbs(); // 清理掉已映射好的插件回调 var pluginNameMap = {}; plugins.forEach(function (p) { ccPlugins.push(p); if (p.install) { var pluginInfo = p.install(on); var e = new Error('plugin.install must return result:{name:string, options?:object}'); if (!pluginInfo) throw e; var pluginName = pluginInfo.name; if (!pluginName) throw e; if (pluginNameMap[pluginName]) throw new Error("pluginName[" + pluginName + "] duplicate"); pluginNameMap[pluginName] = 1; } else { throw new Error('a plugin must export install handler!'); } }); ccContext.pluginNameMap = pluginNameMap; } } /* eslint-disable camelcase */ var justWarning$6 = justWarning, me$3 = makeError, vbi$4 = verboseInfo, ss = styleStr, cl = color, logNormal$1 = logNormal; var runtimeVar$3 = ccContext.runtimeVar, ccUKey2ref$2 = ccContext.ccUKey2ref; var ccUKey2insCount = {}; function setCcInstanceRef(ccUniqueKey, ref, delayMs) { var setRef = function setRef() { ccUKey2ref$2[ccUniqueKey] = ref; }; if (ccContext.isHotReloadMode()) incCcKeyInsCount(ccUniqueKey); if (delayMs) { setTimeout(setRef, delayMs); } else { setRef(); } } function incCcKeyInsCount(ccUniqueKey) { safeAdd(ccUKey2insCount, ccUniqueKey, 1); } function decCcKeyInsCount(ccUniqueKey) { safeMinus(ccUKey2insCount, ccUniqueKey, 1); } function getCcKeyInsCount(ccUniqueKey) { return ccUKey2insCount[ccUniqueKey] || 0; } function clearCount() { ccUKey2insCount = {}; } function setRef (ref) { var _ref$ctx = ref.ctx, ccClassKey = _ref$ctx.ccClassKey, ccKey = _ref$ctx.ccKey, ccUniqueKey = _ref$ctx.ccUniqueKey; if (runtimeVar$3.isDebug) { logNormal$1(ss("register ccKey " + ccUniqueKey + " to CC_CONTEXT"), cl()); } var isHot = ccContext.isHotReloadMode(); if (ccUKey2ref$2[ccUniqueKey]) { var dupErr = function dupErr() { throw me$3(ERR.CC_CLASS_INSTANCE_KEY_DUPLICATE, vbi$4("ccClass:" + ccClassKey + ",ccKey:" + ccKey)); }; if (isHot) { // get existed ins count var insCount = getCcKeyInsCount(ccUniqueKey); if (insCount > 1) { // now cc can make sure the ccKey duplicate dupErr(); } // just warning justWarning$6("\n found ccKey[" + ccKey + "] duplicated in hot reload mode, please make sure your ccKey is unique manually,\n " + vbi$4("ccClassKey:" + ccClassKey + " ccKey:" + ccKey + " ccUniqueKey:" + ccUniqueKey) + "\n "); // in webpack hot reload mode, cc works not very well, // cc can't set ref immediately, because the ccInstance of ccKey will ummount right now in unmount func, // cc call unsetCcInstanceRef will lost the right ref in CC_CONTEXT.refs // so cc set ref later setCcInstanceRef(ccUniqueKey, ref, 600); } else { dupErr(); } } else { setCcInstanceRef(ccUniqueKey, ref); } } /* eslint-disable camelcase */ var justCalledByStartUp = false; function _clearInsAssociation(recomputed, otherExcludeKeys) { if (recomputed === void 0) { recomputed = false; } clearCuRefer(); clearCount(); clearObject(ccContext.event2handlers); clearObject(ccContext.ccUKey2handlerKeys); var ccUKey2ref = ccContext.ccUKey2ref; clearObject(ccContext.handlerKey2handler); clearObject(ccUKey2ref, otherExcludeKeys); // 此处故意设置和原来的版本相差几位的数字, // 防止resetClassInsUI调用时类组件实例的版本和模块是相同的 // 导致ui更新未同步到store最新数据 var _ccContext$store = ccContext.store, getModuleVer = _ccContext$store.getModuleVer, incModuleVer = _ccContext$store.incModuleVer, replaceMV = _ccContext$store.replaceMV; var moduleVer = getModuleVer(); okeys(moduleVer).forEach(function (m) { var curVer = moduleVer[m]; incModuleVer(m, curVer > 5 ? 1 : 6); }); // 用于还原_moduleVer,在resetClassInsUI回调里_moduleVer又变为了 所有的模块版本值为1的奇怪现象. // 全局有没有找到重置_moduleVer的地方. var lockedMV = JSON.parse(JSON.stringify(moduleVer)); if (recomputed) { var computed = ccContext.computed, watch = ccContext.watch; var computedValue = computed._computedValues; var watchDep = watch._watchDep; var modules = okeys(ccContext.store._state); modules.forEach(function (m) { if (m === MODULE_CC) return; if (computedValue[m]) { // !!!先清除之前建立好的依赖关系 ccContext.computed._computedDep[m] = makeCuDepDesc(); initModuleComputed(m, computed._computedRaw[m]); } if (watchDep[m]) { // !!!先清除之前建立好的依赖关系 watchDep[m] = makeCuDepDesc(); initModuleWatch(m, watch._watchRaw[m]); } }); } // resetClassInsUI return function () { // 安排在下一个循环自我刷新 setTimeout(function () { replaceMV(lockedMV); otherExcludeKeys.forEach(function (key) { var ref = ccUKey2ref[key]; ref && ref.ctx.reactForceUpdate(); }); }, 0); }; } function _pickNonCustomizeIns() { var ccUKey2ref = ccContext.ccUKey2ref; var ccFragKeys = []; var ccClassInsKeys = []; okeys(ccUKey2ref).forEach(function (refKey) { var ref = ccUKey2ref[refKey]; if (ref && ref.__$$ms === MOUNTED) { var type = ref.ctx.type; if (type === CC_CLASS) ccClassInsKeys.push(refKey); } }); return { ccFragKeys: ccFragKeys, ccClassInsKeys: ccClassInsKeys }; } function _clearAll() { clearObject(ccContext.globalStateKeys); // 在codesandbox里,按标准模式组织的代码,如果只是修改了runConcent里相关联的代码,pages目录下的configure调用不会被再次触发的 // 所以是来自configure调用配置的模块则不参与清理,防止报错 var toExcludedModules = okeys(ccContext.moduleName2isConfigured).concat([MODULE_DEFAULT, MODULE_CC, MODULE_GLOBAL, MODULE_CC_ROUTER]); clearObject(ccContext.reducer._reducer, toExcludedModules); clearObject(ccContext.store._state, toExcludedModules, {}, true); clearObject(ccContext.computed._computedDep, toExcludedModules); clearObject(ccContext.computed._computedValues, toExcludedModules); clearObject(ccContext.watch._watchDep, toExcludedModules); clearObject(ccContext.middlewares); // class组件实例的依赖要保留,因为它的ref不再被清除(不像function组件那样能在热重载期间能够再次触发unmount和mount) var waKey2uKeyMap = ccContext.waKey2uKeyMap; okeys(waKey2uKeyMap).forEach(function (waKey) { var uKeyMap = waKey2uKeyMap[waKey]; var newUKeyMap = {}; okeys(uKeyMap).forEach(function (uKey) { if (uKey.startsWith(CC_CLASS)) { newUKeyMap[uKey] = uKeyMap[uKey]; } }); waKey2uKeyMap[waKey] = newUKeyMap; }); clearObject(ccContext.lifecycle._mountedOnce); clearObject(ccContext.lifecycle._willUnmountOnce); clearObject(ccContext.module2insCount, [], 0); clearCachedData(); var _pickNonCustomizeIns2 = _pickNonCustomizeIns(), ccClassInsKeys = _pickNonCustomizeIns2.ccClassInsKeys; return _clearInsAssociation(false, ccClassInsKeys); } function clearContextIfHot (clearAll) { if (clearAll === void 0) { clearAll = false; } ccContext.info.latestStartupTime = Date.now(); // 热加载模式下,这些CcFragIns随后需要被恢复 // let ccFragKeys = []; if (ccContext.isStartup) { if (ccContext.isHotReloadMode()) { if (clearAll) { if (ccContext.runtimeVar.log) console.warn("attention: make sure [[clearContextIfHot]] been called before app rendered!"); justCalledByStartUp = true; return _clearAll(); // return ccFragKeys; } else { // 如果刚刚被startup调用,则随后的调用只是把justCalledByStartUp标记为false // 因为在stackblitz的 hot reload 模式下,当用户将启动cc的命令单独放置在一个脚本里, // 如果用户修改了启动相关文件, 则会触发 runConcent renderApp, // runConcent调用清理把justCalledByStartUp置为true,则renderApp这里再次触发clear时就可以不用执行了(注意确保renderApp之前,调用了clearContextIfHot) // 而随后只是改了某个component文件时,则只会触发 renderApp, // 因为之前已把justCalledByStartUp置为false,则有机会清理实例相关上下文了 if (justCalledByStartUp) { justCalledByStartUp = false; return noop; } var ret = _pickNonCustomizeIns(); // !!!重计算各个模块的computed结果 return _clearInsAssociation(ccContext.reComputed, ret.ccClassInsKeys); } } else { console.warn("clear failed because of not running under hot reload mode!"); return noop; } } else { // 还没有启动过,泽只是标记justCalledByStartUp为true justCalledByStartUp = true; return noop; } } var justTip$1 = justTip, bindToWindow$1 = bindToWindow, getErrStackKeywordLoc$1 = getErrStackKeywordLoc; var cachedLocation = ''; function checkStartup(err) { var info = ccContext.info; var curLocation = getErrStackKeywordLoc$1(err, 'startup', 2); // 向下2句找触发run的文件 if (!curLocation) curLocation = getErrStackKeywordLoc$1(err, 'runConcent', 0); var letRunOk = function letRunOk() { ccContext.isHot = true; return clearContextIfHot(true); }; var now = Date.now(); var resetClassInsUI = function resetClassInsUI() {}, canStartup = true; if (!cachedLocation) { cachedLocation = curLocation; info.firstStartupTime = now; info.latestStartupTime = now; } else if (cachedLocation !== curLocation) { var tip = "run can only been called one time, try refresh browser to avoid this error"; if (now - info.latestStartupTime < 1000) { throw new Error(tip); } if (isOnlineEditor()) { resetClassInsUI = letRunOk(); cachedLocation = curLocation; } else { strictWarning(tip); canStartup = false; } } else { resetClassInsUI = letRunOk(); } return { canStartup: canStartup, resetClassInsUI: resetClassInsUI }; } function startup (_temp, _temp2) { var _ref = _temp === void 0 ? {} : _temp, _ref$store = _ref.store, store = _ref$store === void 0 ? {} : _ref$store, _ref$reducer = _ref.reducer, reducer = _ref$reducer === void 0 ? {} : _ref$reducer, _ref$ghost = _ref.ghost, ghost = _ref$ghost === void 0 ? {} : _ref$ghost, _ref$computed = _ref.computed, computed = _ref$computed === void 0 ? {} : _ref$computed, _ref$watch = _ref.watch, watch = _ref$watch === void 0 ? {} : _ref$watch, _ref$lifecycle = _ref.lifecycle, lifecycle = _ref$lifecycle === void 0 ? {} : _ref$lifecycle; var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$plugins = _ref2.plugins, plugins = _ref2$plugins === void 0 ? [] : _ref2$plugins, _ref2$middlewares = _ref2.middlewares, middlewares = _ref2$middlewares === void 0 ? [] : _ref2$middlewares, _ref2$isStrict = _ref2.isStrict, isStrict = _ref2$isStrict === void 0 ? false : _ref2$isStrict, _ref2$isDebug = _ref2.isDebug, isDebug = _ref2$isDebug === void 0 ? false : _ref2$isDebug, _ref2$log = _ref2.log, log = _ref2$log === void 0 ? true : _ref2$log, _ref2$logVersion = _ref2.logVersion, logVersion = _ref2$logVersion === void 0 ? true : _ref2$logVersion, _ref2$errorHandler = _ref2.errorHandler, errorHandler = _ref2$errorHandler === void 0 ? null : _ref2$errorHandler, _ref2$warningHandler = _ref2.warningHandler, warningHandler = _ref2$warningHandler === void 0 ? null : _ref2$warningHandler, _ref2$unsafe_moveRedu = _ref2.unsafe_moveReducerErrToErrorHandler, unsafe_moveReducerErrToErrorHandler = _ref2$unsafe_moveRedu === void 0 ? false : _ref2$unsafe_moveRedu, isHot = _ref2.isHot, _ref2$alwaysRenderCal = _ref2.alwaysRenderCaller, alwaysRenderCaller = _ref2$alwaysRenderCal === void 0 ? true : _ref2$alwaysRenderCal, _ref2$bindCtxToMethod = _ref2.bindCtxToMethod, bindCtxToMethod = _ref2$bindCtxToMethod === void 0 ? false : _ref2$bindCtxToMethod, _ref2$computedCompare = _ref2.computedCompare, computedCompare = _ref2$computedCompare === void 0 ? false : _ref2$computedCompare, _ref2$watchCompare = _ref2.watchCompare, watchCompare = _ref2$watchCompare === void 0 ? false : _ref2$watchCompare, _ref2$watchImmediate = _ref2.watchImmediate, watchImmediate = _ref2$watchImmediate === void 0 ? false : _ref2$watchImmediate, _ref2$reComputed = _ref2.reComputed, reComputed = _ref2$reComputed === void 0 ? true : _ref2$reComputed, _ref2$extractModuleCh = _ref2.extractModuleChangedState, extractModuleChangedState = _ref2$extractModuleCh === void 0 ? true : _ref2$extractModuleCh, _ref2$extractRefChang = _ref2.extractRefChangedState, extractRefChangedState = _ref2$extractRefChang === void 0 ? false : _ref2$extractRefChang, _ref2$objectValueComp = _ref2.objectValueCompare, objectValueCompare = _ref2$objectValueComp === void 0 ? false : _ref2$objectValueComp, _ref2$nonObjectValueC = _ref2.nonObjectValueCompare, nonObjectValueCompare = _ref2$nonObjectValueC === void 0 ? true : _ref2$nonObjectValueC, _ref2$localStorage = _ref2.localStorage, localStorage = _ref2$localStorage === void 0 ? null : _ref2$localStorage, _ref2$act = _ref2.act, act = _ref2$act === void 0 ? null : _ref2$act, _ref2$asyncCuKeys = _ref2.asyncCuKeys, asyncCuKeys = _ref2$asyncCuKeys === void 0 ? null : _ref2$asyncCuKeys; try { throw new Error(); } catch (err) { var _checkStartup = checkStartup(err), canStartup = _checkStartup.canStartup, resetClassInsUI = _checkStartup.resetClassInsUI; if (!canStartup) { return; } try { var rv = ccContext.runtimeVar; var rh = ccContext.runtimeHandler; rv.log = log; if (logVersion) justTip$1("concent version " + ccContext.info.version); if (isHot !== undefined) ccContext.isHot = isHot; ccContext.reComputed = reComputed; rh.errorHandler = errorHandler; rh.warningHandler = warningHandler; rh.act = act; rv.asyncCuKeys = asyncCuKeys || []; rv.alwaysRenderCaller = alwaysRenderCaller; rv.isStrict = isStrict; rv.isDebug = isDebug; rv.unsafe_moveReducerErrToErrorHandler = unsafe_moveReducerErrToErrorHandler; rv.computedCompare = computedCompare; rv.watchCompare = watchCompare; rv.watchImmediate = watchImmediate; rv.extractModuleChangedState = extractModuleChangedState; rv.extractRefChangedState = extractRefChangedState; rv.objectValueCompare = objectValueCompare; rv.nonObjectValueCompare = nonObjectValueCompare; rv.bindCtxToMethod = bindCtxToMethod; if (localStorage) { ccContext.localStorage = localStorage; } else if (window && window.localStorage) { ccContext.localStorage = window.localStorage; } ccContext.recoverRefState(); createDispatcher(); configStoreState(store); configRootReducer(reducer, ghost); configRootComputed(computed); configRootWatch(watch); configRootLifecycle(lifecycle); configMiddlewares(middlewares); var bindOthers = function bindOthers(bindTarget) { bindToWindow$1('CC_CONTEXT', ccContext, bindTarget); bindToWindow$1('ccc', ccContext, bindTarget); bindToWindow$1('cccc', ccContext.computed._computedValues, bindTarget); bindToWindow$1('sss', ccContext.store._state, bindTarget); }; if (window && window.mcc) { setTimeout(function () { // 延迟绑定,等待ccns的输入 bindOthers(window.mcc[getCcNamespace()]); }, 1200); } else { bindOthers(); } ccContext.isStartup = true; // 置为已启动后,才开始配置plugins,因为plugins需要注册自己的模块,而注册模块又必需是启动后才能注册 configPlugins(plugins); resetClassInsUI(); } catch (err) { ccContext.runtimeHandler.tryHandleError(err); } } } /** @typedef {import('../types').ModuleConfig} ModuleConfig */ var isPJO$7 = isPJO, okeys$d = okeys, evalState$2 = evalState, isFn$2 = isFn; var pError = function pError(label) { throw new Error("[[run]]: param error, " + label + " " + INAJ); }; /** * run will call startup * @param {{ [moduleName:string]: ModuleConfig }} store * @param {import('../types').RunOptions} options */ function _run (store, options) { if (store === void 0) { store = {}; } if (options === void 0) { options = {}; } if (!isPJO$7(store)) pError('store'); if (!isPJO$7(options)) pError('options'); var storeConf = { store: {}, reducer: {}, ghost: {}, watch: {}, computed: {}, lifecycle: {} }; var buildStoreConf = function buildStoreConf(m, moduleConf) { var state = moduleConf.state, reducer = moduleConf.reducer, watch = moduleConf.watch, computed = moduleConf.computed, _moduleConf$ghosts = moduleConf.ghosts, ghosts = _moduleConf$ghosts === void 0 ? [] : _moduleConf$ghosts; if (storeConf.store[m]) { throw new Error("run api error: module[" + m + "] duplicate"); } storeConf.store[m] = evalState$2(state); if (isFn$2(state)) ccContext.moduleName2stateFn[m] = state; storeConf.reducer[m] = reducer; storeConf.ghost[m] = ghosts; storeConf.watch[m] = watch; storeConf.computed[m] = computed; storeConf.lifecycle[m] = getLifecycle(moduleConf); }; // traversal moduleNames okeys$d(store).forEach(function (m) { return buildStoreConf(m, store[m]); }); // these modules pushed by configure api before calling run pendingModules.forEach(function (_ref) { var module = _ref.module, config = _ref.config; // user put this module to run api 1th models param again, here just ignore this one if (storeConf.store[module]) return; // configure pending module buildStoreConf(module, config); }); pendingModules.length = 0; // clear pending modules startup(storeConf, options); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } var getState$5 = ccContext.store.getState; /** 由首次render触发, 在beforeMount里调用 */ function triggerComputedAndWatch (ref) { var ctx = ref.ctx; // 取原始对象,防止computeValueForRef里用Object.assign触发依赖收集 var hasComputedFn = ctx.hasComputedFn, hasWatchFn = ctx.hasWatchFn, connectedModules = ctx.connectedModules, refModule = ctx.module, unProxyState = ctx.unProxyState; var callInfo = makeCallInfo(refModule); var cuOrWatch = function cuOrWatch(op) { op(ref, refModule, unProxyState, unProxyState, callInfo, true); connectedModules.forEach(function (m) { var mState = getState$5(m); var tmpCallInfo = makeCallInfo(m); op(ref, m, mState, mState, tmpCallInfo, true); }); }; if (hasComputedFn) cuOrWatch(computeValueForRef); if (hasWatchFn) cuOrWatch(watchKeyForRef); } /** @typedef {import('../../types-inner').IRef} IRef */ var okeys$e = okeys, makeCuDepDesc$1 = makeCuDepDesc, isFn$3 = isFn; var runtimeVar$4 = ccContext.runtimeVar; /** * @param {IRef} ref * @param {Function} setup * @param {boolean} bindCtxToMethod * @param {MultiComputed | MultiComputedFn} cuDesc */ function beforeMount (ref, setup, bindCtxToMethod, cuDesc) { var ctx = ref.ctx; ref.__$$ms = NOT_MOUNT; // flag ref is at before mount step ctx.__$$inBM = true; // 先调用setup,setup可能会定义computed,watch,同时也可能调用ctx.reducer,所以setup放在fill reducer之后 if (setup) { var tip = 'type of setup'; if (!isFn$3(setup)) throw new Error(tip + " " + INAF); var settingsObj = setup(ctx) || {}; if (!isPJO(settingsObj)) throw new Error(tip + " return result " + INAJ); // 优先读自己的,再读全局的 if (bindCtxToMethod === true || runtimeVar$4.bindCtxToMethod === true && bindCtxToMethod !== false) { okeys$e(settingsObj).forEach(function (name) { var settingValue = settingsObj[name]; if (isFn$3(settingValue)) settingsObj[name] = settingValue.bind(ref, ctx); }); } Object.assign(ctx.settings, settingsObj); } // v2.13.1+ 支持外部传入refComputed函数定义 if (cuDesc) ctx.computed(cuDesc); // !!! 把拦截了setter getter的计算结果容器赋值给refComputed // 这一波必需在setup调用之后做,因为setup里会调用ctx.computed写入 computedRetKeyFns 等元数据 ctx.refComputedValues = makeCuRetContainer(ctx.computedRetKeyFns, ctx.refComputedRawValues); // 所有的组件都会自动连接到$$global模块,但是有可能没有使用$$global模块数据做过任何实例计算 // 这里需要补齐computedDep.$$global 和 watchDep.$$global 的依赖描述数据 // 防止后续逻辑里出错 var computedDep = ctx.computedDep, watchDep = ctx.watchDep; if (!computedDep[MODULE_GLOBAL]) { computedDep[MODULE_GLOBAL] = makeCuDepDesc$1(); } if (!watchDep[MODULE_GLOBAL]) { watchDep[MODULE_GLOBAL] = makeCuDepDesc$1(); } triggerComputedAndWatch(ref); ctx.__$$inBM = false; } var moduleName2stateKeys$2 = ccContext.moduleName2stateKeys, _ccContext$store$3 = ccContext.store, getPrevState$1 = _ccContext$store$3.getPrevState, getState$6 = _ccContext$store$3.getState, getStateVer$1 = _ccContext$store$3.getStateVer; var warn = function warn(key, frag) { return justWarning("effect: key[" + key + "] is invalid, its " + frag + " has not been declared in' store!"); }; function mapSettedList(settedList) { return settedList.reduce(function (map, _ref) { var module = _ref.module, keys = _ref.keys; keys.forEach(function (key) { return map[module + "/" + key] = 1; }); return map; }, {}); } function triggerSetupEffect (ref, callByDidMount) { var ctx = ref.ctx; var _ctx$effectMeta = ctx.effectMeta, effectItems = _ctx$effectMeta.effectItems, eid2effectReturnCb = _ctx$effectMeta.eid2effectReturnCb, effectPropsItems = _ctx$effectMeta.effectPropsItems, eid2effectPropsReturnCb = _ctx$effectMeta.eid2effectPropsReturnCb; var __$$prevMoStateVer = ctx.__$$prevMoStateVer, __$$settedList = ctx.__$$settedList, refModule = ctx.module; var makeItemHandler = function makeItemHandler(eid2cleanCb, isFirstCall, needJudgeImmediate) { return function (item) { var fn = item.fn, eId = item.eId, immediate = item.immediate; if (needJudgeImmediate) { if (immediate === false) return; } var prevCb = eid2cleanCb[eId]; if (prevCb) prevCb(ctx); // let ctx.effect have the totally same behavior with useEffect var cb = fn(ctx, isFirstCall); eid2cleanCb[eId] = cb; //不管有没有返回,都要覆盖之前的结果 }; }; if (callByDidMount) { // flag isFirstCall as true effectItems.forEach(makeItemHandler(eid2effectReturnCb, true, true)); effectPropsItems.forEach(makeItemHandler(eid2effectPropsReturnCb, true, true)); return; } // callByDidUpdate // start handle effect meta data of state keys var prevState = ctx.prevState; var curState = ctx.unProxyState; var toBeExecutedFns = []; effectItems.forEach(function (item) { // const { status, depKeys, fn, eId } = item; // if (status === EFFECT_STOPPED) return; // todo, 优化为effectDep模式, 利用differStateKeys去命中执行函数 var modDepKeys = item.modDepKeys, depKeys = item.depKeys, compare = item.compare, fn = item.fn, eId = item.eId; if (!depKeys) { return toBeExecutedFns.push({ fn: fn, eId: eId }); } var keysLen = modDepKeys.length; if (keysLen === 0) return; var mappedSettedKey = mapSettedList(__$$settedList); var shouldEffectExecute = false; for (var i = 0; i < keysLen; i++) { var key = modDepKeys[i]; var _key$split = key.split('/'), module = _key$split[0], unmoduledKey = _key$split[1]; var targetCurState = void 0, targetPrevState = void 0; if (module !== refModule) { var _prevState = getPrevState$1(module); var moduleStateVer = getStateVer$1(module); if (__$$prevMoStateVer[unmoduledKey] === moduleStateVer[unmoduledKey]) { continue; } else { __$$prevMoStateVer[unmoduledKey] = moduleStateVer[unmoduledKey]; } if (!_prevState) { warn(key, "module[" + module + "]"); continue; } if (!moduleName2stateKeys$2[module].includes(unmoduledKey)) { warn(key, "unmoduledKey[" + unmoduledKey + "]"); continue; } targetCurState = getState$6(module); targetPrevState = _prevState; } else { targetCurState = curState; targetPrevState = prevState; } var isValChanged = targetPrevState[unmoduledKey] !== targetCurState[unmoduledKey]; if (isValChanged) { shouldEffectExecute = true; } else { // compare为true看有没有发生变化(object类型值不走immutable写法的话,这里是false,所以compare值默认是false) // 为false则看是不是setted shouldEffectExecute = compare ? isValChanged : mappedSettedKey[key]; } if (shouldEffectExecute) { break; } } if (shouldEffectExecute) { toBeExecutedFns.push({ fn: fn, eId: eId }); } }); // flag isFirstCall as false, start to run state effect fns toBeExecutedFns.forEach(makeItemHandler(eid2effectReturnCb, false, false)); // start handle effect meta data of props keys var prevProps = ctx.prevProps; var curProps = ctx.props; var toBeExecutedPropFns = []; effectPropsItems.forEach(function (item) { var depKeys = item.depKeys, fn = item.fn, eId = item.eId; if (!depKeys) { return toBeExecutedPropFns.push({ fn: fn, eId: eId }); } var keysLen = depKeys.length; var shouldEffectExecute = false; for (var i = 0; i < keysLen; i++) { var key = depKeys[i]; if (prevProps[key] !== curProps[key]) { shouldEffectExecute = true; break; } } if (shouldEffectExecute) toBeExecutedPropFns.push({ fn: fn, eId: eId }); }); // flag isFirstCall as false, start to run prop effect fns toBeExecutedPropFns.forEach(makeItemHandler(eid2effectPropsReturnCb, false, false)); // clear settedList __$$settedList.length = 0; } // cur: {} compare: {a:2, b:2, c:2} compareCount=3 nextCompare:{} // // rendering input // cur: {a:'val', c:'val', d:'val'} // // after render // cur: {a:1, c:1, c:1} compare: {a:1, b:2, c:1, d:1} nextCompare:{a:2, c:2, d:2} // // then concent will know b should delete dep because=0, // compare key count=4>3 or compare include 2, so should let cache expire // // before next render // cur: {} compare: {a:2, c:2, d:2} compareCount=3 nextCompare:{} /** 删除依赖 */ function delDep(compareWaKeys, compareWaKeyCount, module, ccUniqueKey) { var waKeys = okeys(compareWaKeys); var waKeyKen = waKeys.length; if (waKeyKen === 0) return; var shouldLetCacheExpire = false; waKeys.forEach(function (waKey) { // no module prefix if (compareWaKeys[waKey] === 2) { // 这个key在这轮渲染结束后没有命中,说明视图不再对它有依赖 shouldLetCacheExpire = true; delIns(module, waKey, ccUniqueKey); } }); if (waKeys.length > compareWaKeyCount) { // 大于最初记录的key数量,有新增 shouldLetCacheExpire = true; } // let find result cache expire if (shouldLetCacheExpire) { createModuleNode(module); } } function afterRender (ref) { var ctx = ref.ctx; ctx.__$$renderStatus = END; var refModule = ctx.module, connectedModules = ctx.connectedModules, connect = ctx.connect, ccUniqueKey = ctx.ccUniqueKey, __$$compareWaKeys = ctx.__$$compareWaKeys, __$$compareWaKeyCount = ctx.__$$compareWaKeyCount, __$$compareConnWaKeys = ctx.__$$compareConnWaKeys, __$$compareConnWaKeyCount = ctx.__$$compareConnWaKeyCount; // if ref is autoWatch status, should del belong module dep dynamically after every render period if (ctx.__$$autoWatch) { delDep(__$$compareWaKeys, __$$compareWaKeyCount, refModule, ccUniqueKey); } connectedModules.forEach(function (m) { // if ref is autoWatch status, should del connected module dep dynamically after every render period if (connect[m] === '-') { var _$$compareWaKeys = __$$compareConnWaKeys[m]; var _$$compareWaKeyCount = __$$compareConnWaKeyCount[m]; delDep(_$$compareWaKeys, _$$compareWaKeyCount, m, ccUniqueKey); } }); } var _lifecycle$1 = lifecycle._lifecycle, _mountedOnce = lifecycle._mountedOnce; var getModuleVer$3 = ccContext.store.getModuleVer; function triggerLifecyleMounted(allModules, mstate) { var handleOneModule = function handleOneModule(m) { safeAdd(module2insCount, m, 1); var moduleLifecycle = _lifecycle$1[m]; if (!moduleLifecycle) return; var mounted = moduleLifecycle.mounted; if (!mounted) return; if (_mountedOnce[m] === true) return; if (module2insCount[m] == 1) { var once = mounted(makeModuleDispatcher(m), mstate); _mountedOnce[m] = getVal(once, true); } }; allModules.forEach(handleOneModule); } function didMount (ref) { afterRender(ref); ref.__$$ms = MOUNTED; var _ref$ctx = ref.ctx, ccUniqueKey = _ref$ctx.ccUniqueKey, __$$onEvents = _ref$ctx.__$$onEvents, __$$staticWaKeys = _ref$ctx.__$$staticWaKeys, module = _ref$ctx.module, allModules = _ref$ctx.allModules, __$$mstate = _ref$ctx.__$$mstate, __$$prevModuleVer = _ref$ctx.__$$prevModuleVer; setRef(ref); // 确保组件挂载时在绑定事件,以避免同一个组件(通常是function组件, 因为cursor问题), // 走了 (1)mount ---> (2)mount ---> (1)unmount 时把2本来也要监听的事件清理掉 // 同时本身来说,挂载好的组件监听事件才是安全的 if (__$$onEvents.length > 0) { __$$onEvents.forEach(function (_ref) { var inputEvent = _ref.inputEvent, handler = _ref.handler; var _ev$getEventItem = getEventItem(inputEvent), event = _ev$getEventItem.name, identity = _ev$getEventItem.identity; bindEventHandlerToCcContext(module, ref.ctx.ccClassKey, ccUniqueKey, event, identity, handler); }); __$$onEvents.length = 0; } var __$$staticWaKeyList = okeys(__$$staticWaKeys); // 用于辅助记录依赖映射 ref.ctx.__$$staticWaKeyList = __$$staticWaKeyList; // 记录静态依赖 __$$staticWaKeyList.forEach(function (modStateKey) { return mapStaticInsM(modStateKey, ccUniqueKey); }); triggerSetupEffect(ref, true); triggerLifecyleMounted(allModules, __$$mstate); // 组件的didMount触发会在lifecycle.initState调用之后,此处版本可能已落后,需要自我刷新一下 if (__$$prevModuleVer !== getModuleVer$3(module)) { ref.ctx.reactForceUpdate(); } } function didUpdate (ref) { afterRender(ref); triggerSetupEffect(ref); //!!! 将最新的state记录为prevState,方便下一轮渲染完毕执行triggerSetupEffect时做比较用 //注意一定是先调用triggerSetupEffect,再赋值 ref.ctx.prevState = ref.ctx.unProxyState; } var ccUKey2ref$3 = ccContext.ccUKey2ref, ccUKey2handlerKeys$1 = ccContext.ccUKey2handlerKeys, runtimeVar$5 = ccContext.runtimeVar, handlerKey2handler$1 = ccContext.handlerKey2handler; function unsetRef (ccUniqueKey) { if (runtimeVar$5.isDebug) { logNormal(styleStr(ccUniqueKey + " unset ref"), color('purple')); } delete ccUKey2ref$3[ccUniqueKey]; if (ccContext.isHotReloadMode()) decCcKeyInsCount(ccUniqueKey); var handlerKeys = ccUKey2handlerKeys$1[ccUniqueKey]; if (handlerKeys) { handlerKeys.forEach(function (hKey) { delete handlerKey2handler$1[hKey]; }); } } var _lifecycle$2 = lifecycle._lifecycle, _willUnmountOnce = lifecycle._willUnmountOnce; function executeClearCb(cbMap, ctx) { var execute = function execute(key) { // symbolKey or normalKey var cb = cbMap[key]; if (isFn(cb)) cb(ctx); }; Object.getOwnPropertySymbols(cbMap).forEach(execute); okeys(cbMap).forEach(execute); } function triggerLifecycleWillUnmount(allModules, mstate) { var handleOneModule = function handleOneModule(m) { module2insCount[m] -= 1; var moduleLifecycle = _lifecycle$2[m]; if (!moduleLifecycle) return; var willUnmount = moduleLifecycle.willUnmount; if (!willUnmount) return; if (_willUnmountOnce[m] === true) return; if (module2insCount[m] === 0) { var once = willUnmount(makeModuleDispatcher(m), mstate); _willUnmountOnce[m] = getVal(once, true); } }; allModules.forEach(handleOneModule); } function beforeUnmount (ref) { // 标记一下已卸载,防止组件卸载后,某个地方有异步的任务拿到了该组件的引用,然后执行setState,导致 // Warning: Can't perform a React state update on an unmounted component. This is a no-op ...... var curMs = ref.__$$ms; ref.__$$ms = UNMOUNTED; var ctx = ref.ctx; var ccUniqueKey = ctx.ccUniqueKey, module = ctx.module, allModules = ctx.allModules, __$$staticWaKeyList = ctx.__$$staticWaKeyList, __$$mstate = ctx.__$$mstate; // 正常情况下只有挂载了组件才会有effect等相关定义 if (curMs === MOUNTED) { var _ctx$effectMeta = ctx.effectMeta, eid2effectReturnCb = _ctx$effectMeta.eid2effectReturnCb, eid2effectPropsReturnCb = _ctx$effectMeta.eid2effectPropsReturnCb; executeClearCb(eid2effectReturnCb, ctx); executeClearCb(eid2effectPropsReturnCb, ctx); offEventHandlersByCcUniqueKey(ccUniqueKey); } // 删除记录的动态依赖 var waKeys = ctx.getWatchedKeys(); // no module prefix waKeys.forEach(function (k) { return delIns(module, k, ccUniqueKey); }); var connWaKeys = ctx.getConnectWatchedKeys(); okeys(connWaKeys).map(function (m) { var waKeys = connWaKeys[m]; waKeys.forEach(function (k) { return delIns(m, k, ccUniqueKey); }); }); // 删除记录的静态依赖 __$$staticWaKeyList.forEach(function (modStateKey) { return delStaticInsM(modStateKey, ccUniqueKey); }); // let findUpdateRefs cache expire allModules.forEach(createModuleNode); unsetRef(ccUniqueKey); triggerLifecycleWillUnmount(allModules, __$$mstate); } /** eslint-disable */ function beforeRender (ref, mapProps) { var ctx = ref.ctx; ctx.renderCount += 1; // 类组件this.reactSetState调用后生成的this.state是一个新的普通对象 // 每次渲染前替换为ctx.state指向的Proxy对象,确保让类组件里使用this.state能够收集到依赖 ref.state = ctx.state; if (ctx.childRef) ctx.childRef.state = ctx.state; // 不处于收集观察依赖 or 已经开始都要跳出此函数 // strictMode模式下,会走两次beforeRender 一次afterRender, // 所以这里严格用ctx.__$$renderStatus === START 来控制只真正执行一次beforeRender if (!ctx.__$$autoWatch || ctx.__$$renderStatus === START) { return; } if (ctx.__$$renderStatus !== START) ctx.__$$renderStatus = START; if (ctx.__$$hasModuleState) { ctx.__$$curWaKeys = {}; ctx.__$$compareWaKeys = ctx.__$$nextCompareWaKeys; ctx.__$$compareWaKeyCount = ctx.__$$nextCompareWaKeyCount; // 渲染期间再次收集 ctx.__$$nextCompareWaKeys = {}; ctx.__$$nextCompareWaKeyCount = 0; } var connectedModules = ctx.connectedModules, connect = ctx.connect; connectedModules.forEach(function (m) { // 非自动收集,在make-ob-state里不会触发get,这里直接跳出 if (connect[m] !== '-') return; ctx.__$$curConnWaKeys[m] = {}; ctx.__$$compareConnWaKeys[m] = ctx.__$$nextCompareConnWaKeys[m]; ctx.__$$compareConnWaKeyCount[m] = ctx.__$$nextCompareConnWaKeyCount[m]; // 渲染期间再次收集 ctx.__$$nextCompareConnWaKeys[m] = {}; ctx.__$$nextCompareConnWaKeyCount[m] = 0; }); // 外面始终取 ctx.__$$mapped 传给 CcFragment registerHookComp registerDumb 的 render 函数, // 具体 ctx.__$$mapped 指向什么取决于有没有传递 mapProps // 传递 mapProps,则传 mapped 给 render 函数,没传 mapProps,则直接透传 ctx 给 render 函数 // !!! 这个规则或许将来某一天会改掉,始终传递 ctx 给 render 函数,这样简单的设定更适合编码思维,而不是存在多种形态 if (mapProps) { var mapped = mapProps(ctx); if (isPJO(mapped)) { Object.assign(ctx.mapped, mapped); } ctx.__$$mapped = ctx.mapped; } else { ctx.__$$mapped = ctx; } } var ccClassDisplayName$1 = ccClassDisplayName, shallowDiffers$1 = shallowDiffers, evalState$3 = evalState; var setupErr = function setupErr(info) { return new Error("can not defined setup both in register options and class body, --verbose: " + info); }; function register(_temp, ccClassKey) { var _ref = _temp === void 0 ? {} : _temp, _ref$module = _ref.module, module = _ref$module === void 0 ? MODULE_DEFAULT : _ref$module, _ref$state = _ref.state, state = _ref$state === void 0 ? {} : _ref$state, _ref$watchedKeys = _ref.watchedKeys, watchedKeys = _ref$watchedKeys === void 0 ? '-' : _ref$watchedKeys, _ref$storedKeys = _ref.storedKeys, storedKeys = _ref$storedKeys === void 0 ? [] : _ref$storedKeys, _ref$setup = _ref.setup, setup = _ref$setup === void 0 ? null : _ref$setup, _ref$cuDesc = _ref.cuDesc, cuDesc = _ref$cuDesc === void 0 ? null : _ref$cuDesc, persistStoredKeys = _ref.persistStoredKeys, _ref$connect = _ref.connect, connect = _ref$connect === void 0 ? {} : _ref$connect, _ref$extra = _ref.extra, extra = _ref$extra === void 0 ? {} : _ref$extra, staticExtra = _ref.staticExtra, tag = _ref.tag, lite = _ref.lite, _ref$isPropsProxy = _ref.isPropsProxy, isPropsProxy = _ref$isPropsProxy === void 0 ? false : _ref$isPropsProxy, renderKeyClasses = _ref.renderKeyClasses, _ref$__checkStartUp = _ref.__checkStartUp, __checkStartUp = _ref$__checkStartUp === void 0 ? true : _ref$__checkStartUp, _ref$compareProps = _ref.compareProps, compareProps = _ref$compareProps === void 0 ? true : _ref$compareProps, __calledBy = _ref.__calledBy; if (ccClassKey === void 0) { ccClassKey = ''; } try { var _mapRegistrationInfo = mapRegistrationInfo(module, ccClassKey, renderKeyClasses, CC_CLASS, watchedKeys, connect, __checkStartUp, __calledBy), _module = _mapRegistrationInfo._module, _ccClassKey = _mapRegistrationInfo._ccClassKey, _connect = _mapRegistrationInfo._connect, _watchedKeys = _mapRegistrationInfo._watchedKeys; return function (ReactClass) { if (ReactClass.prototype && ReactClass.prototype.$$attach) { throw new Error("register a cc class is prohibited!"); } // const isClsPureComponent = ReactClass.prototype.isPureReactComponent; var ToBeExtendedClass = isPropsProxy === false ? ReactClass : React.Component; var staticSetup = ToBeExtendedClass.$$setup; var _CcClass = /*#__PURE__*/ function (_ToBeExtendedClass) { _inheritsLoose(CcClass, _ToBeExtendedClass); function CcClass(props, context) { var _this; _this = _ToBeExtendedClass.call(this, props, context) || this; try { var optState = evalState$3(state); var thisState = _this.state || {}; var privState = Object.assign(thisState, optState); _this.$$attach = _this.$$attach.bind(_assertThisInitialized(_this)); // props.ccOption var params = Object.assign({}, props, { module: _module, tag: tag, state: privState, type: CC_CLASS, insType: CC_CUSTOMIZE, watchedKeys: _watchedKeys, ccClassKey: _ccClassKey, connect: _connect, storedKeys: storedKeys, persistStoredKeys: persistStoredKeys, extra: extra, staticExtra: staticExtra }); buildRefCtx(_assertThisInitialized(_this), params, lite); _this.ctx.reactSetState = makeRefSetState(_assertThisInitialized(_this)); _this.ctx.reactForceUpdate = makeRefForceUpdate(_assertThisInitialized(_this)); if (setup && (_this.$$setup || staticSetup)) { throw setupErr("ccUniqueKey " + _this.ctx.ccUniqueKey); } if (!isPropsProxy) { if (_this.$$setup) _this.$$setup = _this.$$setup.bind(_assertThisInitialized(_this)); beforeMount(_assertThisInitialized(_this), setup || _this.$$setup || staticSetup, false, cuDesc); } // isPropsProxy为true时,延迟到$$attach里执行beforeMount } catch (err) { rh.tryHandleError(err); } return _this; } // 如果代理组件或者继承组件没有没有实现scu,则同时比较nextState nextProps // 因为nextProps不同也会导致重渲染,所以需要约束用户不要把可变数据从props传下来,以提高性能 var _proto = CcClass.prototype; _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { var childRef = this.ctx.childRef; if (childRef && childRef.shouldComponentUpdate) { return childRef.shouldComponentUpdate(nextProps, nextState); } else if (_ToBeExtendedClass.prototype.shouldComponentUpdate) { return _ToBeExtendedClass.prototype.shouldComponentUpdate.call(this, nextProps, nextState); } var isPropsChanged = compareProps ? shallowDiffers$1(this.props, nextProps) : false; return this.state !== nextState || isPropsChanged; } //!!! 存在多重装饰器时, 或者用户想使用this.props.***来用concent类时 //!!! 必需在类的【constructor】 里调用 this.props.$$attach(this),紧接着state定义之后 ; _proto.$$attach = function $$attach(childRef) { var ctx = this.ctx; ctx.childRef = childRef; childRef.ctx = ctx; // 让代理属性的目标组件访问ctx时,既可以写 this.props.ctx 也可以写 this.ctx // 让孩子引用的setState forceUpdate 指向父容器事先构造好的setState forceUpdate childRef.setState = ctx.setState; childRef.forceUpdate = ctx.forceUpdate; if (isObjectNotNull(childRef.state)) { Object.assign(ctx.state, childRef.state, ctx.__$$mstate); } if (childRef.$$setup) childRef.$$setup = childRef.$$setup.bind(childRef); if (setup && (childRef.$$setup || staticSetup)) throw setupErr("ccUniqueKey " + ctx.ccUniqueKey); beforeMount(this, setup || childRef.$$setup || staticSetup, false, cuDesc); beforeRender(this); }; _proto.componentDidMount = function componentDidMount() { // 属性代理模式,必需在组件consturctor里调用 props.$$attach(this) // you must call it in next line of state assign expression if (isPropsProxy && !this.ctx.childRef) { throw new Error("forget call props.$$attach(this) in constructor when set isPropsProxy true"); } if (_ToBeExtendedClass.prototype.componentDidMount) _ToBeExtendedClass.prototype.componentDidMount.call(this); didMount(this); }; _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) { if (_ToBeExtendedClass.prototype.componentDidUpdate) _ToBeExtendedClass.prototype.componentDidUpdate.call(this, prevProps, prevState, snapshot); didUpdate(this); }; _proto.componentWillUnmount = function componentWillUnmount() { if (_ToBeExtendedClass.prototype.componentWillUnmount) _ToBeExtendedClass.prototype.componentWillUnmount.call(this); beforeUnmount(this); } // 注:strict mode 模式下,class组件的双调用机制行为和function组件不一样 // constructor x2 ---> render x2 ---> componentDidMount x1 // 两次构造器里虽然生成了不同的refCtx,但是两次render里给的 this.ctx 始终是最新的那一个 // 所以此处不需要像 useConcent 一样做ef标记 ; _proto.render = function render() { var outProps = this.props; this.ctx.prevProps = this.ctx.props; this.ctx.props = outProps; beforeRender(this); if (isPropsProxy === false) { // now cc class extends ReactClass, call super.render() return _ToBeExtendedClass.prototype.render.call(this); } else { //将$$attach传递下去,用户需在构造器里最后一样调用props.$$attach() var passedProps = _extends({}, outProps, { ctx: this.ctx, $$attach: this.$$attach }); return React.createElement(ReactClass, passedProps); } }; return CcClass; }(ToBeExtendedClass); _CcClass.displayName = ccClassDisplayName$1(_ccClassKey); return _CcClass; }; } catch (err) { rh.tryHandleError(err); } } /**** * @param {string} ccClassKey a cc class's name, * you can register a same react class to cc with different ccClassKey, * but you can not register multi react class with a same ccClassKey * if they don't have same feature(module, connnect params) * @param {object} registerOption * @param {string} [registerOption.module] declare which module current cc class belong to, * default is '$$default' * @param {Function} [registerOption.setup] * @param {Array<string>|string} [registerOption.watchedKeys] * declare current cc class's any instance is concerned which state keys's state changing, * but mostly wo should not set this param cause concent will collect ins dep automatically * @param {{ [moduleName:string]: keys: string[] | '*' }} [registerOption.connect] * @param {string} [registerOption.isPropsProxy] default is false * cc alway use strategy of reverse inheritance to wrap your react class, * that means you can get ctx from `this` directly * but if you meet multi decorator in your project, * to let concent still works well you should set isPropsProxy as true, * and call props.attach(this) in last line of constructor, * then cc will use strategy of prop proxy to wrap your react class, * for example * ``` * @register({ module: "form", isPropsProxy: true }) * @Form.create() * class BasicForms extends PureComponent { * constructor(props, context) { * super(props, context); * props.$$attach(this);// must call $$attach at last line of constructor block * } * render(){ * this.ctx.moduleComputed; //now you can get render ctx supplied by concent * } * } * ``` * online example here: https://codesandbox.io/s/register-in-multi-decrator-j4nr2 */ function register$1 (registerOption, ccClassKey) { var _registerOption = getRegisterOptions(registerOption); delete _registerOption.__checkStartUp; delete _registerOption.__calledBy; return register(_registerOption, ccClassKey); } function _connect (connectSpec, ccClassKey) { var connect = connectSpec || []; return register$1({ connect: connect }, ccClassKey); } /* eslint-disable camelcase */ var getRegisterOptions$1 = getRegisterOptions, evalState$4 = evalState; function initCcFrag (ref, props) { var registerOptions = getRegisterOptions$1(props.register); var module = registerOptions.module, renderKeyClasses = registerOptions.renderKeyClasses, tag = registerOptions.tag, lite = registerOptions.lite, _registerOptions$comp = registerOptions.compareProps, compareProps = _registerOptions$comp === void 0 ? true : _registerOptions$comp, setup = registerOptions.setup, bindCtxToMethod = registerOptions.bindCtxToMethod, _registerOptions$watc = registerOptions.watchedKeys, watchedKeys = _registerOptions$watc === void 0 ? '-' : _registerOptions$watc, _registerOptions$conn = registerOptions.connect, connect = _registerOptions$conn === void 0 ? {} : _registerOptions$conn, _registerOptions$stor = registerOptions.storedKeys, storedKeys = _registerOptions$stor === void 0 ? [] : _registerOptions$stor, _registerOptions$cuDe = registerOptions.cuDesc, cuDesc = _registerOptions$cuDe === void 0 ? null : _registerOptions$cuDe; var state = evalState$4(registerOptions.state); var ccClassKey = props.ccClassKey, ccKey = props.ccKey, _props$ccOption = props.ccOption, ccOption = _props$ccOption === void 0 ? {} : _props$ccOption, id = props.id; var target_watchedKeys = watchedKeys; var target_ccClassKey = ccClassKey; var target_connect = connect; var insType = CC_CUSTOMIZE; //直接使用<CcFragment />构造的cc实例, 尝试提取storedKeys, 然后映射注册信息,(注:registerDumb创建的组件已在外部调用过mapRegistrationInfo) if (props.__$$regDumb !== true) { insType = CC_FRAGMENT; var _mapRegistrationInfo = mapRegistrationInfo(module, ccClassKey, renderKeyClasses, CC_CLASS, watchedKeys, connect, true), _ccClassKey = _mapRegistrationInfo._ccClassKey, _connect = _mapRegistrationInfo._connect, _watchedKeys = _mapRegistrationInfo._watchedKeys; target_watchedKeys = _watchedKeys; target_ccClassKey = _ccClassKey; target_connect = _connect; } buildRefCtx(ref, { ccKey: ccKey, connect: target_connect, state: state, module: module, type: CC_CLASS, insType: insType, storedKeys: storedKeys, watchedKeys: target_watchedKeys, tag: tag, ccClassKey: target_ccClassKey, ccOption: ccOption, id: id }, lite); ref.ctx.reactSetState = makeRefSetState(ref); ref.ctx.reactForceUpdate = makeRefForceUpdate(ref); ref.__$$compareProps = compareProps; //对于concent来说,ctx在constructor里构造完成,此时就可以直接把ctx传递给beforeMount了, //无需在将要给废弃的componentWillMount里调用beforeMount beforeMount(ref, setup, bindCtxToMethod, cuDesc); } var connectToStr = function connectToStr(connect) { if (!connect) return '';else if (Array.isArray(connect)) return connect.join(',');else if (typeof connect === 'object') return JSON.stringify(connect);else return connect; }; function isRegChanged(firstRegOpt, curRegOpt) { if (typeof firstRegOpt === 'string' && firstRegOpt !== curRegOpt) { return true; } if (firstRegOpt.module !== curRegOpt.module) { return true; } if (connectToStr(firstRegOpt.connect) !== connectToStr(curRegOpt.connect)) { return true; } // if (firstRegOpt.tag !== curRegOpt.tag) { // return true; // } return false; } var shallowDiffers$2 = shallowDiffers, isFn$4 = isFn; var nullSpan = React.createElement('span', { style: { display: 'none' } }); var CcFragment = /*#__PURE__*/ function (_React$Component) { _inheritsLoose(CcFragment, _React$Component); function CcFragment(props, context) { var _this; _this = _React$Component.call(this, props, context) || this; initCcFrag(_assertThisInitialized(_this), props); return _this; } var _proto = CcFragment.prototype; _proto.componentDidMount = function componentDidMount() { didMount(this); }; _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { var props = getOutProps(nextProps); var isPropsChanged = this.__$$compareProps ? shallowDiffers$2(props, getOutProps(this.props)) : false; // 检测到register已发送变化,需要重新走一把卸载和初始化流程 if (isPropsChanged && isRegChanged(props.register, this.props.register)) { beforeUnmount(this); initCcFrag(this, props); didMount(this); this.ctx.reactForceUpdate(); return false; } return this.state !== nextState || isPropsChanged; } // componentDidUpdate(prevProps, prevState) { ; _proto.componentDidUpdate = function componentDidUpdate() { didUpdate(this); }; _proto.componentWillUnmount = function componentWillUnmount() { beforeUnmount(this); }; _proto.render = function render() { // 注意这里,一定要每次都取最新的绑在ctx上,确保交给renderProps的ctx参数里的state和props是最新的 var thisProps = this.props; this.ctx.prevProps = this.ctx.props; this.ctx.props = getOutProps(thisProps); var children = thisProps.children, render = thisProps.render, _thisProps$register = thisProps.register, register = _thisProps$register === void 0 ? {} : _thisProps$register; var view = render || children; if (isFn$4(view)) { var ctx = this.ctx; beforeRender(this, register.mapProps); return view(ctx.__$$mapped) || nullSpan; } else { if (React.isValidElement(view)) { // 直接传递dom,无论state怎么改变都不会再次触发渲染 throw new Error("CcFragment's children can not be a react dom"); } return view; } }; return CcFragment; }(React.Component); /* eslint-disable react/prop-types */ function _registerDumb(Dumb, regOpt) { var ccClassKey = regOpt.ccClassKey, _regOpt$props = regOpt.props, props = _regOpt$props === void 0 ? {} : _regOpt$props; var render = function render(ctx) { return React.createElement(Dumb, ctx.__$$mapped); }; // ccKey由实例化的Dumb组件props上透传下来 var passProps = { __$$regDumb: true, props: props, ccOption: props.ccOption, ccClassKey: ccClassKey, render: render, ccKey: props.ccKey, register: regOpt }; return React.createElement(CcFragment, passProps); } // renderKeyClasses, tag, mapProps, module = MODULE_DEFAULT, // watchedKeys = '*', storedKeys, persistStoredKeys, render: Dumb, // connect = {}, state = {}, setup, bindCtxToMethod, compareProps, lite, // bindCtxToMethod function registerDumb (registerOption, ccClassKey) { var _registerOption = getRegisterOptions(registerOption); var renderKeyClasses = _registerOption.renderKeyClasses, module = _registerOption.module, _registerOption$watch = _registerOption.watchedKeys, watchedKeys = _registerOption$watch === void 0 ? '-' : _registerOption$watch, Dumb = _registerOption.render, _registerOption$conne = _registerOption.connect, connect = _registerOption$conne === void 0 ? {} : _registerOption$conne; var _mapRegistrationInfo = mapRegistrationInfo(module, ccClassKey, renderKeyClasses, CC_FRAGMENT, watchedKeys, connect, true), _module = _mapRegistrationInfo._module, _ccClassKey = _mapRegistrationInfo._ccClassKey, _connect = _mapRegistrationInfo._connect, _watchedKeys = _mapRegistrationInfo._watchedKeys; _registerOption.module = _module; _registerOption.watchedKeys = _watchedKeys; _registerOption.ccClassKey = _ccClassKey; _registerOption.connect = _connect; function buildCcFragComp(Dumb) { // 避免react dev tool显示的dom为Unknown var ConnectedFragment = function ConnectedFragment(props) { _registerOption.props = props; return _registerDumb(Dumb, _registerOption); }; return ConnectedFragment; } if (Dumb) { return buildCcFragComp(Dumb); } else { return function (Dumb) { return buildCcFragComp(Dumb); }; } } function _connectDumb (connectSpec, ccClassKey) { var connect = connectSpec || []; return registerDumb({ connect: connect }, ccClassKey); } var firstCall = true; var isStrictMode = false; function markFalse() { isStrictMode = false; } function isStrict (cursor) { // 首次调用,即可确认是不是严格模式了 if (firstCall) { firstCall = false; isStrictMode = cursor % 2 === 0; } return isStrictMode; } /** * http://react.html.cn/docs/strict-mode.html * https://frontarm.com/daishi-kato/use-ref-in-concurrent-mode/ */ var ccUKey2ref$4 = ccContext.ccUKey2ref; var cursor2hookCtx = {}; var refCursor = 1; function getUsableCursor() { var toReturn = refCursor; return toReturn; } function incCursor() { refCursor = refCursor + 1; } function CcHook(state, hookSetter, props, hookCtx) { // new CcHook时,这里锁定的hookSetter就是后面一直可以用的setter // 如果存在期一直替换hookSetter,反倒会造成打开react-dev-tool,点击面板里的dom后,视图便不再更新的bug this.setState = hookSetter; this.forceUpdate = hookSetter; this.state = state; this.isFirstRendered = true; this.props = props; this.hookCtx = hookCtx; } // rState: resolvedState, iState: initialState function buildRef(ref, insType, hookCtx, rState, iState, regOpt, hookState, hookSetter, props, ccClassKey) { incCursor(); cursor2hookCtx[hookCtx.cursor] = hookCtx; // when single file demo in hmr mode trigger buildRef, rState is 0 // so here call evalState again var state = rState || evalState(iState); var renderKeyClasses = regOpt.renderKeyClasses, module = regOpt.module, _regOpt$watchedKeys = regOpt.watchedKeys, watchedKeys = _regOpt$watchedKeys === void 0 ? '-' : _regOpt$watchedKeys, _regOpt$connect = regOpt.connect, connect = _regOpt$connect === void 0 ? {} : _regOpt$connect, setup = regOpt.setup, lite = regOpt.lite, cuDesc = regOpt.cuDesc, bindCtxToMethod = regOpt.bindCtxToMethod; var _mapRegistrationInfo = mapRegistrationInfo(module, ccClassKey, renderKeyClasses, CC_HOOK, watchedKeys, connect, true), _module = _mapRegistrationInfo._module, _ccClassKey = _mapRegistrationInfo._ccClassKey, _connect = _mapRegistrationInfo._connect, _watchedKeys = _mapRegistrationInfo._watchedKeys; var hookRef = ref || new CcHook(hookState, hookSetter, props, hookCtx); hookCtx.hookRef = hookRef; var params = Object.assign({}, regOpt, { module: _module, watchedKeys: _watchedKeys, state: state, type: CC_HOOK, insType: insType, ccClassKey: _ccClassKey, connect: _connect, ccOption: props.ccOption, id: props.id, ccKey: props.ccKey }); hookRef.props = props; // keep shape same as class buildRefCtx(hookRef, params, lite); // in buildRefCtx cc will assign hookRef.props to ctx.prevProps hookRef.ctx.reactSetState = makeRefSetState(hookRef); hookRef.ctx.reactForceUpdate = makeRefForceUpdate(hookRef); var refCtx = hookRef.ctx; refCtx.props = props; // attach props to ctx beforeMount(hookRef, setup, bindCtxToMethod, cuDesc); hookCtx.prevCcUKey = hookCtx.ccUKey; hookCtx.ccUKey = hookRef.ctx.ccUniqueKey; // rewrite useRef for CcHook refCtx.useRef = function useR(refName) { // give named function to avoid eslint error var ref = React.useRef(null); refCtx.refs[refName] = ref; return ref; }; return hookRef; } function replaceSetter(ctx, hookSetter) { ctx.__boundSetState = hookSetter; ctx.__boundForceUpdate = hookSetter; } function getHookCtxCcUKey(hookCtx) { return hookCtx.prevCcUKey || hookCtx.ccUKey; } var tip = 'react version is LTE 16.8'; // TODO, 访问 "development" 非生产模式为没有传tag的组件自动创建loc // 用于辅助判断 isStrictMode 是否正确 function _useConcent(registerOption, ccClassKey, insType) { if (registerOption === void 0) { registerOption = {}; } var cursor = getUsableCursor(); var _registerOption = getRegisterOptions(registerOption); // ef: effectFlag var hookCtxContainer = React.useRef({ cursor: cursor, prevCcUKey: null, ccUKey: null, regOpt: _registerOption, ef: 0 }); var hookCtx = hookCtxContainer.current; var _registerOption$state = _registerOption.state, iState = _registerOption$state === void 0 ? {} : _registerOption$state, _registerOption$props = _registerOption.props, props = _registerOption$props === void 0 ? {} : _registerOption$props, mapProps = _registerOption.mapProps, _registerOption$layou = _registerOption.layoutEffect, layoutEffect = _registerOption$layou === void 0 ? false : _registerOption$layou, extra = _registerOption.extra; var reactUseState = React.useState; if (!reactUseState) { throw new Error(tip); } var isFirstRendered = cursor === hookCtx.cursor; var state = isFirstRendered ? evalState(iState) : 0; var _reactUseState = reactUseState(state), hookState = _reactUseState[0], hookSetter = _reactUseState[1]; var cref = function cref(ref) { return buildRef(ref, insType, hookCtx, state, iState, _registerOption, hookState, hookSetter, props, ccClassKey); }; var hookRef; // 组件刚挂载 or 渲染过程中变化module或者connect的值,触发创建新ref if (isFirstRendered || isRegChanged(hookCtx.regOpt, _registerOption, true)) { hookCtx.regOpt = _registerOption; hookRef = cref(); } else { hookRef = ccUKey2ref$4[hookCtx.ccUKey]; if (!hookRef) { // single file demo in hot reload mode hookRef = cref(); } else { var _refCtx = hookRef.ctx; _refCtx.prevProps = _refCtx.props; _refCtx.props = props; hookRef.props = props; if (isObject(extra)) { Object.assign(_refCtx.extra, extra); } } } var refCtx = hookRef.ctx; var effectHandler = layoutEffect ? React.useLayoutEffect : React.useEffect; // after first render of hookRef just created effectHandler(function () { var hookCtx = hookRef.hookCtx; hookCtx.ef = 1; // 辅助非StrictMode包裹的区域,在随后的判断里可以逃出被删除逻辑 // mock componentWillUnmount return function () { var toUnmountRef = ccUKey2ref$4[getHookCtxCcUKey(hookCtx)]; hookCtx.prevCcUKey = null; if (toUnmountRef) { beforeUnmount(toUnmountRef); } delete cursor2hookCtx[cursor]; }; }, [hookRef]); // 渲染过程中变化module或者connect的值,触发卸载前一刻的ref // after every render effectHandler(function () { replaceSetter(refCtx, hookSetter); // 热加载模式下会触发卸载,这里需要核实ccUKey_ref_ if (!hookRef.isFirstRendered && ccUKey2ref$4[getHookCtxCcUKey(hookCtx)]) { // mock componentDidUpdate didUpdate(hookRef); } else { // mock componentDidMount hookRef.isFirstRendered = false; didMount(hookRef); } // dobule-invoking 机制导致初始化阶段生成了一个多余的hookRef // 虽然未存储到refs上,但是收集到的依赖存储到了waKey2uKeyMap上 // 这里通过触发beforeUnmount来清理多余的依赖 var cursor = hookCtx.cursor; if (isStrict(cursor) && !hookCtx.clearPrev) { hookCtx.clearPrev = true; var prevCursor = cursor - 1; var prevHookCtx = cursor2hookCtx[prevCursor]; if (prevHookCtx && prevHookCtx.ef === 0) { // 根组件useConcent 根组件包裹的子组件也useConcent // 此时先触发子组件的effectHandler,同时cursor也是2 // 浅比较一下两者的注册参数,可以反推出是非strict模式 if (shallowDiffers(prevHookCtx.regOpt, hookCtx.regOpt)) { return markFalse(); } // 确保是同一个类型的实例 if (prevHookCtx.hookRef.ctx.ccClassKey === hookCtx.hookRef.ctx.ccClassKey) { delete cursor2hookCtx[prevCursor]; // 让来自于concent的渲染通知只触发一次, 注意prevHookRef没有被重复触发过diMount逻辑 // 所以直接用prevHookCtx.hookRef来执行beforeUnmount beforeUnmount(prevHookCtx.hookRef); } } } }); beforeRender(hookRef, mapProps); return refCtx; } /** * 仅供内部 component/Ob 调用 */ function useConcentForOb(registerOption, ccClassKey) { // 只针对Ob组件实例化检查时,reg参数是否已变化 return _useConcent(registerOption, ccClassKey, CC_OB); } // 写为具名函数,防止react-dev-tool里显示.default function useConcent(registerOption, ccClassKey) { return _useConcent(registerOption, ccClassKey, CC_CUSTOMIZE); } function registerHookComp(options, ccClassKey) { var _options = getRegisterOptions(options); if (isFn(_options.state)) { _options = Object.assign({}, _options); _options.state = _options.state(); } function buildCcHookComp(Dumb) { var _options2 = _options, _options2$memo = _options2.memo, memo = _options2$memo === void 0 ? true : _options2$memo; delete _options.memo; var getComp = function getComp() { return function CcHookComp(props) { _options.props = props; var ctx = useConcent(_options, ccClassKey); return React.createElement(Dumb, ctx.__$$mapped); }; }; var Comp = getComp(); if (memo && React.memo) { return React.memo(Comp); } else { return Comp; } } var Dumb = _options.render; if (Dumb) { return buildCcHookComp(Dumb); } else { return function (Dumb) { return buildCcHookComp(Dumb); }; } } /**** * if you are sure the input state is really belong to global state, call cc.setGlobalState, * note! cc will filter the input state to meet global state shape and only pass the filtered state to global module */ function setGlobalState (state, cb, renderKey, delay) { var ref = pickOneRef(); ref.ctx.setGlobalState(state, cb, renderKey, delay); } function throwApiCallError() { throw new Error("api doc: cc.setState(module:string, state:object, renderKey:string | string[], delayMs?:number, skipMiddleware?:boolean, throwError?:boolean)"); } function _setState$1 (module, state, renderKey, delayMs, skipMiddleware, throwError) { if (delayMs === void 0) { delayMs = -1; } if (throwError === void 0) { throwError = false; } if (module === undefined && state === undefined) { throwApiCallError(); } if (typeof module !== 'string') { throwApiCallError(); } setState(module, state, renderKey, delayMs, skipMiddleware, throwError); } function _set (moduledKeyPath, val, renderKey, delay) { var dispatcher = pickOneRef(); dispatcher.ctx.set(moduledKeyPath, val, renderKey, delay); } var _getState$1 = (function (module) { return ccContext.store.getState(module); }); var getGlobalState = ccContext.store.getGlobalState; var _computedValues$4 = ccContext.computed._computedValues; var _getGlobalComputed = (function () { return _computedValues$4[MODULE_GLOBAL]; }); var _computedValues$5 = ccContext.computed._computedValues; var getComputed = (function (module) { if (module) return _computedValues$5[module];else return _computedValues$5; }); function getOneModuleCu(moduleName) { var moduleCuRaw = ccContext.computed._computedRaw[moduleName]; var map = {}; if (!moduleCuRaw) return map; var cuKeys = okeys(moduleCuRaw); cuKeys.forEach(function (key) { return map[key] = getComputed(moduleName)[key]; }); return map; } function _debugComputed (moduleName) { if (moduleName) return getOneModuleCu(moduleName); var allModules = okeys(ccContext.store._state); var map = {}; allModules.forEach(function (key) { return map[key] = getOneModuleCu(key); }); return map; } function _emit (event) { var _ref$ctx; if (!event) return; var ref = pickOneRef(); for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } if (ref) (_ref$ctx = ref.ctx).emit.apply(_ref$ctx, [event].concat(args)); } /** @typedef {import('../types-inner').IRef} Ref */ function _off (event, offOptions) { /** @type {Ref} */ var ref = pickOneRef(); if (ref) ref.ctx.off(event, offOptions); } /* eslint-disable camelcase */ function getRefs (filters) { var ccUKey2ref = ccContext.ccUKey2ref; var _filters = {}; if (typeof filters === 'string') _filters = { ccClassKey: filters };else if (isObject(filters)) _filters = filters; var _filters2 = _filters, ccClassKey = _filters2.ccClassKey, tag = _filters2.tag, moduleName = _filters2.moduleName, _filters2$includeNotM = _filters2.includeNotMount, includeNotMount = _filters2$includeNotM === void 0 ? false : _filters2$includeNotM; var refs = []; var ukeys = okeys(ccUKey2ref); var len = ukeys.length; var isEqual = function isEqual(passedVal, ctxVal) { if (!passedVal) return true; return passedVal === ctxVal; }; for (var i = 0; i < len; i++) { /** @type Ref */ var ref = ccUKey2ref[ukeys[i]]; var mountStatus = ref.__$$ms; if (includeNotMount) { // allow NOT_MOUNT, MOUNTED if (mountStatus === UNMOUNTED) continue; } else { // only allow MOUNTED if (mountStatus !== MOUNTED) continue; } var ctx = ref.ctx; if (isEqual(ccClassKey, ctx.ccClassKey) && isEqual(tag, ctx.tag) && isEqual(moduleName, ctx.module)) { refs.push(ref); } } return refs; } var _execute = (function (filters) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var refs = getRefs(filters); refs.forEach(function (ref) { var _ref$ctx; if (ref.ctx.execute) (_ref$ctx = ref.ctx).execute.apply(_ref$ctx, args); }); }); var _executeAll = (function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var refs = getRefs(); refs.forEach(function (ref) { var _ref$ctx; if (ref.ctx.execute) (_ref$ctx = ref.ctx).execute.apply(_ref$ctx, args); }); }); var appendState = ccContext.store.appendState; var _caller$1 = ccContext.reducer._caller; /* eslint-disable react/prop-types */ var obView = function obView() { return 'miss render prop or children'; }; var TargetComp = function TargetComp() { return React.createElement('h1', {}, 'Ob component needs react ver lte 16.8'); }; if (React.memo) { TargetComp = React.memo(function ( /** @type any */ props) { var module = props.module, connect = props.connect, classKey = props.classKey, render = props.render, children = props.children; if (module && connect) { throw new Error("module, connect can not been supplied both"); } else if (!module && !connect) { throw new Error("module or connect should been supplied"); } var view = render || children || obView; var register = module ? { module: module } : { connect: connect }; // 设置为1,最小化ctx够造过程,仅附加状态数据,衍生数据、和reducer相关函数 register.lite = 1; var ctx = useConcentForOb(register, classKey); var mr = ctx.mr, cr = ctx.cr, r = ctx.r; var state, computed; if (module) { state = ctx.moduleState; computed = ctx.moduleComputed; } else { state = ctx.connectedState; computed = ctx.connectedComputed; } return view([state, computed, { mr: mr, cr: cr, r: r }]); }); } var _Ob = TargetComp; if (typeof window === 'undefined') { // eslint-disable-next-line global && (global.window = {}); } var _getRef = function _getRef(filters) { var refs = getRefs(filters); return refs[0]; }; var cloneModule = _cloneModule; var run = _run; var connect = _connect; var connectDumb = _connectDumb; var register$2 = register$1; var registerDumb$1 = registerDumb; var registerHookComp$1 = registerHookComp; var configure$1 = configure; var defineModule = function defineModule(conf) { var confCopy = Object.assign({}, conf); if (conf.reducer) confCopy.r = confCopy.reducer; return confCopy; }; var setGlobalState$1 = setGlobalState; var setState$1 = _setState$1; var set = _set; var getState$7 = _getState$1; var getGlobalState$1 = getGlobalState; var getComputed$1 = getComputed; var debugComputed = _debugComputed; var getGlobalComputed = _getGlobalComputed; var emit = _emit; var off = _off; var dispatch$2 = dispatch; var ccContext$1 = ccContext; var execute = _execute; var executeAll = _executeAll; var getRefs$1 = getRefs; var getRef = _getRef; var reducer = _caller$1; var clearContextIfHot$1 = clearContextIfHot; var CcFragment$1 = CcFragment; var Ob = _Ob; var cst = _cst; var appendState$1 = appendState; var useConcent$1 = useConcent; var defComputed = function defComputed(fn, defOptions) { return makeFnDesc(fn, defOptions); }; var defLazyComputed = function defLazyComputed(fn, defOptions) { var desc = makeFnDesc(fn, defOptions); desc.lazy = true; return desc; }; var defComputedVal = function defComputedVal(val) { return { fn: function fn() { return val; }, depKeys: [] }; }; /** @type {import('./types').defWatch} */ var defWatch = function defWatch(fn, defOptions) { return makeFnDesc(fn, defOptions); }; var defaultExport = { cloneModule: cloneModule, emit: emit, off: off, connect: connect, connectDumb: connectDumb, register: register$2, registerDumb: registerDumb$1, registerHookComp: registerHookComp$1, configure: configure$1, defineModule: defineModule, dispatch: dispatch$2, run: run, setGlobalState: setGlobalState$1, setState: setState$1, set: set, getGlobalState: getGlobalState$1, getState: getState$7, getComputed: getComputed$1, debugComputed: debugComputed, getGlobalComputed: getGlobalComputed, ccContext: ccContext$1, execute: execute, executeAll: executeAll, getRefs: getRefs$1, getRef: getRef, reducer: reducer, clearContextIfHot: clearContextIfHot$1, CcFragment: CcFragment$1, Ob: Ob, cst: cst, appendState: appendState$1, useConcent: useConcent$1, bindCcToMcc: bindCcToMcc, defComputed: defComputed, defLazyComputed: defLazyComputed, defComputedVal: defComputedVal, defWatch: defWatch }; var multiCcContainer = null; function bindCcToMcc(name) { if (!multiCcContainer) { throw new Error('current env is not multi concent ins mode'); } if (multiCcContainer[name]) { throw new Error("ccNamespace[" + name + "] already existed in window.mcc"); } setCcNamespace(name); bindToWindow(name, defaultExport, multiCcContainer); } function avoidMultiCcInSameScope() { var winCc = getWinCc(); if (winCc) { if (winCc.ccContext && winCc.ccContext.info) { var existedVersion = winCc.ccContext.info.version; var newVersion = ccContext$1.info.version; //webpack-dev-server模式下,有些引用了concent的插件或者中间件模块,如果和当前concent版本不一致的话,会保留另外一个concent在其包下 //路径如 node_modules/concent-middleware-web-devtool/node_modules/concent(注,在版本一致时,不会出现此问题) //这样的就相当于隐形的实例化两个concent 上下文,这是不允许的 if (existedVersion !== newVersion) { throw new Error("concent ver conflict! cur[" + existedVersion + "]-new[" + newVersion + "], refresh browser or reinstall some concent-eco-lib"); } } } } // 微前端机构里,每个子应用都有自己的cc实例,需要绑定到mcc下,防止相互覆盖 if (window) { multiCcContainer = window.mcc; if (multiCcContainer) { // 1秒后concent会检查ccns,如果不存在,说明用户忘记调用bindCcToMcc了 setTimeout(function () { var ccns = getCcNamespace(); if (!ccns) { throw new Error('detect window.mcc, but user forget call bindCcToMcc in bundle entry'); } else { avoidMultiCcInSameScope(); } }, 1000); } else { avoidMultiCcInSameScope(); bindToWindow('cc', defaultExport); } } exports.cloneModule = cloneModule; exports.run = run; exports.connect = connect; exports.connectDumb = connectDumb; exports.register = register$2; exports.registerDumb = registerDumb$1; exports.registerHookComp = registerHookComp$1; exports.configure = configure$1; exports.defineModule = defineModule; exports.setGlobalState = setGlobalState$1; exports.setState = setState$1; exports.set = set; exports.getState = getState$7; exports.getGlobalState = getGlobalState$1; exports.getComputed = getComputed$1; exports.debugComputed = debugComputed; exports.getGlobalComputed = getGlobalComputed; exports.emit = emit; exports.off = off; exports.dispatch = dispatch$2; exports.ccContext = ccContext$1; exports.execute = execute; exports.executeAll = executeAll; exports.getRefs = getRefs$1; exports.getRef = getRef; exports.reducer = reducer; exports.clearContextIfHot = clearContextIfHot$1; exports.CcFragment = CcFragment$1; exports.Ob = Ob; exports.cst = cst; exports.appendState = appendState$1; exports.useConcent = useConcent$1; exports.defComputed = defComputed; exports.defLazyComputed = defLazyComputed; exports.defComputedVal = defComputedVal; exports.defWatch = defWatch; exports.bindCcToMcc = bindCcToMcc; exports.default = defaultExport; Object.defineProperty(exports, '__esModule', { value: true }); })));
ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js
paleozogt/cdnjs
/*! jQuery [email protected] jquery.com | jquery.org/license */ (function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bX(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bV.length;while(e--){b=bV[e]+c;if(b in a)return b}return d}function bY(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function bZ(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bY(c)&&(e[f]=p._data(c,"olddisplay",cb(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b$(a,b,c){var d=bO.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function b_(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bU[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bU[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bU[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bU[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bU[e]+"Width"))||0));return f}function ca(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bP.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+b_(a,b,c||(f?"border":"content"),e)+"px"}function cb(a){if(bR[a])return bR[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cz(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cu;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cz(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cz(a,c,d,e,"*",g)),h}function cA(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cB(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cC(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cK(){try{return new a.XMLHttpRequest}catch(b){}}function cL(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cT(){return setTimeout(function(){cM=b},0),cM=p.now()}function cU(a,b){p.each(b,function(b,c){var d=(cS[b]||[]).concat(cS["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cV(a,b,c){var d,e=0,f=0,g=cR.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cM||cT(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cM||cT(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cW(k,j.opts.specialEasing);for(;e<g;e++){d=cR[e].call(j,a,k,j.opts);if(d)return d}return cU(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cW(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cX(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bY(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cb(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cO.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cY(a,b,c,d,e){return new cY.prototype.init(a,b,c,d,e)}function cZ(a,b){var c,d={height:a},e=0;for(;e<4;e+=2-b)c=bU[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function c_(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=r.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete"||e.readyState!=="loading"&&e.addEventListener)setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){p.isFunction(c)&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)(d=p._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=[].slice.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click")){g=p(this),g.context=this;for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){i={},k=[],g[0]=f;for(d=0;d<q;d++)l=o[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&u.push({elem:f,matches:k})}}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){j=u[d],c.currentTarget=j.elem;for(e=0;e<j.matches.length&&!c.isImmediatePropagationStopped();e++){l=j.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,h=((p.event.special[l.origType]||{}).handle||l.handler).apply(j.elem,r),h!==b&&(c.result=h,h===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{ready:{setup:p.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)Z(a,b[e],c,d)}function be(a,b,c,d,e,f){var g,h=$.setFilters[b.toLowerCase()];return h||Z.error(b),(a||!(g=e))&&bd(a||"*",d,g=[],e),g.length>0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(g[a]=b)};for(;p<q;p++){s.exec(""),a=f[p],j=[],i=0,k=e;while(g=s.exec(a)){n=s.lastIndex=g.index+g[0].length;if(n>i){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="<a name='"+q+"'></a><div name='"+q+"'></div>",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};$.setFilters.nth=$.setFilters.eq,$.filters=$.pseudos,X||($.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),V&&($.order.push("NAME"),$.find.NAME=function(a,b){if(typeof b.getElementsByName!==j)return b.getElementsByName(a)}),Y&&($.order.splice(1,0,"CLASS"),$.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!==j&&!c)return b.getElementsByClassName(a)});try{n.call(i.childNodes,0)[0].nodeType}catch(_){n=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}var ba=Z.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},bb=Z.contains=i.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc=Z.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=bc(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=bc(b);return c};Z.attr=function(a,b){var c,d=ba(a);return d||(b=b.toLowerCase()),$.attrHandle[b]?$.attrHandle[b](a):U||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},Z.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return l=0}),i.compareDocumentPosition?e=function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:(e=function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],g=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return f(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)g.unshift(j),j=j.parentNode;c=e.length,d=g.length;for(var l=0;l<c&&l<d;l++)if(e[l]!==g[l])return f(e[l],g[l]);return l===c?f(a,g[l],-1):f(e[l],b,1)},f=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),Z.uniqueSort=function(a){var b,c=1;if(e){k=l,a.sort(e);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1)}return a};var bl=Z.compile=function(a,b,c){var d,e,f,g=O[a];if(g&&g.context===b)return g;e=bg(a,b,c);for(f=0;d=e[f];f++)e[f]=bj(d,b,c);return g=O[a]=bk(e),g.context=b,g.runs=g.dirruns=0,P.push(a),P.length>$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j<k;j++){p=$.order[j];if(s=L[p].exec(m)){h=$.find[p]((s[1]||"").replace(K,""),q,g);if(h==null)continue;m===r&&(a=a.slice(0,a.length-r.length)+m.replace(L[p],""),a||o.apply(e,n.call(h,0)));break}}}if(a){i=bl(a,b,g),d=i.dirruns++,h==null&&(h=$.find.TAG("*",G.test(a)&&b.parentNode||b));for(j=0;l=h[j];j++)c=i.runs++,i(l,b)&&e.push(l)}return e};h.querySelectorAll&&function(){var a,b=bm,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=i.matchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||i.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={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,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=(c[0]||c).ownerDocument||c[0]||c,typeof c.createDocumentFragment=="undefined"&&(c=e),a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cS[c]=cS[c]||[],cS[c].unshift(b)},prefilter:function(a,b){b?cR.unshift(a):cR.push(a)}}),p.Tween=cY,cY.prototype={constructor:cY,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cY.propHooks[this.prop];return a&&a.get?a.get(this):cY.propHooks._default.get(this)},run:function(a){var b,c=cY.propHooks[this.prop];return this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration),this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cY.propHooks._default.set(this),this}},cY.prototype.init.prototype=cY.prototype,cY.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cY.propHooks.scrollTop=cY.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(cZ(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bY).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cV(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cQ.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:cZ("show"),slideUp:cZ("hide"),slideToggle:cZ("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cY.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cN&&(cN=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cN),cN=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c$=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=c_(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
frontend/app_v2/src/components/Search/SearchPresentation.js
First-Peoples-Cultural-Council/fv-web-ui
import React from 'react' import PropTypes from 'prop-types' import { useLocation, Link } from 'react-router-dom' import DictionaryList from 'components/DictionaryList' import DictionaryGrid from 'components/DictionaryGrid' import SearchInput from 'components/SearchInput' import useIcon from 'common/useIcon' function SearchPresentation({ currentFilter, siteTitle, filters, domain, handleFilter, isLoading, items, infiniteScroll, loadRef, actions, moreActions, sitename, searchTerm, }) { const wholeDomain = siteTitle === 'FirstVoices' const location = useLocation() const getFilterListItems = () => { return filters.map((filter) => { const filterIsActiveClass = currentFilter === filter.type ? 'border-l-4 border-primary bg-primary text-white' : 'text-primary bg-gray-100 lg:bg-white' return ( <li key={filter.label} id={'SearchFilter' + filter.label} className="col-span-1 transition duration-500 ease-in-out flex-nowrap" > <Link className={`flex w-full items-center justify-center lg:justify-start transition duration-500 ease-in-out text-sm md:text-base lg:text-lg p-2 xl:p-4 grow rounded-lg capitalize cursor-pointer leading-tight ${filterIsActiveClass}`} to={`${location.pathname}?q=${searchTerm}&docType=${filter.type}&domain=${domain}`} onClick={() => { handleFilter(filter.type) }} > {getItemContents(filter)} </Link> </li> ) }) } const getItemContents = (_filter) => { if (_filter.type === 'ALL') { return currentFilter !== 'ALL' ? ( <> {useIcon('BackArrow', 'inline-flex h-5 md:h-7 mr-3 text-primary fill-current')} <span>{_filter.label}</span> </> ) : ( <> <span className="h-5 md:h-7 flex items-center">{_filter.label}</span> </> ) } return ( <> {useIcon(_filter.label, 'inline-flex h-5 md:h-7 -ml-3 lg:ml-0 mr-3 fill-current')} <span>{_filter.label}</span> </> ) } return ( <> <section className="bg-gradient-to-b from-word to-word-dark p-5"> <div className="mx-auto lg:w-3/5"> <SearchInput.Container /> </div> </section> <div className="grid grid-cols-11 lg:p-2"> <div className="col-span-11 lg:col-span-2 lg:mt-2 border-b-2 border-gray-200 md:border-0"> <h2 className="hidden lg:block text-2xl mx-2 xl:ml-8">Filters</h2> <ul className="grid grid-cols-3 md:grid-cols-5 lg:grid-cols-1 list-none gap-2 py-2 xl:py-4 xl:pr-8 xl:ml-8 items-center mx-2"> {getFilterListItems()} </ul> </div> <div className="hidden md:block min-h-220 col-span-11 lg:col-span-9"> <DictionaryList.Presentation actions={actions} infiniteScroll={infiniteScroll} isLoading={isLoading} items={items} moreActions={moreActions} sitename={sitename} showType wholeDomain={wholeDomain} /> </div> <div className="block md:hidden min-h-220 col-span-11"> <DictionaryGrid.Presentation actions={actions} infiniteScroll={infiniteScroll} isLoading={isLoading} items={items} moreActions={moreActions} sitename={sitename} showType /> </div> </div> <div ref={loadRef} className="w-full h-10" /> </> ) } // PROPTYPES const { array, bool, func, object, string } = PropTypes SearchPresentation.propTypes = { actions: array, currentFilter: string, domain: string, filters: array, domsin: string, handleFilter: func, isLoading: bool, items: object, moreActions: array, searchTerm: string, sitename: string, siteTitle: string, } export default SearchPresentation
src/components/breadcrumbs/geotag-breadcrumbs.js
Lokiedu/libertysoil-site
/* This file is a part of libertysoil.org website Copyright (C) 2016 Loki Education (Social Enterprise) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { Link } from 'react-router'; import { Geotag as GeotagPropType } from '../../prop-types/geotags'; import { TAG_LOCATION, TAG_PLANET } from '../../consts/tags'; import Tag from '../tag'; import TagIcon from '../tag-icon'; import Breadcrumbs from './breadcrumbs'; const GeotagBreadcrumbs = ({ geotag }) => ( <Breadcrumbs> <Link title="All Geotags" to="/geo"> <TagIcon inactive type={TAG_PLANET} /> </Link> {geotag.get('continent') && <Tag inactive={geotag.get('type') != 'Continent'} name={geotag.getIn(['continent', 'name'])} type={TAG_LOCATION} urlId={geotag.getIn(['continent', 'url_name'])} /> } {geotag.get('country') && <Tag inactive={geotag.get('type') != 'Country'} name={geotag.getIn(['country', 'name'])} type={TAG_LOCATION} urlId={geotag.getIn(['country', 'url_name'])} /> } {geotag.get('admin1') && <Tag inactive={geotag.get('type') != 'AdminDivision1'} name={geotag.getIn(['admin1', 'name'])} type={TAG_LOCATION} urlId={geotag.getIn(['admin1', 'url_name'])} /> } <Tag name={geotag.get('name')} type={TAG_LOCATION} urlId={geotag.get('url_name')} /> </Breadcrumbs> ); GeotagBreadcrumbs.displayName = 'GeotagBreadcrumbs'; GeotagBreadcrumbs.propTypes = { geotag: GeotagPropType.isRequired }; export default GeotagBreadcrumbs;
SQL/client/src/components/smart/Posts/List.js
thebillkidy/MERGE-Stack
import React from 'react' import Link from 'next/link' import { graphql, gql } from 'react-apollo' import Post from './Post' import Container from '../../dumb/Container' import Header from '../Header' class List extends React.Component { static propTypes = { data: React.PropTypes.object, } render() { if (this.props.data.loading) { return (<div className='List'> <div> Loading </div> </div>) } return ( <div> <Container width={600} isCentered={true}> <style jsx>{` .Add-Post { position: absolute; top: 10px; left: 10px; background-color: white; border: 1px solid #e6e6e6; border-radius: 3px; padding: 10px 10px; display: flex; justify-content: center; text-decoration: none; color: black; align-items: center; } .Add-Post img { display: block; width: 24px; margin-right: 7px; } .Add-Post div { text-decoration: none; } `}</style> <Link href="/create"> <a className="Add-Post"> <img src="/static/plus.svg" role='presentation' /> <div>New Post</div> </a> </Link> {this.props.data.allPosts.map(post => <Post key={post.id} post={post} />)} {this.props.children} </Container> </div> ) } } const FeedQuery = gql`query allPosts { allPosts(orderBy: DESC) { id imageUrl description, author { id, name } } }` // TODO: Should find a way to auto refresh when new data is available (subscriptions or redux?) const withData = graphql(FeedQuery); export default withData(List)
docs/src/Anchor.js
nickuraltsev/react-bootstrap
import React from 'react'; const Anchor = React.createClass({ propTypes: { id: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]) }, render() { return ( <a id={this.props.id} href={'#' + this.props.id} className="anchor"> <span className="anchor-icon">#</span> {this.props.children} </a> ); } }); export default Anchor;
src/utils/childUtils.js
tan-jerene/material-ui
import React from 'react'; import createFragment from 'react-addons-create-fragment'; export function createChildFragment(fragments) { const newFragments = {}; let validChildrenCount = 0; let firstKey; // Only create non-empty key fragments for (const key in fragments) { const currentChild = fragments[key]; if (currentChild) { if (validChildrenCount === 0) firstKey = key; newFragments[key] = currentChild; validChildrenCount++; } } if (validChildrenCount === 0) return undefined; if (validChildrenCount === 1) return newFragments[firstKey]; return createFragment(newFragments); } export function extendChildren(children, extendedProps, extendedChildren) { return React.isValidElement(children) ? React.Children.map(children, (child) => { const newProps = typeof (extendedProps) === 'function' ? extendedProps(child) : extendedProps; const newChildren = typeof (extendedChildren) === 'function' ? extendedChildren(child) : extendedChildren ? extendedChildren : child.props.children; return React.cloneElement(child, newProps, newChildren); }) : children; }
src/app/component/tooltip-hint/tooltip-hint.js
all3dp/printing-engine-client
import PropTypes from 'prop-types' import React from 'react' import propTypes from '../../prop-types' import cn from '../../lib/class-names' const TooltipHint = ({children, tooltip, classNames, show = false}) => ( <div className={cn('TooltipHint', {show}, classNames)}> {children} <div className="TooltipHint__tooltip"> {React.cloneElement(tooltip, {orientation: 'bottom'})} </div> </div> ) TooltipHint.propTypes = { ...propTypes.component, children: PropTypes.node.isRequired, tooltip: PropTypes.node.isRequired, show: PropTypes.bool } export default TooltipHint
ajax/libs/react-slick/0.12.5/react-slick.js
honestree/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["Slider"] = factory(require("react"), require("react-dom")); else root["Slider"] = factory(root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_6__) { 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'; module.exports = __webpack_require__(1); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _innerSlider = __webpack_require__(3); var _objectAssign = __webpack_require__(11); var _objectAssign2 = _interopRequireDefault(_objectAssign); var _json2mq = __webpack_require__(18); var _json2mq2 = _interopRequireDefault(_json2mq); var _reactResponsiveMixin = __webpack_require__(20); var _reactResponsiveMixin2 = _interopRequireDefault(_reactResponsiveMixin); var _defaultProps = __webpack_require__(13); var _defaultProps2 = _interopRequireDefault(_defaultProps); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Slider = _react2.default.createClass({ displayName: 'Slider', mixins: [_reactResponsiveMixin2.default], getInitialState: function getInitialState() { return { breakpoint: null }; }, componentDidMount: function componentDidMount() { var _this = this; if (this.props.responsive) { var breakpoints = this.props.responsive.map(function (breakpt) { return breakpt.breakpoint; }); breakpoints.sort(function (x, y) { return x - y; }); breakpoints.forEach(function (breakpoint, index) { var bQuery; if (index === 0) { bQuery = (0, _json2mq2.default)({ minWidth: 0, maxWidth: breakpoint }); } else { bQuery = (0, _json2mq2.default)({ minWidth: breakpoints[index - 1], maxWidth: breakpoint }); } _this.media(bQuery, function () { _this.setState({ breakpoint: breakpoint }); }); }); // Register media query for full screen. Need to support resize from small to large var query = (0, _json2mq2.default)({ minWidth: breakpoints.slice(-1)[0] }); this.media(query, function () { _this.setState({ breakpoint: null }); }); } }, render: function render() { var _this2 = this; var settings; var newProps; if (this.state.breakpoint) { newProps = this.props.responsive.filter(function (resp) { return resp.breakpoint === _this2.state.breakpoint; }); settings = newProps[0].settings === 'unslick' ? 'unslick' : (0, _objectAssign2.default)({}, this.props, newProps[0].settings); } else { settings = (0, _objectAssign2.default)({}, _defaultProps2.default, this.props); } var children = this.props.children; if (!Array.isArray(children)) { children = [children]; } // Children may contain false or null, so we should filter them children = children.filter(function (child) { return !!child; }); if (settings === 'unslick') { // if 'unslick' responsive breakpoint setting used, just return the <Slider> tag nested HTML return _react2.default.createElement( 'div', null, children ); } else { return _react2.default.createElement( _innerSlider.InnerSlider, settings, children ); } } }); module.exports = Slider; /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.InnerSlider = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _eventHandlers = __webpack_require__(4); var _eventHandlers2 = _interopRequireDefault(_eventHandlers); var _helpers = __webpack_require__(7); var _helpers2 = _interopRequireDefault(_helpers); var _initialState = __webpack_require__(12); var _initialState2 = _interopRequireDefault(_initialState); var _defaultProps = __webpack_require__(13); var _defaultProps2 = _interopRequireDefault(_defaultProps); var _classnames = __webpack_require__(14); var _classnames2 = _interopRequireDefault(_classnames); var _track = __webpack_require__(15); var _dots = __webpack_require__(16); var _arrows = __webpack_require__(17); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var InnerSlider = exports.InnerSlider = _react2.default.createClass({ displayName: 'InnerSlider', mixins: [_helpers2.default, _eventHandlers2.default], getInitialState: function getInitialState() { return Object.assign({}, _initialState2.default, { currentSlide: this.props.initialSlide }); }, getDefaultProps: function getDefaultProps() { return _defaultProps2.default; }, componentWillMount: function componentWillMount() { if (this.props.init) { this.props.init(); } this.setState({ mounted: true }); var lazyLoadedList = []; for (var i = 0; i < _react2.default.Children.count(this.props.children); i++) { if (i >= this.state.currentSlide && i < this.state.currentSlide + this.props.slidesToShow) { lazyLoadedList.push(i); } } if (this.props.lazyLoad && this.state.lazyLoadedList.length === 0) { this.setState({ lazyLoadedList: lazyLoadedList }); } }, componentDidMount: function componentDidMount() { // Hack for autoplay -- Inspect Later this.initialize(this.props); this.adaptHeight(); if (window.addEventListener) { window.addEventListener('resize', this.onWindowResized); } else { window.attachEvent('onresize', this.onWindowResized); } }, componentWillUnmount: function componentWillUnmount() { if (window.addEventListener) { window.removeEventListener('resize', this.onWindowResized); } else { window.detachEvent('onresize', this.onWindowResized); } if (this.state.autoPlayTimer) { window.clearInterval(this.state.autoPlayTimer); } }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (this.props.slickGoTo != nextProps.slickGoTo) { this.changeSlide({ message: 'index', index: nextProps.slickGoTo, currentSlide: this.state.currentSlide }); } else { this.update(nextProps); } }, componentDidUpdate: function componentDidUpdate() { this.adaptHeight(); }, onWindowResized: function onWindowResized() { this.update(this.props); // animating state should be cleared while resizing, otherwise autoplay stops working this.setState({ animating: false }); }, render: function render() { var className = (0, _classnames2.default)('slick-initialized', 'slick-slider', this.props.className); var trackProps = { fade: this.props.fade, cssEase: this.props.cssEase, speed: this.props.speed, infinite: this.props.infinite, centerMode: this.props.centerMode, currentSlide: this.state.currentSlide, lazyLoad: this.props.lazyLoad, lazyLoadedList: this.state.lazyLoadedList, rtl: this.props.rtl, slideWidth: this.state.slideWidth, slidesToShow: this.props.slidesToShow, slideCount: this.state.slideCount, trackStyle: this.state.trackStyle, variableWidth: this.props.variableWidth }; var dots; if (this.props.dots === true && this.state.slideCount >= this.props.slidesToShow) { var dotProps = { dotsClass: this.props.dotsClass, slideCount: this.state.slideCount, slidesToShow: this.props.slidesToShow, currentSlide: this.state.currentSlide, slidesToScroll: this.props.slidesToScroll, clickHandler: this.changeSlide }; dots = _react2.default.createElement(_dots.Dots, dotProps); } var prevArrow, nextArrow; var arrowProps = { infinite: this.props.infinite, centerMode: this.props.centerMode, currentSlide: this.state.currentSlide, slideCount: this.state.slideCount, slidesToShow: this.props.slidesToShow, prevArrow: this.props.prevArrow, nextArrow: this.props.nextArrow, clickHandler: this.changeSlide }; if (this.props.arrows) { prevArrow = _react2.default.createElement(_arrows.PrevArrow, arrowProps); nextArrow = _react2.default.createElement(_arrows.NextArrow, arrowProps); } var centerPaddingStyle = null; if (this.props.vertical === false) { if (this.props.centerMode === true) { centerPaddingStyle = { padding: '0px ' + this.props.centerPadding }; } } else { if (this.props.centerMode === true) { centerPaddingStyle = { padding: this.props.centerPadding + ' 0px' }; } } return _react2.default.createElement( 'div', { className: className, onMouseEnter: this.onInnerSliderEnter, onMouseLeave: this.onInnerSliderLeave }, _react2.default.createElement( 'div', { ref: 'list', className: 'slick-list', style: centerPaddingStyle, onMouseDown: this.swipeStart, onMouseMove: this.state.dragging ? this.swipeMove : null, onMouseUp: this.swipeEnd, onMouseLeave: this.state.dragging ? this.swipeEnd : null, onTouchStart: this.swipeStart, onTouchMove: this.state.dragging ? this.swipeMove : null, onTouchEnd: this.swipeEnd, onTouchCancel: this.state.dragging ? this.swipeEnd : null }, _react2.default.createElement( _track.Track, _extends({ ref: 'track' }, trackProps), this.props.children ) ), prevArrow, nextArrow, dots ); } }); /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _trackHelper = __webpack_require__(5); var _helpers = __webpack_require__(7); var _helpers2 = _interopRequireDefault(_helpers); var _objectAssign = __webpack_require__(11); var _objectAssign2 = _interopRequireDefault(_objectAssign); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var EventHandlers = { // Event handler for previous and next changeSlide: function changeSlide(options) { var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide; var _props = this.props; var slidesToScroll = _props.slidesToScroll; var slidesToShow = _props.slidesToShow; var _state = this.state; var slideCount = _state.slideCount; var currentSlide = _state.currentSlide; unevenOffset = slideCount % slidesToScroll !== 0; indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll; if (options.message === 'previous') { slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset; targetSlide = currentSlide - slideOffset; if (this.props.lazyLoad) { previousInt = currentSlide - slideOffset; targetSlide = previousInt === -1 ? slideCount - 1 : previousInt; } } else if (options.message === 'next') { slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset; targetSlide = currentSlide + slideOffset; if (this.props.lazyLoad) { targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset; } } else if (options.message === 'dots') { // Click on dots targetSlide = options.index * options.slidesToScroll; if (targetSlide === options.currentSlide) { return; } } else if (options.message === 'index') { targetSlide = options.index; if (targetSlide === options.currentSlide) { return; } } this.slideHandler(targetSlide); }, // Accessiblity handler for previous and next keyHandler: function keyHandler(e) {}, // Focus on selecting a slide (click handler on track) selectHandler: function selectHandler(e) {}, swipeStart: function swipeStart(e) { var touches, posX, posY; if (this.props.swipe === false || 'ontouchend' in document && this.props.swipe === false) { return; } else if (this.props.draggable === false && e.type.indexOf('mouse') !== -1) { return; } posX = e.touches !== undefined ? e.touches[0].pageX : e.clientX; posY = e.touches !== undefined ? e.touches[0].pageY : e.clientY; this.setState({ dragging: true, touchObject: { startX: posX, startY: posY, curX: posX, curY: posY } }); }, swipeMove: function swipeMove(e) { if (!this.state.dragging) { e.preventDefault(); return; } if (this.state.animating) { return; } var swipeLeft; var curLeft, positionOffset; var touchObject = this.state.touchObject; curLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: this.state.currentSlide, trackRef: this.refs.track }, this.props, this.state)); touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX; touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY; touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2))); positionOffset = (this.props.rtl === false ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1); var currentSlide = this.state.currentSlide; var dotCount = Math.ceil(this.state.slideCount / this.props.slidesToScroll); var swipeDirection = this.swipeDirection(this.state.touchObject); var touchSwipeLength = touchObject.swipeLength; if (this.props.infinite === false) { if (currentSlide === 0 && swipeDirection === 'right' || currentSlide + 1 >= dotCount && swipeDirection === 'left') { touchSwipeLength = touchObject.swipeLength * this.props.edgeFriction; if (this.state.edgeDragged === false && this.props.edgeEvent) { this.props.edgeEvent(swipeDirection); this.setState({ edgeDragged: true }); } } } if (this.state.swiped === false && this.props.swipeEvent) { this.props.swipeEvent(swipeDirection); this.setState({ swiped: true }); } swipeLeft = curLeft + touchSwipeLength * positionOffset; this.setState({ touchObject: touchObject, swipeLeft: swipeLeft, trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: swipeLeft }, this.props, this.state)) }); if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) { return; } if (touchObject.swipeLength > 4) { e.preventDefault(); } }, swipeEnd: function swipeEnd(e) { if (!this.state.dragging) { e.preventDefault(); return; } var touchObject = this.state.touchObject; var minSwipe = this.state.listWidth / this.props.touchThreshold; var swipeDirection = this.swipeDirection(touchObject); // reset the state of touch related state variables. this.setState({ dragging: false, edgeDragged: false, swiped: false, swipeLeft: null, touchObject: {} }); // Fix for #13 if (!touchObject.swipeLength) { return; } if (touchObject.swipeLength > minSwipe) { e.preventDefault(); if (swipeDirection === 'left') { this.slideHandler(this.state.currentSlide + this.props.slidesToScroll); } else if (swipeDirection === 'right') { this.slideHandler(this.state.currentSlide - this.props.slidesToScroll); } else { this.slideHandler(this.state.currentSlide); } } else { // Adjust the track back to it's original position. var currentLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: this.state.currentSlide, trackRef: this.refs.track }, this.props, this.state)); this.setState({ trackStyle: (0, _trackHelper.getTrackAnimateCSS)((0, _objectAssign2.default)({ left: currentLeft }, this.props, this.state)) }); } }, onInnerSliderEnter: function onInnerSliderEnter(e) { if (this.props.autoplay && this.props.pauseOnHover) { this.pause(); } }, onInnerSliderLeave: function onInnerSliderLeave(e) { if (this.props.autoplay && this.props.pauseOnHover) { this.autoPlay(); } } }; exports.default = EventHandlers; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.getTrackLeft = exports.getTrackAnimateCSS = exports.getTrackCSS = undefined; var _reactDom = __webpack_require__(6); var _reactDom2 = _interopRequireDefault(_reactDom); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var checkSpecKeys = function checkSpecKeys(spec, keysArray) { return keysArray.reduce(function (value, key) { return value && spec.hasOwnProperty(key); }, true) ? null : console.error('Keys Missing', spec); }; var getTrackCSS = exports.getTrackCSS = function getTrackCSS(spec) { checkSpecKeys(spec, ['left', 'variableWidth', 'slideCount', 'slidesToShow', 'slideWidth']); var trackWidth; if (spec.variableWidth) { trackWidth = (spec.slideCount + 2 * spec.slidesToShow) * spec.slideWidth; } else if (spec.centerMode) { trackWidth = (spec.slideCount + 2 * (spec.slidesToShow + 1)) * spec.slideWidth; } else { trackWidth = (spec.slideCount + 2 * spec.slidesToShow) * spec.slideWidth; } var style = { opacity: 1, width: trackWidth, WebkitTransform: 'translate3d(' + spec.left + 'px, 0px, 0px)', transform: 'translate3d(' + spec.left + 'px, 0px, 0px)', transition: '', WebkitTransition: '', msTransform: 'translateX(' + spec.left + 'px)' }; // Fallback for IE8 if (!window.addEventListener && window.attachEvent) { style.marginLeft = spec.left + 'px'; } return style; }; var getTrackAnimateCSS = exports.getTrackAnimateCSS = function getTrackAnimateCSS(spec) { checkSpecKeys(spec, ['left', 'variableWidth', 'slideCount', 'slidesToShow', 'slideWidth', 'speed', 'cssEase']); var style = getTrackCSS(spec); // useCSS is true by default so it can be undefined style.WebkitTransition = '-webkit-transform ' + spec.speed + 'ms ' + spec.cssEase; style.transition = 'transform ' + spec.speed + 'ms ' + spec.cssEase; return style; }; var getTrackLeft = exports.getTrackLeft = function getTrackLeft(spec) { checkSpecKeys(spec, ['slideIndex', 'trackRef', 'infinite', 'centerMode', 'slideCount', 'slidesToShow', 'slidesToScroll', 'slideWidth', 'listWidth', 'variableWidth']); var slideOffset = 0; var targetLeft; var targetSlide; if (spec.fade) { return 0; } if (spec.infinite) { if (spec.slideCount > spec.slidesToShow) { slideOffset = spec.slideWidth * spec.slidesToShow * -1; } if (spec.slideCount % spec.slidesToScroll !== 0) { if (spec.slideIndex + spec.slidesToScroll > spec.slideCount && spec.slideCount > spec.slidesToShow) { if (spec.slideIndex > spec.slideCount) { slideOffset = (spec.slidesToShow - (spec.slideIndex - spec.slideCount)) * spec.slideWidth * -1; } else { slideOffset = spec.slideCount % spec.slidesToScroll * spec.slideWidth * -1; } } } } if (spec.centerMode) { if (spec.infinite) { slideOffset += spec.slideWidth * Math.floor(spec.slidesToShow / 2); } else { slideOffset = spec.slideWidth * Math.floor(spec.slidesToShow / 2); } } targetLeft = spec.slideIndex * spec.slideWidth * -1 + slideOffset; if (spec.variableWidth === true) { var targetSlideIndex; if (spec.slideCount <= spec.slidesToShow || spec.infinite === false) { targetSlide = _reactDom2.default.findDOMNode(spec.trackRef).childNodes[spec.slideIndex]; } else { targetSlideIndex = spec.slideIndex + spec.slidesToShow; targetSlide = _reactDom2.default.findDOMNode(spec.trackRef).childNodes[targetSlideIndex]; } targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0; if (spec.centerMode === true) { if (spec.infinite === false) { targetSlide = _reactDom2.default.findDOMNode(spec.trackRef).children[spec.slideIndex]; } else { targetSlide = _reactDom2.default.findDOMNode(spec.trackRef).children[spec.slideIndex + spec.slidesToShow + 1]; } targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0; targetLeft += (spec.listWidth - targetSlide.offsetWidth) / 2; } } return targetLeft; }; /***/ }, /* 6 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_6__; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(6); var _reactDom2 = _interopRequireDefault(_reactDom); var _ReactTransitionEvents = __webpack_require__(8); var _ReactTransitionEvents2 = _interopRequireDefault(_ReactTransitionEvents); var _trackHelper = __webpack_require__(5); var _objectAssign = __webpack_require__(11); var _objectAssign2 = _interopRequireDefault(_objectAssign); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var helpers = { initialize: function initialize(props) { var slideCount = _react2.default.Children.count(props.children); var listWidth = this.getWidth(_reactDom2.default.findDOMNode(this.refs.list)); var trackWidth = this.getWidth(_reactDom2.default.findDOMNode(this.refs.track)); var slideWidth = trackWidth / props.slidesToShow; var currentSlide = props.rtl ? slideCount - 1 - props.initialSlide : props.initialSlide; this.setState({ slideCount: slideCount, slideWidth: slideWidth, listWidth: listWidth, trackWidth: trackWidth, currentSlide: currentSlide }, function () { var targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: this.state.currentSlide, trackRef: this.refs.track }, props, this.state)); // getCSS function needs previously set state var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: targetLeft }, props, this.state)); this.setState({ trackStyle: trackStyle }); this.autoPlay(); // once we're set up, trigger the initial autoplay. }); }, update: function update(props) { // This method has mostly same code as initialize method. // Refactor it var slideCount = _react2.default.Children.count(props.children); var listWidth = this.getWidth(_reactDom2.default.findDOMNode(this.refs.list)); var trackWidth = this.getWidth(_reactDom2.default.findDOMNode(this.refs.track)); var slideWidth = this.getWidth(_reactDom2.default.findDOMNode(this)) / props.slidesToShow; // pause slider if autoplay is set to false if (!props.autoplay) this.pause(); this.setState({ slideCount: slideCount, slideWidth: slideWidth, listWidth: listWidth, trackWidth: trackWidth }, function () { var targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: this.state.currentSlide, trackRef: this.refs.track }, props, this.state)); // getCSS function needs previously set state var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: targetLeft }, props, this.state)); this.setState({ trackStyle: trackStyle }); }); }, getWidth: function getWidth(elem) { return elem.getBoundingClientRect().width || elem.offsetWidth; }, adaptHeight: function adaptHeight() { if (this.props.adaptiveHeight) { var selector = '[data-index="' + this.state.currentSlide + '"]'; if (this.refs.list) { var slickList = _reactDom2.default.findDOMNode(this.refs.list); slickList.style.height = slickList.querySelector(selector).offsetHeight + 'px'; } } }, slideHandler: function slideHandler(index) { var _this = this; // Functionality of animateSlide and postSlide is merged into this function // console.log('slideHandler', index); var targetSlide, currentSlide; var targetLeft, currentLeft; var _callback2; if (this.props.waitForAnimate && this.state.animating) { return; } if (this.props.fade) { currentSlide = this.state.currentSlide; // Shifting targetSlide back into the range if (index < 0) { targetSlide = index + this.state.slideCount; } else if (index >= this.state.slideCount) { targetSlide = index - this.state.slideCount; } else { targetSlide = index; } if (this.props.lazyLoad && this.state.lazyLoadedList.indexOf(targetSlide) < 0) { this.setState({ lazyLoadedList: this.state.lazyLoadedList.concat(targetSlide) }); } _callback2 = function callback() { _this.setState({ animating: false }); if (_this.props.afterChange) { _this.props.afterChange(targetSlide); } _ReactTransitionEvents2.default.removeEndEventListener(_reactDom2.default.findDOMNode(_this.refs.track).children[currentSlide], _callback2); }; this.setState({ animating: true, currentSlide: targetSlide }, function () { _ReactTransitionEvents2.default.addEndEventListener(_reactDom2.default.findDOMNode(this.refs.track).children[currentSlide], _callback2); }); if (this.props.beforeChange) { this.props.beforeChange(this.state.currentSlide, targetSlide); } this.autoPlay(); return; } targetSlide = index; if (targetSlide < 0) { if (this.props.infinite === false) { currentSlide = 0; } else if (this.state.slideCount % this.props.slidesToScroll !== 0) { currentSlide = this.state.slideCount - this.state.slideCount % this.props.slidesToScroll; } else { currentSlide = this.state.slideCount + targetSlide; } } else if (targetSlide >= this.state.slideCount) { if (this.props.infinite === false) { currentSlide = this.state.slideCount - this.props.slidesToShow; } else if (this.state.slideCount % this.props.slidesToScroll !== 0) { currentSlide = 0; } else { currentSlide = targetSlide - this.state.slideCount; } } else { currentSlide = targetSlide; } targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: targetSlide, trackRef: this.refs.track }, this.props, this.state)); currentLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2.default)({ slideIndex: currentSlide, trackRef: this.refs.track }, this.props, this.state)); if (this.props.infinite === false) { targetLeft = currentLeft; } if (this.props.beforeChange) { this.props.beforeChange(this.state.currentSlide, currentSlide); } if (this.props.lazyLoad) { var loaded = true; var slidesToLoad = []; for (var i = targetSlide; i < targetSlide + this.props.slidesToShow; i++) { loaded = loaded && this.state.lazyLoadedList.indexOf(i) >= 0; if (!loaded) { slidesToLoad.push(i); } } if (!loaded) { this.setState({ lazyLoadedList: this.state.lazyLoadedList.concat(slidesToLoad) }); } } // Slide Transition happens here. // animated transition happens to target Slide and // non - animated transition happens to current Slide // If CSS transitions are false, directly go the current slide. if (this.props.useCSS === false) { this.setState({ currentSlide: currentSlide, trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: currentLeft }, this.props, this.state)) }, function () { if (this.props.afterChange) { this.props.afterChange(currentSlide); } }); } else { var nextStateChanges = { animating: false, currentSlide: currentSlide, trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2.default)({ left: currentLeft }, this.props, this.state)), swipeLeft: null }; _callback2 = function _callback() { _this.setState(nextStateChanges); if (_this.props.afterChange) { _this.props.afterChange(currentSlide); } _ReactTransitionEvents2.default.removeEndEventListener(_reactDom2.default.findDOMNode(_this.refs.track), _callback2); }; this.setState({ animating: true, currentSlide: currentSlide, trackStyle: (0, _trackHelper.getTrackAnimateCSS)((0, _objectAssign2.default)({ left: targetLeft }, this.props, this.state)) }, function () { _ReactTransitionEvents2.default.addEndEventListener(_reactDom2.default.findDOMNode(this.refs.track), _callback2); }); } this.autoPlay(); }, swipeDirection: function swipeDirection(touchObject) { var xDist, yDist, r, swipeAngle; xDist = touchObject.startX - touchObject.curX; yDist = touchObject.startY - touchObject.curY; r = Math.atan2(yDist, xDist); swipeAngle = Math.round(r * 180 / Math.PI); if (swipeAngle < 0) { swipeAngle = 360 - Math.abs(swipeAngle); } if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) { return this.props.rtl === false ? 'left' : 'right'; } if (swipeAngle >= 135 && swipeAngle <= 225) { return this.props.rtl === false ? 'right' : 'left'; } return 'vertical'; }, autoPlay: function autoPlay() { var _this2 = this; if (this.state.autoPlayTimer) { return; } var play = function play() { if (_this2.state.mounted) { var nextIndex = _this2.props.rtl ? _this2.state.currentSlide - _this2.props.slidesToScroll : _this2.state.currentSlide + _this2.props.slidesToScroll; _this2.slideHandler(nextIndex); } }; if (this.props.autoplay) { this.setState({ autoPlayTimer: window.setInterval(play, this.props.autoplaySpeed) }); } }, pause: function pause() { if (this.state.autoPlayTimer) { window.clearInterval(this.state.autoPlayTimer); this.setState({ autoPlayTimer: null }); } } }; exports.default = helpers; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactTransitionEvents */ 'use strict'; var ExecutionEnvironment = __webpack_require__(9); var getVendorPrefixedEventName = __webpack_require__(10); var endEvents = []; function detectEvents() { var animEnd = getVendorPrefixedEventName('animationend'); var transEnd = getVendorPrefixedEventName('transitionend'); if (animEnd) { endEvents.push(animEnd); } if (transEnd) { endEvents.push(transEnd); } } if (ExecutionEnvironment.canUseDOM) { detectEvents(); } // We use the raw {add|remove}EventListener() call because EventListener // does not know how to remove event listeners and we really should // clean up. Also, these events are not triggered in older browsers // so we should be A-OK here. function addEventListener(node, eventName, eventListener) { node.addEventListener(eventName, eventListener, false); } function removeEventListener(node, eventName, eventListener) { node.removeEventListener(eventName, eventListener, false); } var ReactTransitionEvents = { addEndEventListener: function (node, eventListener) { if (endEvents.length === 0) { // If CSS transitions are not supported, trigger an "end animation" // event immediately. window.setTimeout(eventListener, 0); return; } endEvents.forEach(function (endEvent) { addEventListener(node, endEvent, eventListener); }); }, removeEndEventListener: function (node, eventListener) { if (endEvents.length === 0) { return; } endEvents.forEach(function (endEvent) { removeEventListener(node, endEvent, eventListener); }); } }; module.exports = ReactTransitionEvents; /***/ }, /* 9 */ /***/ function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getVendorPrefixedEventName */ 'use strict'; var ExecutionEnvironment = __webpack_require__(9); /** * Generate a mapping of standard vendor prefixes using the defined style property and event name. * * @param {string} styleProp * @param {string} eventName * @returns {object} */ function makePrefixMap(styleProp, eventName) { var prefixes = {}; prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); prefixes['Webkit' + styleProp] = 'webkit' + eventName; prefixes['Moz' + styleProp] = 'moz' + eventName; prefixes['ms' + styleProp] = 'MS' + eventName; prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); return prefixes; } /** * A list of event names to a configurable list of vendor prefixes. */ var vendorPrefixes = { animationend: makePrefixMap('Animation', 'AnimationEnd'), animationiteration: makePrefixMap('Animation', 'AnimationIteration'), animationstart: makePrefixMap('Animation', 'AnimationStart'), transitionend: makePrefixMap('Transition', 'TransitionEnd') }; /** * Event names that have already been detected and prefixed (if applicable). */ var prefixedEventNames = {}; /** * Element to check for prefixes on. */ var style = {}; /** * Bootstrap if a DOM exists. */ if (ExecutionEnvironment.canUseDOM) { style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x, // the un-prefixed "animation" and "transition" properties are defined on the // style object but the events that fire will still be prefixed, so we need // to check if the un-prefixed events are usable, and if not remove them from the map. if (!('AnimationEvent' in window)) { delete vendorPrefixes.animationend.animation; delete vendorPrefixes.animationiteration.animation; delete vendorPrefixes.animationstart.animation; } // Same as above if (!('TransitionEvent' in window)) { delete vendorPrefixes.transitionend.transition; } } /** * Attempts to determine the correct vendor prefixed event name. * * @param {string} eventName * @returns {string} */ function getVendorPrefixedEventName(eventName) { if (prefixedEventNames[eventName]) { return prefixedEventNames[eventName]; } else if (!vendorPrefixes[eventName]) { return eventName; } var prefixMap = vendorPrefixes[eventName]; for (var styleProp in prefixMap) { if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { return prefixedEventNames[eventName] = prefixMap[styleProp]; } } return ''; } module.exports = getVendorPrefixedEventName; /***/ }, /* 11 */ /***/ function(module, exports) { 'use strict'; /* eslint-disable no-unused-vars */ 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 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 (e) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (Object.getOwnPropertySymbols) { symbols = Object.getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /***/ }, /* 12 */ /***/ function(module, exports) { "use strict"; var initialState = { animating: false, dragging: false, autoPlayTimer: null, currentDirection: 0, currentLeft: null, currentSlide: 0, direction: 1, // listWidth: null, // listHeight: null, // loadIndex: 0, slideCount: null, slideWidth: null, // sliding: false, // slideOffset: 0, swipeLeft: null, touchObject: { startX: 0, startY: 0, curX: 0, curY: 0 }, lazyLoadedList: [], // added for react initialized: false, edgeDragged: false, swiped: false, // used by swipeEvent. differentites between touch and swipe. trackStyle: {}, trackWidth: 0 // Removed // transformsEnabled: false, // $nextArrow: null, // $prevArrow: null, // $dots: null, // $list: null, // $slideTrack: null, // $slides: null, }; module.exports = initialState; /***/ }, /* 13 */ /***/ function(module, exports) { 'use strict'; var defaultProps = { className: '', // accessibility: true, adaptiveHeight: false, arrows: true, autoplay: false, autoplaySpeed: 3000, centerMode: false, centerPadding: '50px', cssEase: 'ease', dots: false, dotsClass: 'slick-dots', draggable: true, easing: 'linear', edgeFriction: 0.35, fade: false, focusOnSelect: false, infinite: true, initialSlide: 0, lazyLoad: false, pauseOnHover: false, responsive: null, rtl: false, slide: 'div', slidesToShow: 1, slidesToScroll: 1, speed: 500, swipe: true, swipeToSlide: false, touchMove: true, touchThreshold: 5, useCSS: true, variableWidth: false, vertical: false, waitForAnimate: true, afterChange: null, beforeChange: null, edgeEvent: null, init: null, swipeEvent: null, // nextArrow, prevArrow are react componets nextArrow: null, prevArrow: null }; module.exports = defaultProps; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg)) { classes.push(classNames.apply(null, arg)); } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } }()); /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.Track = undefined; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _objectAssign = __webpack_require__(11); var _objectAssign2 = _interopRequireDefault(_objectAssign); var _classnames = __webpack_require__(14); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var getSlideClasses = function getSlideClasses(spec) { var slickActive, slickCenter, slickCloned; var centerOffset, index; if (spec.rtl) { index = spec.slideCount - 1 - spec.index; } else { index = spec.index; } slickCloned = index < 0 || index >= spec.slideCount; if (spec.centerMode) { centerOffset = Math.floor(spec.slidesToShow / 2); slickCenter = (index - spec.currentSlide) % spec.slideCount === 0; if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) { slickActive = true; } } else { slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow; } return (0, _classnames2.default)({ 'slick-slide': true, 'slick-active': slickActive, 'slick-center': slickCenter, 'slick-cloned': slickCloned }); }; var getSlideStyle = function getSlideStyle(spec) { var style = {}; if (spec.variableWidth === undefined || spec.variableWidth === false) { style.width = spec.slideWidth; } if (spec.fade) { style.position = 'relative'; style.left = -spec.index * spec.slideWidth; style.opacity = spec.currentSlide === spec.index ? 1 : 0; style.transition = 'opacity ' + spec.speed + 'ms ' + spec.cssEase; style.WebkitTransition = 'opacity ' + spec.speed + 'ms ' + spec.cssEase; } return style; }; var getKey = function getKey(child, fallbackKey) { // key could be a zero return child.key === null || child.key === undefined ? fallbackKey : child.key; }; var renderSlides = function renderSlides(spec) { var key; var slides = []; var preCloneSlides = []; var postCloneSlides = []; var count = _react2.default.Children.count(spec.children); var child; _react2.default.Children.forEach(spec.children, function (elem, index) { if (!spec.lazyLoad | (spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0)) { child = elem; } else { child = _react2.default.createElement('div', null); } var childStyle = getSlideStyle((0, _objectAssign2.default)({}, spec, { index: index })); var slickClasses = getSlideClasses((0, _objectAssign2.default)({ index: index }, spec)); var cssClasses; if (child.props.className) { cssClasses = (0, _classnames2.default)(slickClasses, child.props.className); } else { cssClasses = slickClasses; } slides.push(_react2.default.cloneElement(child, { key: 'original' + getKey(child, index), 'data-index': index, className: cssClasses, style: (0, _objectAssign2.default)({}, child.props.style || {}, childStyle) })); // variableWidth doesn't wrap properly. if (spec.infinite && spec.fade === false) { var infiniteCount = spec.variableWidth ? spec.slidesToShow + 1 : spec.slidesToShow; if (index >= count - infiniteCount) { key = -(count - index); preCloneSlides.push(_react2.default.cloneElement(child, { key: 'precloned' + getKey(child, key), 'data-index': key, className: cssClasses, style: (0, _objectAssign2.default)({}, child.props.style || {}, childStyle) })); } if (index < infiniteCount) { key = count + index; postCloneSlides.push(_react2.default.cloneElement(child, { key: 'postcloned' + getKey(child, key), 'data-index': key, className: cssClasses, style: (0, _objectAssign2.default)({}, child.props.style || {}, childStyle) })); } } }); if (spec.rtl) { return preCloneSlides.concat(slides, postCloneSlides).reverse(); } else { return preCloneSlides.concat(slides, postCloneSlides); } }; var Track = exports.Track = _react2.default.createClass({ displayName: 'Track', render: function render() { var slides = renderSlides(this.props); return _react2.default.createElement( 'div', { className: 'slick-track', style: this.props.trackStyle }, slides ); } }); /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.Dots = undefined; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(14); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var getDotCount = function getDotCount(spec) { var dots; dots = Math.ceil(spec.slideCount / spec.slidesToScroll); return dots; }; var Dots = exports.Dots = _react2.default.createClass({ displayName: 'Dots', clickHandler: function clickHandler(options, e) { // In Autoplay the focus stays on clicked button even after transition // to next slide. That only goes away by click somewhere outside e.preventDefault(); this.props.clickHandler(options); }, render: function render() { var _this = this; var dotCount = getDotCount({ slideCount: this.props.slideCount, slidesToScroll: this.props.slidesToScroll }); // Apply join & split to Array to pre-fill it for IE8 // // Credit: http://stackoverflow.com/a/13735425/1849458 var dots = Array.apply(null, Array(dotCount + 1).join('0').split('')).map(function (x, i) { var leftBound = i * _this.props.slidesToScroll; var rightBound = i * _this.props.slidesToScroll + (_this.props.slidesToScroll - 1); var className = (0, _classnames2.default)({ 'slick-active': _this.props.currentSlide >= leftBound && _this.props.currentSlide <= rightBound }); var dotOptions = { message: 'dots', index: i, slidesToScroll: _this.props.slidesToScroll, currentSlide: _this.props.currentSlide }; return _react2.default.createElement( 'li', { key: i, className: className }, _react2.default.createElement( 'button', { onClick: _this.clickHandler.bind(_this, dotOptions) }, i + 1 ) ); }); return _react2.default.createElement( 'ul', { className: this.props.dotsClass, style: { display: 'block' } }, dots ); } }); /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.NextArrow = exports.PrevArrow = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(14); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PrevArrow = exports.PrevArrow = _react2.default.createClass({ displayName: 'PrevArrow', clickHandler: function clickHandler(options, e) { if (e) { e.preventDefault(); } this.props.clickHandler(options, e); }, render: function render() { var prevClasses = { 'slick-arrow': true, 'slick-prev': true }; var prevHandler = this.clickHandler.bind(this, { message: 'previous' }); if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) { prevClasses['slick-disabled'] = true; prevHandler = null; } var prevArrowProps = { key: '0', 'data-role': 'none', className: (0, _classnames2.default)(prevClasses), style: { display: 'block' }, onClick: prevHandler }; var prevArrow; if (this.props.prevArrow) { prevArrow = _react2.default.cloneElement(this.props.prevArrow, prevArrowProps); } else { prevArrow = _react2.default.createElement( 'button', _extends({ key: '0', type: 'button' }, prevArrowProps), ' Previous' ); } return prevArrow; } }); var NextArrow = exports.NextArrow = _react2.default.createClass({ displayName: 'NextArrow', clickHandler: function clickHandler(options, e) { if (e) { e.preventDefault(); } this.props.clickHandler(options, e); }, render: function render() { var nextClasses = { 'slick-arrow': true, 'slick-next': true }; var nextHandler = this.clickHandler.bind(this, { message: 'next' }); if (!this.props.infinite) { if (this.props.centerMode && this.props.currentSlide >= this.props.slideCount - 1) { nextClasses['slick-disabled'] = true; nextHandler = null; } else { if (this.props.currentSlide >= this.props.slideCount - this.props.slidesToShow) { nextClasses['slick-disabled'] = true; nextHandler = null; } } if (this.props.slideCount <= this.props.slidesToShow) { nextClasses['slick-disabled'] = true; nextHandler = null; } } var nextArrowProps = { key: '1', 'data-role': 'none', className: (0, _classnames2.default)(nextClasses), style: { display: 'block' }, onClick: nextHandler }; var nextArrow; if (this.props.nextArrow) { nextArrow = _react2.default.cloneElement(this.props.nextArrow, nextArrowProps); } else { nextArrow = _react2.default.createElement( 'button', _extends({ key: '1', type: 'button' }, nextArrowProps), ' Next' ); } return nextArrow; } }); /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { var camel2hyphen = __webpack_require__(19); var isDimension = function (feature) { var re = /[height|width]$/; return re.test(feature); }; var obj2mq = function (obj) { var mq = ''; var features = Object.keys(obj); features.forEach(function (feature, index) { var value = obj[feature]; feature = camel2hyphen(feature); // Add px to dimension features if (isDimension(feature) && typeof value === 'number') { value = value + 'px'; } if (value === true) { mq += feature; } else if (value === false) { mq += 'not ' + feature; } else { mq += '(' + feature + ': ' + value + ')'; } if (index < features.length-1) { mq += ' and ' } }); return mq; }; var json2mq = function (query) { var mq = ''; if (typeof query === 'string') { return query; } // Handling array of media queries if (query instanceof Array) { query.forEach(function (q, index) { mq += obj2mq(q); if (index < query.length-1) { mq += ', ' } }); return mq; } // Handling single media query return obj2mq(query); }; module.exports = json2mq; /***/ }, /* 19 */ /***/ function(module, exports) { var camel2hyphen = function (str) { return str .replace(/[A-Z]/g, function (match) { return '-' + match.toLowerCase(); }) .toLowerCase(); }; module.exports = camel2hyphen; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { var canUseDOM = __webpack_require__(21); var enquire = canUseDOM && __webpack_require__(22); var json2mq = __webpack_require__(18); var ResponsiveMixin = { media: function (query, handler) { query = json2mq(query); if (typeof handler === 'function') { handler = { match: handler }; } enquire.register(query, handler); // Queue the handlers to unregister them at unmount if (! this._responsiveMediaHandlers) { this._responsiveMediaHandlers = []; } this._responsiveMediaHandlers.push({query: query, handler: handler}); }, componentWillUnmount: function () { if (this._responsiveMediaHandlers) { this._responsiveMediaHandlers.forEach(function(obj) { enquire.unregister(obj.query, obj.handler); }); } } }; module.exports = ResponsiveMixin; /***/ }, /* 21 */ /***/ function(module, exports) { var canUseDOM = !!( typeof window !== 'undefined' && window.document && window.document.createElement ); module.exports = canUseDOM; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! * enquire.js v2.1.1 - Awesome Media Queries in JavaScript * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ ;(function (name, context, factory) { var matchMedia = window.matchMedia; if (typeof module !== 'undefined' && module.exports) { module.exports = factory(matchMedia); } else if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return (context[name] = factory(matchMedia)); }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { context[name] = factory(matchMedia); } }('enquire', this, function (matchMedia) { 'use strict'; /*jshint unused:false */ /** * Helper function for iterating over a collection * * @param collection * @param fn */ function each(collection, fn) { var i = 0, length = collection.length, cont; for(i; i < length; i++) { cont = fn(collection[i], i); if(cont === false) { break; //allow early exit } } } /** * Helper function for determining whether target object is an array * * @param target the object under test * @return {Boolean} true if array, false otherwise */ function isArray(target) { return Object.prototype.toString.apply(target) === '[object Array]'; } /** * Helper function for determining whether target object is a function * * @param target the object under test * @return {Boolean} true if function, false otherwise */ function isFunction(target) { return typeof target === 'function'; } /** * Delegate to handle a media query being matched and unmatched. * * @param {object} options * @param {function} options.match callback for when the media query is matched * @param {function} [options.unmatch] callback for when the media query is unmatched * @param {function} [options.setup] one-time callback triggered the first time a query is matched * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched? * @constructor */ function QueryHandler(options) { this.options = options; !options.deferSetup && this.setup(); } QueryHandler.prototype = { /** * coordinates setup of the handler * * @function */ setup : function() { if(this.options.setup) { this.options.setup(); } this.initialised = true; }, /** * coordinates setup and triggering of the handler * * @function */ on : function() { !this.initialised && this.setup(); this.options.match && this.options.match(); }, /** * coordinates the unmatch event for the handler * * @function */ off : function() { this.options.unmatch && this.options.unmatch(); }, /** * called when a handler is to be destroyed. * delegates to the destroy or unmatch callbacks, depending on availability. * * @function */ destroy : function() { this.options.destroy ? this.options.destroy() : this.off(); }, /** * determines equality by reference. * if object is supplied compare options, if function, compare match callback * * @function * @param {object || function} [target] the target for comparison */ equals : function(target) { return this.options === target || this.options.match === target; } }; /** * Represents a single media query, manages it's state and registered handlers for this query * * @constructor * @param {string} query the media query string * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design */ function MediaQuery(query, isUnconditional) { this.query = query; this.isUnconditional = isUnconditional; this.handlers = []; this.mql = matchMedia(query); var self = this; this.listener = function(mql) { self.mql = mql; self.assess(); }; this.mql.addListener(this.listener); } MediaQuery.prototype = { /** * add a handler for this query, triggering if already active * * @param {object} handler * @param {function} handler.match callback for when query is activated * @param {function} [handler.unmatch] callback for when query is deactivated * @param {function} [handler.setup] callback for immediate execution when a query handler is registered * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched? */ addHandler : function(handler) { var qh = new QueryHandler(handler); this.handlers.push(qh); this.matches() && qh.on(); }, /** * removes the given handler from the collection, and calls it's destroy methods * * @param {object || function} handler the handler to remove */ removeHandler : function(handler) { var handlers = this.handlers; each(handlers, function(h, i) { if(h.equals(handler)) { h.destroy(); return !handlers.splice(i,1); //remove from array and exit each early } }); }, /** * Determine whether the media query should be considered a match * * @return {Boolean} true if media query can be considered a match, false otherwise */ matches : function() { return this.mql.matches || this.isUnconditional; }, /** * Clears all handlers and unbinds events */ clear : function() { each(this.handlers, function(handler) { handler.destroy(); }); this.mql.removeListener(this.listener); this.handlers.length = 0; //clear array }, /* * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match */ assess : function() { var action = this.matches() ? 'on' : 'off'; each(this.handlers, function(handler) { handler[action](); }); } }; /** * Allows for registration of query handlers. * Manages the query handler's state and is responsible for wiring up browser events * * @constructor */ function MediaQueryDispatch () { if(!matchMedia) { throw new Error('matchMedia not present, legacy browsers require a polyfill'); } this.queries = {}; this.browserIsIncapable = !matchMedia('only all').matches; } MediaQueryDispatch.prototype = { /** * Registers a handler for the given media query * * @param {string} q the media query * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers * @param {function} options.match fired when query matched * @param {function} [options.unmatch] fired when a query is no longer matched * @param {function} [options.setup] fired when handler first triggered * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers */ register : function(q, options, shouldDegrade) { var queries = this.queries, isUnconditional = shouldDegrade && this.browserIsIncapable; if(!queries[q]) { queries[q] = new MediaQuery(q, isUnconditional); } //normalise to object in an array if(isFunction(options)) { options = { match : options }; } if(!isArray(options)) { options = [options]; } each(options, function(handler) { queries[q].addHandler(handler); }); return this; }, /** * unregisters a query and all it's handlers, or a specific handler for a query * * @param {string} q the media query to target * @param {object || function} [handler] specific handler to unregister */ unregister : function(q, handler) { var query = this.queries[q]; if(query) { if(handler) { query.removeHandler(handler); } else { query.clear(); delete this.queries[q]; } } return this; } }; return new MediaQueryDispatch(); })); /***/ } /******/ ]) }); ;
app/modules/common/filesUpload/item/item.js
theseushu/funong-web
import React, { Component, PropTypes } from 'react'; import injectSheet from 'react-jss'; import _now from 'lodash/now'; import IconButton from 'react-mdl/lib/IconButton'; const generateKey = () => _now(); class FileUploadItem extends Component { static propTypes = { file: PropTypes.shape({ process: PropTypes.shape({ dataUrl: PropTypes.string.isRequired, }), upload: PropTypes.shape({ rejected: PropTypes.bool, file: PropTypes.shape({ id: PropTypes.string.isRequired, url: PropTypes.string.isRequired, error: PropTypes.object, }), }).isRequired, }).isRequired, sheet: PropTypes.object.isRequired, uploadFile: PropTypes.func.isRequired, uploadFileProgress: PropTypes.func.isRequired, uploadStates: PropTypes.object, onUploaded: PropTypes.func.isRequired, className: PropTypes.string, small: PropTypes.bool.isRequired, } constructor(props) { super(props); this.state = { percent: 0 }; } componentDidMount() { const key = generateKey(); this.key = key; const { file: { upload: { file, rejected } } } = this.props; if (!file && !rejected) { this.uploadFile(); } } uploadFile = () => { const { uploadFile, uploadFileProgress, file: { process: { dataUrl, width, height } } } = this.props; uploadFile({ key: this.key, filename: `${this.key}.png`, dataUrl, width, height, onprogress: (percent) => { uploadFileProgress(this.key, percent); }, meta: { resolve: (uploadedFile) => this.props.onUploaded(uploadedFile), reject: (err) => this.props.onUploaded(null, err), }, }); } render() { const { file: { process, upload }, sheet: { classes }, uploadStates, small, className = '' } = this.props; let info; const uploadingState = uploadStates[this.key]; if (uploadingState) { const { pending, rejected, percent } = uploadingState; // eslint-disable-line if (pending) { info = <div className={classes.info} style={{ height: `${100 - percent}%` }} />; } else if (rejected) { info = ( <div className={classes.info} style={{ background: 'rgba(255, 0, 0, 0.5)' }}> <div>重试</div> <IconButton name="refresh" onClick={(e) => { e.preventDefault(); this.uploadFile(); }} /> </div> ); } } return ( <div className={[small ? `${classes.wrapper} ${classes.wrapperSmall}` : classes.wrapper, className].join(' ')}> <img role="presentation" src={(process && process.dataUrl) ? process.dataUrl : upload.file.url} /> {info} </div> ); } } export default injectSheet({ wrapper: { width: 72, height: 96, margin: 4, boxSizing: 'border-box', position: 'relative', display: 'flex', justifyContent: 'center', alignItems: 'center', '& img': { maxWidth: '100%', maxHeight: '100%', }, }, wrapperSmall: { width: 36, height: 48, }, info: { position: 'absolute', width: '100%', height: '100%', left: 0, bottom: 0, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center', background: 'rgba(0, 0, 0, 0.5)', }, })(FileUploadItem);
src/components/form/preview_item.js
woshisbb43/coinMessageWechat
//1.0.0 components import React from 'react'; import PropTypes from 'prop-types'; import classNames from '../../utils/classnames'; /** * Preview Item for all purpose usage * */ const PreviewItem = (props) => { const { className, label, value, ...others } = props; const cls = classNames({ 'weui-form-preview__item': true, [className]: className }); return ( <div className={cls} {...others}> <label className="weui-form-preview__label">{label}</label> <em className="weui-form-preview__value">{value}</em> </div> ); }; PreviewItem.propTypes = { /** * The label of item * */ label: PropTypes.string, /** * Value of the label * */ value: PropTypes.string, }; PreviewItem.defaultProps = { label: false, value: false, }; export default PreviewItem;
src/todo/TaskForm.js
carlodicelico/reify
import React from 'react'; const TaskForm = (props) => { return ( <p className='control has-icon has-icon-right'> <input autoFocus={true} className='add-task input is-large' type='text' placeholder='Add a task' /> <i className='fa fa-plus'></i> </p> ); }; export default TaskForm;
ajax/libs/F2/1.3.1/f2.min.js
icco/cdnjs
/*! F2 - v1.3.1 - 10-15-2013 - See below for copyright and license */ (function(exports){if(!exports.F2||exports.F2_TESTING_MODE){/*! JSON.org requires the following notice to accompany json2: Copyright (c) 2002 JSON.org http://json.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. 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. */ "object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,o,i,a,s=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?l+"":"null";case"boolean":case"null":return l+"";case"object":if(!l)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(l)){for(i=l.length,n=0;i>n;n+=1)a[n]=str(n,l)||"null";return o=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+s+"]":"["+a.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(i=rep.length,n=0;i>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));else for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));return o=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+s+"}":"{"+a.join(",")+"}",gap=s,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(e,t,o)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),/*! * jQuery JavaScript Library v1.8.3 * The jQuery Foundation and other contributors require the following notice to accompany jQuery: * * Copyright (c) 2013 jQuery Foundation and other contributors * * http://jquery.com * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ function(e,t){function n(e){var t=ht[e]={};return Y.each(e.split(tt),function(e,n){t[n]=!0}),t}function r(e,n,r){if(r===t&&1===e.nodeType){var o="data-"+n.replace(mt,"-$1").toLowerCase();if(r=e.getAttribute(o),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:gt.test(r)?Y.parseJSON(r):r}catch(i){}Y.data(e,n,r)}else r=t}return r}function o(e){var t;for(t in e)if(("data"!==t||!Y.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(){return!1}function a(){return!0}function s(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e,t,n){if(t=t||0,Y.isFunction(t))return Y.grep(e,function(e,r){var o=!!t.call(e,r,e);return o===n});if(t.nodeType)return Y.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=Y.grep(e,function(e){return 1===e.nodeType});if(It.test(t))return Y.filter(t,r,!n);t=Y.filter(t,r)}return Y.grep(e,function(e){return Y.inArray(e,t)>=0===n})}function u(e){var t=Pt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function p(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function f(e,t){if(1===t.nodeType&&Y.hasData(e)){var n,r,o,i=Y._data(e),a=Y._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;o>r;r++)Y.event.add(t,n,s[n][r])}a.data&&(a.data=Y.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),Y.support.html5Clone&&e.innerHTML&&!Y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Vt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Y.expando))}function h(e){return e.getElementsByTagName!==t?e.getElementsByTagName("*"):e.querySelectorAll!==t?e.querySelectorAll("*"):[]}function g(e){Vt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,o=vn.length;o--;)if(t=vn[o]+n,t in e)return t;return r}function y(e,t){return e=t||e,"none"===Y.css(e,"display")||!Y.contains(e.ownerDocument,e)}function v(e,t){for(var n,r,o=[],i=0,a=e.length;a>i;i++)n=e[i],n.style&&(o[i]=Y._data(n,"olddisplay"),t?(o[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&y(n)&&(o[i]=Y._data(n,"olddisplay",_(n.nodeName)))):(r=nn(n,"display"),o[i]||"none"===r||Y._data(n,"olddisplay",r)));for(i=0;a>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?o[i]||"":"none"));return e}function b(e,t,n){var r=pn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function x(e,t,n,r){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,i=0;4>o;o+=2)"margin"===n&&(i+=Y.css(e,n+yn[o],!0)),r?("content"===n&&(i-=parseFloat(nn(e,"padding"+yn[o]))||0),"margin"!==n&&(i-=parseFloat(nn(e,"border"+yn[o]+"Width"))||0)):(i+=parseFloat(nn(e,"padding"+yn[o]))||0,"padding"!==n&&(i+=parseFloat(nn(e,"border"+yn[o]+"Width"))||0));return i}function w(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o=!0,i=Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing");if(0>=r||null==r){if(r=nn(e,t),(0>r||null==r)&&(r=e.style[t]),fn.test(r))return r;o=i&&(Y.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+x(e,t,n||(i?"border":"content"),o)+"px"}function _(e){if(hn[e])return hn[e];var t=Y("<"+e+">").appendTo($.body),n=t.css("display");return t.remove(),("none"===n||""===n)&&(rn=$.body.appendChild(rn||Y.extend($.createElement("iframe"),{frameBorder:0,width:0,height:0})),on&&rn.createElement||(on=(rn.contentWindow||rn.contentDocument).document,on.write("<!doctype html><html><body>"),on.close()),t=on.body.appendChild(on.createElement(e)),n=nn(t,"display"),$.body.removeChild(rn)),hn[e]=n,n}function C(e,t,n,r){var o;if(Y.isArray(t))Y.each(t,function(t,o){n||wn.test(e)?r(e,o):C(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==Y.type(t))r(e,t);else for(o in t)C(e+"["+o+"]",t[o],n,r)}function A(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o,i,a=t.toLowerCase().split(tt),s=0,l=a.length;if(Y.isFunction(n))for(;l>s;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function T(e,n,r,o,i,a){i=i||n.dataTypes[0],a=a||{},a[i]=!0;for(var s,l=e[i],c=0,u=l?l.length:0,p=e===Dn;u>c&&(p||!s);c++)s=l[c](n,r,o),"string"==typeof s&&(!p||a[s]?s=t:(n.dataTypes.unshift(s),s=T(e,n,r,o,s,a)));return!p&&s||a["*"]||(s=T(e,n,r,o,"*",a)),s}function k(e,n){var r,o,i=Y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((i[r]?e:o||(o={}))[r]=n[r]);o&&Y.extend(!0,e,o)}function E(e,n,r){var o,i,a,s,l=e.contents,c=e.dataTypes,u=e.responseFields;for(i in u)i in r&&(n[u[i]]=r[i]);for(;"*"===c[0];)c.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("content-type"));if(o)for(i in l)if(l[i]&&l[i].test(o)){c.unshift(i);break}if(c[0]in r)a=c[0];else{for(i in r){if(!c[0]||e.converters[i+" "+c[0]]){a=i;break}s||(s=i)}a=a||s}return a?(a!==c[0]&&c.unshift(a),r[a]):t}function F(e,t){var n,r,o,i,a=e.dataTypes.slice(),s=a[0],l={},c=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a[1])for(n in e.converters)l[n.toLowerCase()]=e.converters[n];for(;o=a[++c];)if("*"!==o){if("*"!==s&&s!==o){if(n=l[s+" "+o]||l["* "+o],!n)for(r in l)if(i=r.split(" "),i[1]===o&&(n=l[s+" "+i[0]]||l["* "+i[0]])){n===!0?n=l[r]:l[r]!==!0&&(o=i[0],a.splice(c--,0,o));break}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(u){return{state:"parsererror",error:n?u:"No conversion from "+s+" to "+o}}}s=o}return{state:"success",data:t}}function N(){try{return new e.XMLHttpRequest}catch(t){}}function S(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function j(){return setTimeout(function(){Jn=t},0),Jn=Y.now()}function R(e,t){Y.each(t,function(t,n){for(var r=(er[t]||[]).concat(er["*"]),o=0,i=r.length;i>o;o++)if(r[o].call(e,t,n))return})}function O(e,t,n){var r,o=0,i=Zn.length,a=Y.Deferred().always(function(){delete s.elem}),s=function(){for(var t=Jn||j(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,i=0,s=l.tweens.length;s>i;i++)l.tweens[i].run(o);return a.notifyWith(e,[l,o,n]),1>o&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:Y.extend({},t),opts:Y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||j(),duration:n.duration,tweens:[],createTween:function(t,n){var r=Y.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){for(var n=0,r=t?l.tweens.length:0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(M(c,l.opts.specialEasing);i>o;o++)if(r=Zn[o].call(l,e,c,l.opts))return r;return R(l,c),Y.isFunction(l.opts.start)&&l.opts.start.call(e,l),Y.fx.timer(Y.extend(s,{anim:l,queue:l.opts.queue,elem:e})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function M(e,t){var n,r,o,i,a;for(n in e)if(r=Y.camelCase(n),o=t[r],i=e[n],Y.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),a=Y.cssHooks[r],a&&"expand"in a){i=a.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function H(e,t,n){var r,o,i,a,s,l,c,u,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&y(e);n.queue||(u=Y._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,p=u.empty.fire,u.empty.fire=function(){u.unqueued||p()}),u.unqueued++,f.always(function(){f.always(function(){u.unqueued--,Y.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Y.css(e,"display")&&"none"===Y.css(e,"float")&&(Y.support.inlineBlockNeedsLayout&&"inline"!==_(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",Y.support.shrinkWrapBlocks||f.done(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Kn.exec(i)){if(delete t[r],l=l||"toggle"===i,i===(m?"hide":"show"))continue;g.push(r)}if(a=g.length){s=Y._data(e,"fxshow")||Y._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),l&&(s.hidden=!m),m?Y(e).show():f.done(function(){Y(e).hide()}),f.done(function(){var t;Y.removeData(e,"fxshow",!0);for(t in h)Y.style(e,t,h[t])});for(r=0;a>r;r++)o=g[r],c=f.createTween(o,m?s[o]:0),h[o]=s[o]||Y.style(e,o),o in s||(s[o]=c.start,m&&(c.end=c.start,c.start="width"===o||"height"===o?1:0))}}function I(e,t,n,r,o){return new I.prototype.init(e,t,n,r,o)}function D(e,t){var n,r={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=yn[o],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function L(e){return Y.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var P,B,$=e.document,q=e.location,W=e.navigator,U=e.jQuery,Q=e.$,z=Array.prototype.push,X=Array.prototype.slice,J=Array.prototype.indexOf,V=Object.prototype.toString,K=Object.prototype.hasOwnProperty,G=String.prototype.trim,Y=function(e,t){return new Y.fn.init(e,t,P)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,nt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,ot=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,it=/^[\],:{}\s]*$/,at=/(?:^|:|,)(?:\s*\[)+/g,st=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,lt=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ct=/^-ms-/,ut=/-([\da-z])/gi,pt=function(e,t){return(t+"").toUpperCase()},ft=function(){$.addEventListener?($.removeEventListener("DOMContentLoaded",ft,!1),Y.ready()):"complete"===$.readyState&&($.detachEvent("onreadystatechange",ft),Y.ready())},dt={};Y.fn=Y.prototype={constructor:Y,init:function(e,n,r){var o,i,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:rt.exec(e),!o||!o[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(o[1])return n=n instanceof Y?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:$,e=Y.parseHTML(o[1],a,!0),ot.test(o[1])&&Y.isPlainObject(n)&&this.attr.call(e,n,!0),Y.merge(this,e);if(i=$.getElementById(o[2]),i&&i.parentNode){if(i.id!==o[2])return r.find(e);this.length=1,this[0]=i}return this.context=$,this.selector=e,this}return Y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Y.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return X.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=Y.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,"find"===t?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return Y.each(this,e,t)},ready:function(e){return Y.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(X.apply(this,arguments),"slice",X.call(arguments).join(","))},map:function(e){return this.pushStack(Y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:[].sort,splice:[].splice},Y.fn.init.prototype=Y.fn,Y.extend=Y.fn.extend=function(){var e,n,r,o,i,a,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),"object"==typeof s||Y.isFunction(s)||(s={}),c===l&&(s=this,--l);c>l;l++)if(null!=(e=arguments[l]))for(n in e)r=s[n],o=e[n],s!==o&&(u&&o&&(Y.isPlainObject(o)||(i=Y.isArray(o)))?(i?(i=!1,a=r&&Y.isArray(r)?r:[]):a=r&&Y.isPlainObject(r)?r:{},s[n]=Y.extend(u,a,o)):o!==t&&(s[n]=o));return s},Y.extend({noConflict:function(t){return e.$===Y&&(e.$=Q),t&&e.jQuery===Y&&(e.jQuery=U),Y},isReady:!1,readyWait:1,holdReady:function(e){e?Y.readyWait++:Y.ready(!0)},ready:function(e){if(e===!0?!--Y.readyWait:!Y.isReady){if(!$.body)return setTimeout(Y.ready,1);Y.isReady=!0,e!==!0&&--Y.readyWait>0||(B.resolveWith($,[Y]),Y.fn.trigger&&Y($).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===Y.type(e)},isArray:Array.isArray||function(e){return"array"===Y.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":dt[V.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==Y.type(e)||e.nodeType||Y.isWindow(e))return!1;try{if(e.constructor&&!K.call(e,"constructor")&&!K.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||K.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){var r;return e&&"string"==typeof e?("boolean"==typeof t&&(n=t,t=0),t=t||$,(r=ot.exec(e))?[t.createElement(r[1])]:(r=Y.buildFragment([e],t,n?null:[]),Y.merge([],(r.cacheable?Y.clone(r.fragment):r.fragment).childNodes))):null},parseJSON:function(n){return n&&"string"==typeof n?(n=Y.trim(n),e.JSON&&e.JSON.parse?e.JSON.parse(n):it.test(n.replace(st,"@").replace(lt,"]").replace(at,""))?Function("return "+n)():(Y.error("Invalid JSON: "+n),t)):null},parseXML:function(n){var r,o;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(o=new DOMParser,r=o.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(i){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||Y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ct,"ms-").replace(ut,pt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var o,i=0,a=e.length,s=a===t||Y.isFunction(e);if(r)if(s){for(o in e)if(n.apply(e[o],r)===!1)break}else for(;a>i&&n.apply(e[i++],r)!==!1;);else if(s){for(o in e)if(n.call(e[o],o,e[o])===!1)break}else for(;a>i&&n.call(e[i],i,e[i++])!==!1;);return e},trim:G&&!G.call(" ")?function(e){return null==e?"":G.call(e)}:function(e){return null==e?"":(e+"").replace(nt,"")},makeArray:function(e,t){var n,r=t||[];return null!=e&&(n=Y.type(e),null==e.length||"string"===n||"function"===n||"regexp"===n||Y.isWindow(e)?z.call(r,e):Y.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(J)return J.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,o=e.length,i=0;if("number"==typeof r)for(;r>i;i++)e[o++]=n[i];else for(;n[i]!==t;)e[o++]=n[i++];return e.length=o,e},grep:function(e,t,n){var r,o=[],i=0,a=e.length;for(n=!!n;a>i;i++)r=!!t(e[i],i),n!==r&&o.push(e[i]);return o},map:function(e,n,r){var o,i,a=[],s=0,l=e.length,c=e instanceof Y||l!==t&&"number"==typeof l&&(l>0&&e[0]&&e[l-1]||0===l||Y.isArray(e));if(c)for(;l>s;s++)o=n(e[s],s,r),null!=o&&(a[a.length]=o);else for(i in e)o=n(e[i],i,r),null!=o&&(a[a.length]=o);return a.concat.apply([],a)},guid:1,proxy:function(e,n){var r,o,i;return"string"==typeof n&&(r=e[n],n=e,e=r),Y.isFunction(e)?(o=X.call(arguments,2),i=function(){return e.apply(n,o.concat(X.call(arguments)))},i.guid=e.guid=e.guid||Y.guid++,i):t},access:function(e,n,r,o,i,a,s){var l,c=null==r,u=0,p=e.length;if(r&&"object"==typeof r){for(u in r)Y.access(e,n,u,r[u],1,a,o);i=1}else if(o!==t){if(l=s===t&&Y.isFunction(o),c&&(l?(l=n,n=function(e,t,n){return l.call(Y(e),n)}):(n.call(e,o),n=null)),n)for(;p>u;u++)n(e[u],r,l?o.call(e[u],u,n(e[u],r)):o,s);i=1}return i?e:c?n.call(e):p?n(e[0],r):a},now:function(){return(new Date).getTime()}}),Y.ready.promise=function(t){if(!B)if(B=Y.Deferred(),"complete"===$.readyState)setTimeout(Y.ready,1);else if($.addEventListener)$.addEventListener("DOMContentLoaded",ft,!1),e.addEventListener("load",Y.ready,!1);else{$.attachEvent("onreadystatechange",ft),e.attachEvent("onload",Y.ready);var n=!1;try{n=null==e.frameElement&&$.documentElement}catch(r){}n&&n.doScroll&&function o(){if(!Y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}Y.ready()}}()}return B.promise(t)},Y.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){dt["[object "+t+"]"]=t.toLowerCase()}),P=Y($);var ht={};Y.Callbacks=function(e){e="string"==typeof e?ht[e]||n(e):Y.extend({},e);var r,o,i,a,s,l,c=[],u=!e.once&&[],p=function(t){for(r=e.memory&&t,o=!0,l=a||0,a=0,s=c.length,i=!0;c&&s>l;l++)if(c[l].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}i=!1,c&&(u?u.length&&p(u.shift()):r?c=[]:f.disable())},f={add:function(){if(c){var t=c.length;(function n(t){Y.each(t,function(t,r){var o=Y.type(r);"function"===o?e.unique&&f.has(r)||c.push(r):r&&r.length&&"string"!==o&&n(r)})})(arguments),i?s=c.length:r&&(a=t,p(r))}return this},remove:function(){return c&&Y.each(arguments,function(e,t){for(var n;(n=Y.inArray(t,c,n))>-1;)c.splice(n,1),i&&(s>=n&&s--,l>=n&&l--)}),this},has:function(e){return Y.inArray(e,c)>-1},empty:function(){return c=[],this},disable:function(){return c=u=r=t,this},disabled:function(){return!c},lock:function(){return u=t,r||f.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!c||o&&!u||(i?u.push(t):p(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},Y.extend({Deferred:function(e){var t=[["resolve","done",Y.Callbacks("once memory"),"resolved"],["reject","fail",Y.Callbacks("once memory"),"rejected"],["notify","progress",Y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Y.Deferred(function(n){Y.each(t,function(t,r){var i=r[0],a=e[t];o[r[1]](Y.isFunction(a)?function(){var e=a.apply(this,arguments);e&&Y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i+"With"](this===o?n:this,[e])}:n[i])}),e=null}).promise()},promise:function(e){return null!=e?Y.extend(e,r):r}},o={};return r.pipe=r.then,Y.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=a.fire,o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=X.call(arguments),a=i.length,s=1!==a||e&&Y.isFunction(e.promise)?a:0,l=1===s?e:Y.Deferred(),c=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?X.call(arguments):o,r===t?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(a>1)for(t=Array(a),n=Array(a),r=Array(a);a>o;o++)i[o]&&Y.isFunction(i[o].promise)?i[o].promise().done(c(o,r,i)).fail(l.reject).progress(c(o,n,t)):--s;return s||l.resolveWith(r,i),l.promise()}}),Y.support=function(){var n,r,o,i,a,s,l,c,u,p,f,d=$.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=d.getElementsByTagName("*"),o=d.getElementsByTagName("a")[0],!r||!o||!r.length)return{};i=$.createElement("select"),a=i.appendChild($.createElement("option")),s=d.getElementsByTagName("input")[0],o.style.cssText="top:1px;float:left;opacity:.5",n={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(o.getAttribute("style")),hrefNormalized:"/a"===o.getAttribute("href"),opacity:/^0.5/.test(o.style.opacity),cssFloat:!!o.style.cssFloat,checkOn:"on"===s.value,optSelected:a.selected,getSetAttribute:"t"!==d.className,enctype:!!$.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==$.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===$.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,n.noCloneChecked=s.cloneNode(!0).checked,i.disabled=!0,n.optDisabled=!a.disabled;try{delete d.test}catch(h){n.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",f=function(){n.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",f)),s=$.createElement("input"),s.value="t",s.setAttribute("type","radio"),n.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),d.appendChild(s),l=$.createDocumentFragment(),l.appendChild(d.lastChild),n.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,n.appendChecked=s.checked,l.removeChild(s),l.appendChild(d),d.attachEvent)for(u in{submit:!0,change:!0,focusin:!0})c="on"+u,p=c in d,p||(d.setAttribute(c,"return;"),p="function"==typeof d[c]),n[u+"Bubbles"]=p;return Y(function(){var r,o,i,a,s="padding:0;margin:0;border:0;display:block;overflow:hidden;",l=$.getElementsByTagName("body")[0];l&&(r=$.createElement("div"),r.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",l.insertBefore(r,l.firstChild),o=$.createElement("div"),r.appendChild(o),o.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=o.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",n.reliableHiddenOffsets=p&&0===i[0].offsetHeight,o.innerHTML="",o.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%;",n.boxSizing=4===o.offsetWidth,n.doesNotIncludeMarginInBodyOffset=1!==l.offsetTop,e.getComputedStyle&&(n.pixelPosition="1%"!==(e.getComputedStyle(o,null)||{}).top,n.boxSizingReliable="4px"===(e.getComputedStyle(o,null)||{width:"4px"}).width,a=$.createElement("div"),a.style.cssText=o.style.cssText=s,a.style.marginRight=a.style.width="0",o.style.width="1px",o.appendChild(a),n.reliableMarginRight=!parseFloat((e.getComputedStyle(a,null)||{}).marginRight)),o.style.zoom!==t&&(o.innerHTML="",o.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",n.inlineBlockNeedsLayout=3===o.offsetWidth,o.style.display="block",o.style.overflow="visible",o.innerHTML="<div></div>",o.firstChild.style.width="5px",n.shrinkWrapBlocks=3!==o.offsetWidth,r.style.zoom=1),l.removeChild(r),r=o=i=a=null)}),l.removeChild(d),r=o=i=a=s=l=d=null,n}();var gt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Y.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Y.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Y.cache[e[Y.expando]]:e[Y.expando],!!e&&!o(e)},data:function(e,n,r,o){if(Y.acceptData(e)){var i,a,s=Y.expando,l="string"==typeof n,c=e.nodeType,u=c?Y.cache:e,p=c?e[s]:e[s]&&s;if(p&&u[p]&&(o||u[p].data)||!l||r!==t)return p||(c?e[s]=p=Y.deletedIds.pop()||Y.guid++:p=s),u[p]||(u[p]={},c||(u[p].toJSON=Y.noop)),("object"==typeof n||"function"==typeof n)&&(o?u[p]=Y.extend(u[p],n):u[p].data=Y.extend(u[p].data,n)),i=u[p],o||(i.data||(i.data={}),i=i.data),r!==t&&(i[Y.camelCase(n)]=r),l?(a=i[n],null==a&&(a=i[Y.camelCase(n)])):a=i,a}},removeData:function(e,t,n){if(Y.acceptData(e)){var r,i,a,s=e.nodeType,l=s?Y.cache:e,c=s?e[Y.expando]:Y.expando;if(l[c]){if(t&&(r=n?l[c]:l[c].data)){Y.isArray(t)||(t in r?t=[t]:(t=Y.camelCase(t),t=t in r?[t]:t.split(" ")));for(i=0,a=t.length;a>i;i++)delete r[t[i]];if(!(n?o:Y.isEmptyObject)(r))return}(n||(delete l[c].data,o(l[c])))&&(s?Y.cleanData([e],!0):Y.support.deleteExpando||l!=l.window?delete l[c]:l[c]=null)}}},_data:function(e,t,n){return Y.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&Y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Y.fn.extend({data:function(e,n){var o,i,a,s,l,c=this[0],u=0,p=null;if(e===t){if(this.length&&(p=Y.data(c),1===c.nodeType&&!Y._data(c,"parsedAttrs"))){for(a=c.attributes,l=a.length;l>u;u++)s=a[u].name,s.indexOf("data-")||(s=Y.camelCase(s.substring(5)),r(c,s,p[s]));Y._data(c,"parsedAttrs",!0)}return p}return"object"==typeof e?this.each(function(){Y.data(this,e)}):(o=e.split(".",2),o[1]=o[1]?"."+o[1]:"",i=o[1]+"!",Y.access(this,function(n){return n===t?(p=this.triggerHandler("getData"+i,[o[0]]),p===t&&c&&(p=Y.data(c,e),p=r(c,e,p)),p===t&&o[1]?this.data(o[0]):p):(o[1]=n,this.each(function(){var t=Y(this);t.triggerHandler("setData"+i,o),Y.data(this,e,n),t.triggerHandler("changeData"+i,o)}),t)},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Y.removeData(this,e)})}}),Y.extend({queue:function(e,n,r){var o;return e?(n=(n||"fx")+"queue",o=Y._data(e,n),r&&(!o||Y.isArray(r)?o=Y._data(e,n,Y.makeArray(r)):o.push(r)),o||[]):t},dequeue:function(e,t){t=t||"fx";var n=Y.queue(e,t),r=n.length,o=n.shift(),i=Y._queueHooks(e,t),a=function(){Y.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y._data(e,n)||Y._data(e,n,{empty:Y.Callbacks("once memory").add(function(){Y.removeData(e,t+"queue",!0),Y.removeData(e,n,!0)})})}}),Y.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?Y.queue(this[0],e):n===t?this:this.each(function(){var t=Y.queue(this,e,n);Y._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&Y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Y.dequeue(this,e)})},delay:function(e,t){return e=Y.fx?Y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,o=1,i=Y.Deferred(),a=this,s=this.length,l=function(){--o||i.resolveWith(a,[a])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";s--;)r=Y._data(a[s],e+"queueHooks"),r&&r.empty&&(o++,r.empty.add(l));return l(),i.promise(n)}});var yt,vt,bt,xt=/[\t\r\n]/g,wt=/\r/g,_t=/^(?:button|input)$/i,Ct=/^(?:button|input|object|select|textarea)$/i,At=/^a(?:rea|)$/i,Tt=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,kt=Y.support.getSetAttribute;Y.fn.extend({attr:function(e,t){return Y.access(this,Y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Y.removeAttr(this,e)})},prop:function(e,t){return Y.access(this,Y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,o,i,a,s;if(Y.isFunction(e))return this.each(function(t){Y(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),n=0,r=this.length;r>n;n++)if(o=this[n],1===o.nodeType)if(o.className||1!==t.length){for(i=" "+o.className+" ",a=0,s=t.length;s>a;a++)0>i.indexOf(" "+t[a]+" ")&&(i+=t[a]+" ");o.className=Y.trim(i)}else o.className=e;return this},removeClass:function(e){var n,r,o,i,a,s,l;if(Y.isFunction(e))return this.each(function(t){Y(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(n=(e||"").split(tt),s=0,l=this.length;l>s;s++)if(o=this[s],1===o.nodeType&&o.className){for(r=(" "+o.className+" ").replace(xt," "),i=0,a=n.length;a>i;i++)for(;r.indexOf(" "+n[i]+" ")>=0;)r=r.replace(" "+n[i]+" "," ");o.className=e?Y.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return Y.isFunction(e)?this.each(function(n){Y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var o,i=0,a=Y(this),s=t,l=e.split(tt);o=l[i++];)s=r?s:!a.hasClass(o),a[s?"addClass":"removeClass"](o);else("undefined"===n||"boolean"===n)&&(this.className&&Y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Y._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(xt," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,o,i=this[0];{if(arguments.length)return o=Y.isFunction(e),this.each(function(r){var i,a=Y(this);1===this.nodeType&&(i=o?e.call(this,r,a.val()):e,null==i?i="":"number"==typeof i?i+="":Y.isArray(i)&&(i=Y.map(i,function(e){return null==e?"":e+""})),n=Y.valHooks[this.type]||Y.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,i,"value")!==t||(this.value=i))});if(i)return n=Y.valHooks[i.type]||Y.valHooks[i.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(i,"value"))!==t?r:(r=i.value,"string"==typeof r?r.replace(wt,""):null==r?"":r)}}}),Y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,o=e.selectedIndex,i="select-one"===e.type||0>o,a=i?null:[],s=i?o+1:r.length,l=0>o?s:i?o:0;s>l;l++)if(n=r[l],!(!n.selected&&l!==o||(Y.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&Y.nodeName(n.parentNode,"optgroup"))){if(t=Y(n).val(),i)return t;a.push(t)}return a},set:function(e,t){var n=Y.makeArray(t);return Y(e).find("option").each(function(){this.selected=Y.inArray(Y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,o){var i,a,s,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return o&&Y.isFunction(Y.fn[n])?Y(e)[n](r):e.getAttribute===t?Y.prop(e,n,r):(s=1!==l||!Y.isXMLDoc(e),s&&(n=n.toLowerCase(),a=Y.attrHooks[n]||(Tt.test(n)?vt:yt)),r!==t?null===r?(Y.removeAttr(e,n),t):a&&"set"in a&&s&&(i=a.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r):a&&"get"in a&&s&&null!==(i=a.get(e,n))?i:(i=e.getAttribute(n),null===i?t:i))},removeAttr:function(e,t){var n,r,o,i,a=0;if(t&&1===e.nodeType)for(r=t.split(tt);r.length>a;a++)o=r[a],o&&(n=Y.propFix[o]||o,i=Tt.test(o),i||Y.attr(e,o,""),e.removeAttribute(kt?o:n),i&&n in e&&(e[n]=!1))},attrHooks:{type:{set:function(e,t){if(_t.test(e.nodeName)&&e.parentNode)Y.error("type property can't be changed");else if(!Y.support.radioValue&&"radio"===t&&Y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return yt&&Y.nodeName(e,"button")?yt.get(e,t):t in e?e.value:null},set:function(e,n,r){return yt&&Y.nodeName(e,"button")?yt.set(e,n,r):(e.value=n,t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var o,i,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!Y.isXMLDoc(e),a&&(n=Y.propFix[n]||n,i=Y.propHooks[n]),r!==t?i&&"set"in i&&(o=i.set(e,r,n))!==t?o:e[n]=r:i&&"get"in i&&null!==(o=i.get(e,n))?o:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):Ct.test(e.nodeName)||At.test(e.nodeName)&&e.href?0:t}}}}),vt={get:function(e,n){var r,o=Y.prop(e,n);return o===!0||"boolean"!=typeof o&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?Y.removeAttr(e,n):(r=Y.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},kt||(bt={name:!0,id:!0,coords:!0},yt=Y.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(bt[n]?""!==r.value:r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=$.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},Y.each(["width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})}),Y.attrHooks.contenteditable={get:yt.get,set:function(e,t,n){""===t&&(t="false"),yt.set(e,t,n) }}),Y.support.hrefNormalized||Y.each(["href","src","width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null===r?t:r}})}),Y.support.style||(Y.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),Y.support.optSelected||(Y.propHooks.selected=Y.extend(Y.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Y.support.enctype||(Y.propFix.enctype="encoding"),Y.support.checkOn||Y.each(["radio","checkbox"],function(){Y.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),Y.each(["radio","checkbox"],function(){Y.valHooks[this]=Y.extend(Y.valHooks[this],{set:function(e,n){return Y.isArray(n)?e.checked=Y.inArray(Y(e).val(),n)>=0:t}})});var Et=/^(?:textarea|input|select)$/i,Ft=/^([^\.]*|)(?:\.(.+)|)$/,Nt=/(?:^|\s)hover(\.\S+|)\b/,St=/^key/,jt=/^(?:mouse|contextmenu)|click/,Rt=/^(?:focusinfocus|focusoutblur)$/,Ot=function(e){return Y.event.special.hover?e:e.replace(Nt,"mouseenter$1 mouseleave$1")};Y.event={add:function(e,n,r,o,i){var a,s,l,c,u,p,f,d,h,g,m;if(3!==e.nodeType&&8!==e.nodeType&&n&&r&&(a=Y._data(e))){for(r.handler&&(h=r,r=h.handler,i=h.selector),r.guid||(r.guid=Y.guid++),l=a.events,l||(a.events=l={}),s=a.handle,s||(a.handle=s=function(e){return Y===t||e&&Y.event.triggered===e.type?t:Y.event.dispatch.apply(s.elem,arguments)},s.elem=e),n=Y.trim(Ot(n)).split(" "),c=0;n.length>c;c++)u=Ft.exec(n[c])||[],p=u[1],f=(u[2]||"").split(".").sort(),m=Y.event.special[p]||{},p=(i?m.delegateType:m.bindType)||p,m=Y.event.special[p]||{},d=Y.extend({type:p,origType:u[1],data:o,handler:r,guid:r.guid,selector:i,needsContext:i&&Y.expr.match.needsContext.test(i),namespace:f.join(".")},h),g=l[p],g||(g=l[p]=[],g.delegateCount=0,m.setup&&m.setup.call(e,o,f,s)!==!1||(e.addEventListener?e.addEventListener(p,s,!1):e.attachEvent&&e.attachEvent("on"+p,s))),m.add&&(m.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),i?g.splice(g.delegateCount++,0,d):g.push(d),Y.event.global[p]=!0;e=null}},global:{},remove:function(e,t,n,r,o){var i,a,s,l,c,u,p,f,d,h,g,m=Y.hasData(e)&&Y._data(e);if(m&&(f=m.events)){for(t=Y.trim(Ot(t||"")).split(" "),i=0;t.length>i;i++)if(a=Ft.exec(t[i])||[],s=l=a[1],c=a[2],s){for(d=Y.event.special[s]||{},s=(r?d.delegateType:d.bindType)||s,h=f[s]||[],u=h.length,c=c?RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0;h.length>p;p++)g=h[p],!o&&l!==g.origType||n&&n.guid!==g.guid||c&&!c.test(g.namespace)||r&&r!==g.selector&&("**"!==r||!g.selector)||(h.splice(p--,1),g.selector&&h.delegateCount--,d.remove&&d.remove.call(e,g));0===h.length&&u!==h.length&&(d.teardown&&d.teardown.call(e,c,m.handle)!==!1||Y.removeEvent(e,s,m.handle),delete f[s])}else for(s in f)Y.event.remove(e,s+t[i],n,r,!0);Y.isEmptyObject(f)&&(delete m.handle,Y.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,o,i){if(!o||3!==o.nodeType&&8!==o.nodeType){var a,s,l,c,u,p,f,d,h,g,m=n.type||n,y=[];if(!Rt.test(m+Y.event.triggered)&&(m.indexOf("!")>=0&&(m=m.slice(0,-1),s=!0),m.indexOf(".")>=0&&(y=m.split("."),m=y.shift(),y.sort()),o&&!Y.event.customEvent[m]||Y.event.global[m]))if(n="object"==typeof n?n[Y.expando]?n:new Y.Event(m,n):new Y.Event(m),n.type=m,n.isTrigger=!0,n.exclusive=s,n.namespace=y.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0>m.indexOf(":")?"on"+m:"",o){if(n.result=t,n.target||(n.target=o),r=null!=r?Y.makeArray(r):[],r.unshift(n),f=Y.event.special[m]||{},!f.trigger||f.trigger.apply(o,r)!==!1){if(h=[[o,f.bindType||m]],!i&&!f.noBubble&&!Y.isWindow(o)){for(g=f.delegateType||m,c=Rt.test(g+m)?o:o.parentNode,u=o;c;c=c.parentNode)h.push([c,g]),u=c;u===(o.ownerDocument||$)&&h.push([u.defaultView||u.parentWindow||e,g])}for(l=0;h.length>l&&!n.isPropagationStopped();l++)c=h[l][0],n.type=h[l][1],d=(Y._data(c,"events")||{})[n.type]&&Y._data(c,"handle"),d&&d.apply(c,r),d=p&&c[p],d&&Y.acceptData(c)&&d.apply&&d.apply(c,r)===!1&&n.preventDefault();return n.type=m,i||n.isDefaultPrevented()||f._default&&f._default.apply(o.ownerDocument,r)!==!1||"click"===m&&Y.nodeName(o,"a")||!Y.acceptData(o)||p&&o[m]&&("focus"!==m&&"blur"!==m||0!==n.target.offsetWidth)&&!Y.isWindow(o)&&(u=o[p],u&&(o[p]=null),Y.event.triggered=m,o[m](),Y.event.triggered=t,u&&(o[p]=u)),n.result}}else{a=Y.cache;for(l in a)a[l].events&&a[l].events[m]&&Y.event.trigger(n,r,a[l].handle.elem,!0)}}},dispatch:function(n){n=Y.event.fix(n||e.event);var r,o,i,a,s,l,c,u,p,f=(Y._data(this,"events")||{})[n.type]||[],d=f.delegateCount,h=X.call(arguments),g=!n.exclusive&&!n.namespace,m=Y.event.special[n.type]||{},y=[];if(h[0]=n,n.delegateTarget=this,!m.preDispatch||m.preDispatch.call(this,n)!==!1){if(d&&(!n.button||"click"!==n.type))for(i=n.target;i!=this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==n.type){for(s={},c=[],r=0;d>r;r++)u=f[r],p=u.selector,s[p]===t&&(s[p]=u.needsContext?Y(p,this).index(i)>=0:Y.find(p,this,null,[i]).length),s[p]&&c.push(u);c.length&&y.push({elem:i,matches:c})}for(f.length>d&&y.push({elem:this,matches:f.slice(d)}),r=0;y.length>r&&!n.isPropagationStopped();r++)for(l=y[r],n.currentTarget=l.elem,o=0;l.matches.length>o&&!n.isImmediatePropagationStopped();o++)u=l.matches[o],(g||!n.namespace&&!u.namespace||n.namespace_re&&n.namespace_re.test(u.namespace))&&(n.data=u.data,n.handleObj=u,a=((Y.event.special[u.origType]||{}).handle||u.handler).apply(l.elem,h),a!==t&&(n.result=a,a===!1&&(n.preventDefault(),n.stopPropagation())));return m.postDispatch&&m.postDispatch.call(this,n),n.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,o,i,a=n.button,s=n.fromElement;return null==e.pageX&&null!=n.clientX&&(r=e.target.ownerDocument||$,o=r.documentElement,i=r.body,e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?n.toElement:s),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[Y.expando])return e;var t,n,r=e,o=Y.event.fixHooks[e.type]||{},i=o.props?this.props.concat(o.props):this.props;for(e=Y.Event(r),t=i.length;t;)n=i[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||$),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,o.filter?o.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){Y.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var o=Y.extend(new Y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?Y.event.trigger(o,null,t):Y.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},Y.event.handle=Y.event.dispatch,Y.removeEvent=$.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,n,r){var o="on"+n;e.detachEvent&&(e[o]===t&&(e[o]=null),e.detachEvent(o,r))},Y.Event=function(e,n){return this instanceof Y.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?a:i):this.type=e,n&&Y.extend(this,n),this.timeStamp=e&&e.timeStamp||Y.now(),this[Y.expando]=!0,t):new Y.Event(e,n)},Y.Event.prototype={preventDefault:function(){this.isDefaultPrevented=a;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=a;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=a,this.stopPropagation()},isDefaultPrevented:i,isPropagationStopped:i,isImmediatePropagationStopped:i},Y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return i.selector,(!o||o!==r&&!Y.contains(r,o))&&(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),Y.support.submitBubbles||(Y.event.special.submit={setup:function(){return Y.nodeName(this,"form")?!1:(Y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=Y.nodeName(n,"input")||Y.nodeName(n,"button")?n.form:t;r&&!Y._data(r,"_submit_attached")&&(Y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),Y._data(r,"_submit_attached",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return Y.nodeName(this,"form")?!1:(Y.event.remove(this,"._submit"),t)}}),Y.support.changeBubbles||(Y.event.special.change={setup:function(){return Et.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Y.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),Y.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),Y.event.simulate("change",this,e,!0)})),!1):(Y.event.add(this,"beforeactivate._change",function(e){var t=e.target;Et.test(t.nodeName)&&!Y._data(t,"_change_attached")&&(Y.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||Y.event.simulate("change",this.parentNode,e,!0)}),Y._data(t,"_change_attached",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return Y.event.remove(this,"._change"),!Et.test(this.nodeName)}}),Y.support.focusinBubbles||Y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){Y.event.simulate(t,e.target,Y.event.fix(e),!0)};Y.event.special[t]={setup:function(){0===n++&&$.addEventListener(e,r,!0)},teardown:function(){0===--n&&$.removeEventListener(e,r,!0)}}}),Y.fn.extend({on:function(e,n,r,o,a){var s,l;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(l in e)this.on(l,n,r,e[l],a);return this}if(null==r&&null==o?(o=n,r=n=t):null==o&&("string"==typeof n?(o=r,r=t):(o=r,r=n,n=t)),o===!1)o=i;else if(!o)return this;return 1===a&&(s=o,o=function(e){return Y().off(e),s.apply(this,arguments)},o.guid=s.guid||(s.guid=Y.guid++)),this.each(function(){Y.event.add(this,e,o,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var o,a;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,Y(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(a in e)this.off(a,n,e[a]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=i),this.each(function(){Y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return Y(this.context).on(e,this.selector,t,n),this},die:function(e,t){return Y(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){Y.event.trigger(e,t,this)})},triggerHandler:function(e,n){return this[0]?Y.event.trigger(e,n,this[0],!0):t},toggle:function(e){var t=arguments,n=e.guid||Y.guid++,r=0,o=function(n){var o=(Y._data(this,"lastToggle"+e.guid)||0)%r;return Y._data(this,"lastToggle"+e.guid,o+1),n.preventDefault(),t[o].apply(this,arguments)||!1};for(o.guid=n;t.length>r;)t[r++].guid=n;return this.click(o)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Y.fn[t]=function(e,n){return null==n&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},St.test(t)&&(Y.event.fixHooks[t]=Y.event.keyHooks),jt.test(t)&&(Y.event.fixHooks[t]=Y.event.mouseHooks)}),/*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ function(e,t){function n(e,t,n,r){n=n||[],t=t||j;var o,i,a,s,l=t.nodeType;if(!e||"string"!=typeof e)return n;if(1!==l&&9!==l)return[];if(a=w(t),!a&&!r&&(o=nt.exec(e)))if(s=o[1]){if(9===l){if(i=t.getElementById(s),!i||!i.parentNode)return n;if(i.id===s)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(s))&&_(t,i)&&i.id===s)return n.push(i),n}else{if(o[2])return I.apply(n,D.call(t.getElementsByTagName(e),0)),n;if((s=o[3])&&ft&&t.getElementsByClassName)return I.apply(n,D.call(t.getElementsByClassName(s),0)),n}return g(e.replace(G,"$1"),t,n,r,a)}function r(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function o(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function i(e){return P(function(t){return t=+t,P(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function a(e,t,n){if(e===t)return n;for(var r=e.nextSibling;r;){if(r===t)return-1;r=r.nextSibling}return 1}function s(e,t){var r,o,i,a,s,l,c,u=q[N][e+" "];if(u)return t?0:u.slice(0);for(s=e,l=[],c=b.preFilter;s;){(!r||(o=Z.exec(s)))&&(o&&(s=s.slice(o[0].length)||s),l.push(i=[])),r=!1,(o=et.exec(s))&&(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=o[0].replace(G," "));for(a in b.filter)!(o=st[a].exec(s))||c[a]&&!(o=c[a](o))||(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=a,r.matches=o);if(!r)break}return t?s.length:s?n.error(e):q(e,l).slice(0)}function l(e,t,n){var r=t.dir,o=n&&"parentNode"===t.dir,i=M++;return t.first?function(t,n,i){for(;t=t[r];)if(o||1===t.nodeType)return e(t,n,i)}:function(t,n,a){if(a){for(;t=t[r];)if((o||1===t.nodeType)&&e(t,n,a))return t}else for(var s,l=O+" "+i+" ",c=l+y;t=t[r];)if(o||1===t.nodeType){if((s=t[N])===c)return t.sizset;if("string"==typeof s&&0===s.indexOf(l)){if(t.sizset)return t}else{if(t[N]=c,e(t,n,a))return t.sizset=!0,t;t.sizset=!1}}}}function c(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function u(e,t,n,r,o){for(var i,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(i=e[s])&&(!n||n(i,r,o))&&(a.push(i),c&&t.push(s));return a}function p(e,t,n,r,o,i){return r&&!r[N]&&(r=p(r)),o&&!o[N]&&(o=p(o,i)),P(function(i,a,s,l){var c,p,f,d=[],g=[],m=a.length,y=i||h(t||"*",s.nodeType?[s]:s,[]),v=!e||!i&&t?y:u(y,d,e,s,l),b=n?o||(i?e:m||r)?[]:a:v;if(n&&n(v,b,s,l),r)for(c=u(b,g),r(c,[],s,l),p=c.length;p--;)(f=c[p])&&(b[g[p]]=!(v[g[p]]=f));if(i){if(o||e){if(o){for(c=[],p=b.length;p--;)(f=b[p])&&c.push(v[p]=f);o(null,b=[],c,l)}for(p=b.length;p--;)(f=b[p])&&(c=o?L.call(i,f):d[p])>-1&&(i[c]=!(a[c]=f))}}else b=u(b===a?b.splice(m,b.length):b),o?o(null,a,b,l):I.apply(a,b)})}function f(e){for(var t,n,r,o=e.length,i=b.relative[e[0].type],a=i||b.relative[" "],s=i?1:0,u=l(function(e){return e===t},a,!0),d=l(function(e){return L.call(t,e)>-1},a,!0),h=[function(e,n,r){return!i&&(r||n!==k)||((t=n).nodeType?u(e,n,r):d(e,n,r))}];o>s;s++)if(n=b.relative[e[s].type])h=[l(c(h),n)];else{if(n=b.filter[e[s].type].apply(null,e[s].matches),n[N]){for(r=++s;o>r&&!b.relative[e[r].type];r++);return p(s>1&&c(h),s>1&&e.slice(0,s-1).join("").replace(G,"$1"),n,r>s&&f(e.slice(s,r)),o>r&&f(e=e.slice(r)),o>r&&e.join(""))}h.push(n)}return c(h)}function d(e,t){var r=t.length>0,o=e.length>0,i=function(a,s,l,c,p){var f,d,h,g=[],m=0,v="0",x=a&&[],w=null!=p,_=k,C=a||o&&b.find.TAG("*",p&&s.parentNode||s),A=O+=null==_?1:Math.E;for(w&&(k=s!==j&&s,y=i.el);null!=(f=C[v]);v++){if(o&&f){for(d=0;h=e[d];d++)if(h(f,s,l)){c.push(f);break}w&&(O=A,y=++i.el)}r&&((f=!h&&f)&&m--,a&&x.push(f))}if(m+=v,r&&v!==m){for(d=0;h=t[d];d++)h(x,g,s,l);if(a){if(m>0)for(;v--;)x[v]||g[v]||(g[v]=H.call(c));g=u(g)}I.apply(c,g),w&&!a&&g.length>0&&m+t.length>1&&n.uniqueSort(c)}return w&&(O=A,k=_),x};return i.el=0,r?P(i):i}function h(e,t,r){for(var o=0,i=t.length;i>o;o++)n(e,t[o],r);return r}function g(e,t,n,r,o){var i,a,l,c,u,p=s(e);if(p.length,!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(l=a[0]).type&&9===t.nodeType&&!o&&b.relative[a[1].type]){if(t=b.find.ID(l.matches[0].replace(at,""),t,o)[0],!t)return n;e=e.slice(a.shift().length)}for(i=st.POS.test(e)?-1:a.length-1;i>=0&&(l=a[i],!b.relative[c=l.type]);i--)if((u=b.find[c])&&(r=u(l.matches[0].replace(at,""),rt.test(a[0].type)&&t.parentNode||t,o))){if(a.splice(i,1),e=r.length&&a.join(""),!e)return I.apply(n,D.call(r,0)),n;break}}return C(e,p)(r,t,o,n,rt.test(e)),n}function m(){}var y,v,b,x,w,_,C,A,T,k,E=!0,F="undefined",N=("sizcache"+Math.random()).replace(".",""),S=String,j=e.document,R=j.documentElement,O=0,M=0,H=[].pop,I=[].push,D=[].slice,L=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},P=function(e,t){return e[N]=null==t||t,e},B=function(){var e={},t=[];return P(function(n,r){return t.push(n)>b.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},$=B(),q=B(),W=B(),U="[\\x20\\t\\r\\n\\f]",Q="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",z=Q.replace("w","w#"),X="([*^$|!~]?=)",J="\\["+U+"*("+Q+")"+U+"*(?:"+X+U+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+z+")|)|)"+U+"*\\]",V=":("+Q+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+J+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+U+"*((?:-\\d)?\\d*)"+U+"*\\)|)(?=[^-]|$)",G=RegExp("^"+U+"+|((?:^|[^\\\\])(?:\\\\.)*)"+U+"+$","g"),Z=RegExp("^"+U+"*,"+U+"*"),et=RegExp("^"+U+"*([\\x20\\t\\r\\n\\f>+~])"+U+"*"),tt=RegExp(V),nt=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rt=/[\x20\t\r\n\f]*[+~]/,ot=/h\d/i,it=/input|select|textarea|button/i,at=/\\(?!\\)/g,st={ID:RegExp("^#("+Q+")"),CLASS:RegExp("^\\.("+Q+")"),NAME:RegExp("^\\[name=['\"]?("+Q+")['\"]?\\]"),TAG:RegExp("^("+Q.replace("w","w*")+")"),ATTR:RegExp("^"+J),PSEUDO:RegExp("^"+V),POS:RegExp(K,"i"),CHILD:RegExp("^:(only|nth|first|last)-child(?:\\("+U+"*(even|odd|(([+-]|)(\\d*)n|)"+U+"*(?:([+-]|)"+U+"*(\\d+)|))"+U+"*\\)|)","i"),needsContext:RegExp("^"+U+"*[>+~]|"+K,"i")},lt=function(e){var t=j.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},ct=lt(function(e){return e.appendChild(j.createComment("")),!e.getElementsByTagName("*").length}),ut=lt(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==F&&"#"===e.firstChild.getAttribute("href")}),pt=lt(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),ft=lt(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),dt=lt(function(e){e.id=N+0,e.innerHTML="<a name='"+N+"'></a><div name='"+N+"'></div>",R.insertBefore(e,R.firstChild);var t=j.getElementsByName&&j.getElementsByName(N).length===2+j.getElementsByName(N+0).length;return v=!j.getElementById(N),R.removeChild(e),t});try{D.call(R.childNodes,0)[0].nodeType}catch(ht){D=function(e){for(var t,n=[];t=this[e];e++)n.push(t);return n}}n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){return n(t,null,null,[e]).length>0},x=n.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=x(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=x(t);return n},w=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},_=n.contains=R.contains?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&n.contains&&n.contains(r))}:R.compareDocumentPosition?function(e,t){return t&&!!(16&e.compareDocumentPosition(t))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},n.attr=function(e,t){var n,r=w(e);return r||(t=t.toLowerCase()),(n=b.attrHandle[t])?n(e):r||pt?e.getAttribute(t):(n=e.getAttributeNode(t),n?"boolean"==typeof e[t]?e[t]?t:null:n.specified?n.value:null:null)},b=n.selectors={cacheLength:50,createPseudo:P,match:st,attrHandle:ut?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:v?function(e,t,n){if(typeof t.getElementById!==F&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==F&&!r){var o=n.getElementById(e);return o?o.id===e||typeof o.getAttributeNode!==F&&o.getAttributeNode("id").value===e?[o]:t:[]}},TAG:ct?function(e,n){return typeof n.getElementsByTagName!==F?n.getElementsByTagName(e):t}:function(e,t){var n=t.getElementsByTagName(e);if("*"===e){for(var r,o=[],i=0;r=n[i];i++)1===r.nodeType&&o.push(r);return o}return n},NAME:dt&&function(e,n){return typeof n.getElementsByName!==F?n.getElementsByName(name):t},CLASS:ft&&function(e,n,r){return typeof n.getElementsByClassName===F||r?t:n.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(at,""),e[3]=(e[4]||e[5]||"").replace(at,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||n.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&n.error(e[0]),e},PSEUDO:function(e){var t,n;return st.CHILD.test(e[0])?null:(e[3]?e[2]=e[3]:(t=e[4])&&(tt.test(t)&&(n=s(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t),e.slice(0,3))}},filter:{ID:v?function(e){return e=e.replace(at,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(at,""),function(t){var n=typeof t.getAttributeNode!==F&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(at,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=$[N][e+" "];return t||(t=RegExp("(^|"+U+")"+e+"("+U+"|$)"))&&$(e,function(e){return t.test(e.className||typeof e.getAttribute!==F&&e.getAttribute("class")||"")})},ATTR:function(e,t,r){return function(o){var i=n.attr(o,e);return null==i?"!="===t:t?(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.substr(i.length-r.length)===r:"~="===t?(" "+i+" ").indexOf(r)>-1:"|="===t?i===r||i.substr(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r){return"nth"===e?function(e){var t,o,i=e.parentNode;if(1===n&&0===r)return!0;if(i)for(o=0,t=i.firstChild;t&&(1!==t.nodeType||(o++,e!==t));t=t.nextSibling);return o-=r,o===n||0===o%n&&o/n>=0}:function(t){var n=t;switch(e){case"only":case"first":for(;n=n.previousSibling;)if(1===n.nodeType)return!1;if("first"===e)return!0;n=t;case"last":for(;n=n.nextSibling;)if(1===n.nodeType)return!1;return!0}}},PSEUDO:function(e,t){var r,o=b.pseudos[e]||b.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return o[N]?o(t):o.length>1?(r=[e,e,"",t],b.setFilters.hasOwnProperty(e.toLowerCase())?P(function(e,n){for(var r,i=o(e,t),a=i.length;a--;)r=L.call(e,i[a]),e[r]=!(n[r]=i[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:P(function(e){var t=[],n=[],r=C(e.replace(G,"$1"));return r[N]?P(function(e,t,n,o){for(var i,a=r(e,null,o,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:P(function(e){return function(t){return n(e,t).length>0}}),contains:P(function(e){return function(t){return(t.textContent||t.innerText||x(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!b.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},header:function(e){return ot.test(e.nodeName)},text:function(e){var t,n;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(n=e.getAttribute("type"))||n.toLowerCase()===t)},radio:r("radio"),checkbox:r("checkbox"),file:r("file"),password:r("password"),image:r("image"),submit:o("submit"),reset:o("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return it.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:i(function(){return[0]}),last:i(function(e,t){return[t-1]}),eq:i(function(e,t,n){return[0>n?n+t:n]}),even:i(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:i(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:i(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:i(function(e,t,n){for(var r=0>n?n+t:n;t>++r;)e.push(r);return e})}},A=R.compareDocumentPosition?function(e,t){return e===t?(T=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1}:function(e,t){if(e===t)return T=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,o=[],i=[],s=e.parentNode,l=t.parentNode,c=s;if(s===l)return a(e,t);if(!s)return-1;if(!l)return 1;for(;c;)o.unshift(c),c=c.parentNode;for(c=l;c;)i.unshift(c),c=c.parentNode;n=o.length,r=i.length;for(var u=0;n>u&&r>u;u++)if(o[u]!==i[u])return a(o[u],i[u]);return u===n?a(e,i[u],-1):a(o[u],t,1)},[0,0].sort(A),E=!T,n.uniqueSort=function(e){var t,n=[],r=1,o=0;if(T=E,e.sort(A),T){for(;t=e[r];r++)t===e[r-1]&&(o=n.push(r));for(;o--;)e.splice(n[o],1)}return e},n.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},C=n.compile=function(e,t){var n,r=[],o=[],i=W[N][e+" "];if(!i){for(t||(t=s(e)),n=t.length;n--;)i=f(t[n]),i[N]?r.push(i):o.push(i);i=W(e,d(o,r))}return i},j.querySelectorAll&&function(){var e,t=g,r=/'|\\/g,o=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],a=[":active"],l=R.matchesSelector||R.mozMatchesSelector||R.webkitMatchesSelector||R.oMatchesSelector||R.msMatchesSelector;lt(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+U+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),lt(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+U+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=RegExp(i.join("|")),g=function(e,n,o,a,l){if(!a&&!l&&!i.test(e)){var c,u,p=!0,f=N,d=n,h=9===n.nodeType&&e;if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){for(c=s(e),(p=n.getAttribute("id"))?f=p.replace(r,"\\$&"):n.setAttribute("id",f),f="[id='"+f+"'] ",u=c.length;u--;)c[u]=f+c[u].join("");d=rt.test(e)&&n.parentNode||n,h=c.join(",")}if(h)try{return I.apply(o,D.call(d.querySelectorAll(h),0)),o}catch(g){}finally{p||n.removeAttribute("id")}}return t(e,n,o,a,l)},l&&(lt(function(t){e=l.call(t,"div");try{l.call(t,"[test!='']:sizzle"),a.push("!=",V)}catch(n){}}),a=RegExp(a.join("|")),n.matchesSelector=function(t,r){if(r=r.replace(o,"='$1']"),!w(t)&&!a.test(r)&&!i.test(r))try{var s=l.call(t,r);if(s||e||t.document&&11!==t.document.nodeType)return s}catch(c){}return n(r,null,null,[t]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=m.prototype=b.pseudos,b.setFilters=new m,n.attr=Y.attr,Y.find=n,Y.expr=n.selectors,Y.expr[":"]=Y.expr.pseudos,Y.unique=n.uniqueSort,Y.text=n.getText,Y.isXMLDoc=n.isXML,Y.contains=n.contains}(e);var Mt=/Until$/,Ht=/^(?:parents|prev(?:Until|All))/,It=/^.[^:#\[\.,]*$/,Dt=Y.expr.match.needsContext,Lt={children:!0,contents:!0,next:!0,prev:!0};Y.fn.extend({find:function(e){var t,n,r,o,i,a,s=this;if("string"!=typeof e)return Y(e).filter(function(){for(t=0,n=s.length;n>t;t++)if(Y.contains(s[t],this))return!0});for(a=this.pushStack("","find",e),t=0,n=this.length;n>t;t++)if(r=a.length,Y.find(e,this[t],a),t>0)for(o=r;a.length>o;o++)for(i=0;r>i;i++)if(a[i]===a[o]){a.splice(o--,1);break}return a},has:function(e){var t,n=Y(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(Y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(c(this,e,!1),"not",e)},filter:function(e){return this.pushStack(c(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Dt.test(e)?Y(e,this.context).index(this[0])>=0:Y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,r=0,o=this.length,i=[],a=Dt.test(e)||"string"!=typeof e?Y(e,t||this.context):0;o>r;r++)for(n=this[r];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(a?a.index(n)>-1:Y.find.matchesSelector(n,e)){i.push(n);break}n=n.parentNode}return i=i.length>1?Y.unique(i):i,this.pushStack(i,"closest",e)},index:function(e){return e?"string"==typeof e?Y.inArray(this[0],Y(e)):Y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n="string"==typeof e?Y(e,t):Y.makeArray(e&&e.nodeType?[e]:e),r=Y.merge(this.get(),n);return this.pushStack(s(n[0])||s(r[0])?r:Y.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Y.fn.andSelf=Y.fn.addBack,Y.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Y.dir(e,"parentNode",n)},next:function(e){return l(e,"nextSibling")},prev:function(e){return l(e,"previousSibling")},nextAll:function(e){return Y.dir(e,"nextSibling")},prevAll:function(e){return Y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Y.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return Y.dir(e,"previousSibling",n)},siblings:function(e){return Y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Y.sibling(e.firstChild)},contents:function(e){return Y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Y.merge([],e.childNodes)}},function(e,t){Y.fn[e]=function(n,r){var o=Y.map(this,t,n);return Mt.test(e)||(r=n),r&&"string"==typeof r&&(o=Y.filter(r,o)),o=this.length>1&&!Lt[e]?Y.unique(o):o,this.length>1&&Ht.test(e)&&(o=o.reverse()),this.pushStack(o,e,X.call(arguments).join(","))}}),Y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?Y.find.matchesSelector(t[0],e)?[t[0]]:[]:Y.find.matches(e,t)},dir:function(e,n,r){for(var o=[],i=e[n];i&&9!==i.nodeType&&(r===t||1!==i.nodeType||!Y(i).is(r));)1===i.nodeType&&o.push(i),i=i[n];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Pt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,$t=/^\s+/,qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Wt=/<([\w:]+)/,Ut=/<tbody/i,Qt=/<|&#?\w+;/,zt=/<(?:script|style|link)/i,Xt=/<(?:script|object|embed|option|style)/i,Jt=RegExp("<(?:"+Pt+")[\\s/>]","i"),Vt=/^(?:checkbox|radio)$/,Kt=/checked\s*(?:[^=]|=\s*.checked.)/i,Gt=/\/(java|ecma)script/i,Yt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={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,"",""]},en=u($),tn=en.appendChild($.createElement("div"));Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,Y.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),Y.fn.extend({text:function(e){return Y.access(this,function(e){return e===t?Y.text(this):this.empty().append((this[0]&&this[0].ownerDocument||$).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Y.isFunction(e))return this.each(function(t){Y(this).wrapAll(e.call(this,t))});if(this[0]){var t=Y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Y.isFunction(e)?this.each(function(t){Y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Y.isFunction(e);return this.each(function(n){Y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Y.nodeName(this,"body")||Y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(e,this),"before",this.selector)}},after:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var n,r=0;null!=(n=this[r]);r++)(!e||Y.filter(e,[n]).length)&&(t||1!==n.nodeType||(Y.cleanData(n.getElementsByTagName("*")),Y.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&Y.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Y.clone(this,e,t)})},html:function(e){return Y.access(this,function(e){var n=this[0]||{},r=0,o=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Bt,""):t;if(!("string"!=typeof e||zt.test(e)||!Y.support.htmlSerialize&&Jt.test(e)||!Y.support.leadingWhitespace&&$t.test(e)||Zt[(Wt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(qt,"<$1></$2>");try{for(;o>r;r++)n=this[r]||{},1===n.nodeType&&(Y.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(i){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return s(this[0])?this.length?this.pushStack(Y(Y.isFunction(e)?e():e),"replaceWith",e):this:Y.isFunction(e)?this.each(function(t){var n=Y(this),r=n.html();n.replaceWith(e.call(this,t,r))}):("string"!=typeof e&&(e=Y(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;Y(this).remove(),t?Y(t).before(e):Y(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var o,i,a,s,l=0,c=e[0],u=[],f=this.length;if(!Y.support.checkClone&&f>1&&"string"==typeof c&&Kt.test(c))return this.each(function(){Y(this).domManip(e,n,r)});if(Y.isFunction(c))return this.each(function(o){var i=Y(this);e[0]=c.call(this,o,n?i.html():t),i.domManip(e,n,r)});if(this[0]){if(o=Y.buildFragment(e,this,u),a=o.fragment,i=a.firstChild,1===a.childNodes.length&&(a=i),i)for(n=n&&Y.nodeName(i,"tr"),s=o.cacheable||f-1;f>l;l++)r.call(n&&Y.nodeName(this[l],"table")?p(this[l],"tbody"):this[l],l===s?a:Y.clone(a,!0,!0));a=i=null,u.length&&Y.each(u,function(e,t){t.src?Y.ajax?Y.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Y.error("no ajax"):Y.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Yt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Y.buildFragment=function(e,n,r){var o,i,a,s=e[0];return n=n||$,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,!(1===e.length&&"string"==typeof s&&512>s.length&&n===$&&"<"===s.charAt(0))||Xt.test(s)||!Y.support.checkClone&&Kt.test(s)||!Y.support.html5Clone&&Jt.test(s)||(i=!0,o=Y.fragments[s],a=o!==t),o||(o=n.createDocumentFragment(),Y.clean(e,n,o,r),i&&(Y.fragments[s]=a&&o)),{fragment:o,cacheable:i}},Y.fragments={},Y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Y.fn[e]=function(n){var r,o=0,i=[],a=Y(n),s=a.length,l=1===this.length&&this[0].parentNode;if((null==l||l&&11===l.nodeType&&1===l.childNodes.length)&&1===s)return a[t](this[0]),this;for(;s>o;o++)r=(o>0?this.clone(!0):this).get(),Y(a[o])[t](r),i=i.concat(r);return this.pushStack(i,e,a.selector)}}),Y.extend({clone:function(e,t,n){var r,o,i,a;if(Y.support.html5Clone||Y.isXMLDoc(e)||!Jt.test("<"+e.nodeName+">")?a=e.cloneNode(!0):(tn.innerHTML=e.outerHTML,tn.removeChild(a=tn.firstChild)),!(Y.support.noCloneEvent&&Y.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Y.isXMLDoc(e)))for(d(e,a),r=h(e),o=h(a),i=0;r[i];++i)o[i]&&d(r[i],o[i]);if(t&&(f(e,a),n))for(r=h(e),o=h(a),i=0;r[i];++i)f(r[i],o[i]);return r=o=null,a},clean:function(e,n,r,o){var i,a,s,l,c,p,f,d,h,m,y,v=n===$&&en,b=[];for(n&&n.createDocumentFragment!==t||(n=$),i=0;null!=(s=e[i]);i++)if("number"==typeof s&&(s+=""),s){if("string"==typeof s)if(Qt.test(s)){for(v=v||u(n),f=n.createElement("div"),v.appendChild(f),s=s.replace(qt,"<$1></$2>"),l=(Wt.exec(s)||["",""])[1].toLowerCase(),c=Zt[l]||Zt._default,p=c[0],f.innerHTML=c[1]+s+c[2];p--;)f=f.lastChild;if(!Y.support.tbody)for(d=Ut.test(s),h="table"!==l||d?"<table>"!==c[1]||d?[]:f.childNodes:f.firstChild&&f.firstChild.childNodes,a=h.length-1;a>=0;--a)Y.nodeName(h[a],"tbody")&&!h[a].childNodes.length&&h[a].parentNode.removeChild(h[a]);!Y.support.leadingWhitespace&&$t.test(s)&&f.insertBefore(n.createTextNode($t.exec(s)[0]),f.firstChild),s=f.childNodes,f.parentNode.removeChild(f)}else s=n.createTextNode(s);s.nodeType?b.push(s):Y.merge(b,s)}if(f&&(s=f=v=null),!Y.support.appendChecked)for(i=0;null!=(s=b[i]);i++)Y.nodeName(s,"input")?g(s):s.getElementsByTagName!==t&&Y.grep(s.getElementsByTagName("input"),g);if(r)for(m=function(e){return!e.type||Gt.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):r.appendChild(e):t},i=0;null!=(s=b[i]);i++)Y.nodeName(s,"script")&&m(s)||(r.appendChild(s),s.getElementsByTagName!==t&&(y=Y.grep(Y.merge([],s.getElementsByTagName("script")),m),b.splice.apply(b,[i+1,0].concat(y)),i+=y.length));return b},cleanData:function(e,t){for(var n,r,o,i,a=0,s=Y.expando,l=Y.cache,c=Y.support.deleteExpando,u=Y.event.special;null!=(o=e[a]);a++)if((t||Y.acceptData(o))&&(r=o[s],n=r&&l[r])){if(n.events)for(i in n.events)u[i]?Y.event.remove(o,i):Y.removeEvent(o,i,n.handle);l[r]&&(delete l[r],c?delete o[s]:o.removeAttribute?o.removeAttribute(s):o[s]=null,Y.deletedIds.push(r))}}}),function(){var e,t;Y.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Y.uaMatch(W.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Y.browser=t,Y.sub=function(){function e(t,n){return new e.fn.init(t,n)}Y.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(n,r){return r&&r instanceof Y&&!(r instanceof e)&&(r=e(r)),Y.fn.init.call(this,n,r,t)},e.fn.init.prototype=e.fn;var t=e($);return e}}();var nn,rn,on,an=/alpha\([^)]*\)/i,sn=/opacity=([^)]*)/,ln=/^(top|right|bottom|left)$/,cn=/^(none|table(?!-c[ea]).+)/,un=/^margin/,pn=RegExp("^("+Z+")(.*)$","i"),fn=RegExp("^("+Z+")(?!px)[a-z%]+$","i"),dn=RegExp("^([-+])=("+Z+")","i"),hn={BODY:"block"},gn={position:"absolute",visibility:"hidden",display:"block"},mn={letterSpacing:0,fontWeight:400},yn=["Top","Right","Bottom","Left"],vn=["Webkit","O","Moz","ms"],bn=Y.fn.toggle;Y.fn.extend({css:function(e,n){return Y.access(this,function(e,n,r){return r!==t?Y.style(e,n,r):Y.css(e,n)},e,n,arguments.length>1)},show:function(){return v(this,!0)},hide:function(){return v(this)},toggle:function(e,t){var n="boolean"==typeof e;return Y.isFunction(e)&&Y.isFunction(t)?bn.apply(this,arguments):this.each(function(){(n?e:y(this))?Y(this).show():Y(this).hide()})}}),Y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=nn(e,"opacity");return""===n?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,s,l=Y.camelCase(n),c=e.style;if(n=Y.cssProps[l]||(Y.cssProps[l]=m(c,l)),s=Y.cssHooks[n]||Y.cssHooks[l],r===t)return s&&"get"in s&&(i=s.get(e,!1,o))!==t?i:c[n];if(a=typeof r,"string"===a&&(i=dn.exec(r))&&(r=(i[1]+1)*i[2]+parseFloat(Y.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||Y.cssNumber[l]||(r+="px"),s&&"set"in s&&(r=s.set(e,r,o))===t)))try{c[n]=r}catch(u){}}},css:function(e,n,r,o){var i,a,s,l=Y.camelCase(n);return n=Y.cssProps[l]||(Y.cssProps[l]=m(e.style,l)),s=Y.cssHooks[n]||Y.cssHooks[l],s&&"get"in s&&(i=s.get(e,!0,o)),i===t&&(i=nn(e,n)),"normal"===i&&n in mn&&(i=mn[n]),r||o!==t?(a=parseFloat(i),r||Y.isNumeric(a)?a||0:i):i},swap:function(e,t,n){var r,o,i={};for(o in t)i[o]=e.style[o],e.style[o]=t[o];r=n.call(e);for(o in t)e.style[o]=i[o];return r}}),e.getComputedStyle?nn=function(t,n){var r,o,i,a,s=e.getComputedStyle(t,null),l=t.style;return s&&(r=s.getPropertyValue(n)||s[n],""!==r||Y.contains(t.ownerDocument,t)||(r=Y.style(t,n)),fn.test(r)&&un.test(n)&&(o=l.width,i=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=r,r=s.width,l.width=o,l.minWidth=i,l.maxWidth=a)),r}:$.documentElement.currentStyle&&(nn=function(e,t){var n,r,o=e.currentStyle&&e.currentStyle[t],i=e.style;return null==o&&i&&i[t]&&(o=i[t]),fn.test(o)&&!ln.test(t)&&(n=i.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),i.left="fontSize"===t?"1em":o,o=i.pixelLeft+"px",i.left=n,r&&(e.runtimeStyle.left=r)),""===o?"auto":o}),Y.each(["height","width"],function(e,n){Y.cssHooks[n]={get:function(e,r,o){return r?0===e.offsetWidth&&cn.test(nn(e,"display"))?Y.swap(e,gn,function(){return w(e,n,o)}):w(e,n,o):t},set:function(e,t,r){return b(e,t,r?x(e,n,r,Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing")):0)}}}),Y.support.opacity||(Y.cssHooks.opacity={get:function(e,t){return sn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,o=Y.isNumeric(t)?"alpha(opacity="+100*t+")":"",i=r&&r.filter||n.filter||"";n.zoom=1,t>=1&&""===Y.trim(i.replace(an,""))&&n.removeAttribute&&(n.removeAttribute("filter"),r&&!r.filter)||(n.filter=an.test(i)?i.replace(an,o):i+" "+o)}}),Y(function(){Y.support.reliableMarginRight||(Y.cssHooks.marginRight={get:function(e,n){return Y.swap(e,{display:"inline-block"},function(){return n?nn(e,"marginRight"):t})}}),!Y.support.pixelPosition&&Y.fn.position&&Y.each(["top","left"],function(e,t){Y.cssHooks[t]={get:function(e,n){if(n){var r=nn(e,t);return fn.test(r)?Y(e).position()[t]+"px":r}}}})}),Y.expr&&Y.expr.filters&&(Y.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!Y.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||nn(e,"display"))},Y.expr.filters.visible=function(e){return!Y.expr.filters.hidden(e)}),Y.each({margin:"",padding:"",border:"Width"},function(e,t){Y.cssHooks[e+t]={expand:function(n){var r,o="string"==typeof n?n.split(" "):[n],i={};for(r=0;4>r;r++)i[e+yn[r]+t]=o[r]||o[r-2]||o[0];return i}},un.test(e)||(Y.cssHooks[e+t].set=b)});var xn=/%20/g,wn=/\[\]$/,_n=/\r?\n/g,Cn=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,An=/^(?:select|textarea)/i; Y.fn.extend({serialize:function(){return Y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Y.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||An.test(this.nodeName)||Cn.test(this.type))}).map(function(e,t){var n=Y(this).val();return null==n?null:Y.isArray(n)?Y.map(n,function(e){return{name:t.name,value:e.replace(_n,"\r\n")}}):{name:t.name,value:n.replace(_n,"\r\n")}}).get()}}),Y.param=function(e,n){var r,o=[],i=function(e,t){t=Y.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=Y.ajaxSettings&&Y.ajaxSettings.traditional),Y.isArray(e)||e.jquery&&!Y.isPlainObject(e))Y.each(e,function(){i(this.name,this.value)});else for(r in e)C(r,e[r],n,i);return o.join("&").replace(xn,"+")};var Tn,kn,En=/#.*$/,Fn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Sn=/^(?:GET|HEAD)$/,jn=/^\/\//,Rn=/\?/,On=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Mn=/([?&])_=[^&]*/,Hn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,In=Y.fn.load,Dn={},Ln={},Pn=["*/"]+["*"];try{kn=q.href}catch(Bn){kn=$.createElement("a"),kn.href="",kn=kn.href}Tn=Hn.exec(kn.toLowerCase())||[],Y.fn.load=function(e,n,r){if("string"!=typeof e&&In)return In.apply(this,arguments);if(!this.length)return this;var o,i,a,s=this,l=e.indexOf(" ");return l>=0&&(o=e.slice(l,e.length),e=e.slice(0,l)),Y.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(i="POST"),Y.ajax({url:e,type:i,dataType:"html",data:n,complete:function(e,t){r&&s.each(r,a||[e.responseText,t,e])}}).done(function(e){a=arguments,s.html(o?Y("<div>").append(e.replace(On,"")).find(o):e)}),this},Y.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Y.fn[t]=function(e){return this.on(t,e)}}),Y.each(["get","post"],function(e,n){Y[n]=function(e,r,o,i){return Y.isFunction(r)&&(i=i||o,o=r,r=t),Y.ajax({type:n,url:e,data:r,success:o,dataType:i})}}),Y.extend({getScript:function(e,n){return Y.get(e,t,n,"script")},getJSON:function(e,t,n){return Y.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?k(e,Y.ajaxSettings):(t=e,e=Y.ajaxSettings),k(e,t),e},ajaxSettings:{url:kn,isLocal:Nn.test(Tn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Pn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Y.parseJSON,"text xml":Y.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:A(Dn),ajaxTransport:A(Ln),ajax:function(e,n){function r(e,n,r,a){var c,p,v,b,w,C=n;2!==x&&(x=2,l&&clearTimeout(l),s=t,i=a||"",_.readyState=e>0?4:0,r&&(b=E(f,_,r)),e>=200&&300>e||304===e?(f.ifModified&&(w=_.getResponseHeader("Last-Modified"),w&&(Y.lastModified[o]=w),w=_.getResponseHeader("Etag"),w&&(Y.etag[o]=w)),304===e?(C="notmodified",c=!0):(c=F(f,b),C=c.state,p=c.data,v=c.error,c=!v)):(v=C,(!C||e)&&(C="error",0>e&&(e=0))),_.status=e,_.statusText=(n||C)+"",c?g.resolveWith(d,[p,C,_]):g.rejectWith(d,[_,C,v]),_.statusCode(y),y=t,u&&h.trigger("ajax"+(c?"Success":"Error"),[_,f,c?p:v]),m.fireWith(d,[_,C]),u&&(h.trigger("ajaxComplete",[_,f]),--Y.active||Y.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var o,i,a,s,l,c,u,p,f=Y.ajaxSetup({},n),d=f.context||f,h=d!==f&&(d.nodeType||d instanceof Y)?Y(d):Y.event,g=Y.Deferred(),m=Y.Callbacks("once memory"),y=f.statusCode||{},v={},b={},x=0,w="canceled",_={readyState:0,setRequestHeader:function(e,t){if(!x){var n=e.toLowerCase();e=b[n]=b[n]||e,v[e]=t}return this},getAllResponseHeaders:function(){return 2===x?i:null},getResponseHeader:function(e){var n;if(2===x){if(!a)for(a={};n=Fn.exec(i);)a[n[1].toLowerCase()]=n[2];n=a[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return x||(f.mimeType=e),this},abort:function(e){return e=e||w,s&&s.abort(e),r(0,e),this}};if(g.promise(_),_.success=_.done,_.error=_.fail,_.complete=m.add,_.statusCode=function(e){if(e){var t;if(2>x)for(t in e)y[t]=[y[t],e[t]];else t=e[_.status],_.always(t)}return this},f.url=((e||f.url)+"").replace(En,"").replace(jn,Tn[1]+"//"),f.dataTypes=Y.trim(f.dataType||"*").toLowerCase().split(tt),null==f.crossDomain&&(c=Hn.exec(f.url.toLowerCase()),f.crossDomain=!(!c||c[1]===Tn[1]&&c[2]===Tn[2]&&(c[3]||("http:"===c[1]?80:443))==(Tn[3]||("http:"===Tn[1]?80:443)))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Y.param(f.data,f.traditional)),T(Dn,f,n,_),2===x)return _;if(u=f.global,f.type=f.type.toUpperCase(),f.hasContent=!Sn.test(f.type),u&&0===Y.active++&&Y.event.trigger("ajaxStart"),!f.hasContent&&(f.data&&(f.url+=(Rn.test(f.url)?"&":"?")+f.data,delete f.data),o=f.url,f.cache===!1)){var C=Y.now(),A=f.url.replace(Mn,"$1_="+C);f.url=A+(A===f.url?(Rn.test(f.url)?"&":"?")+"_="+C:"")}(f.data&&f.hasContent&&f.contentType!==!1||n.contentType)&&_.setRequestHeader("Content-Type",f.contentType),f.ifModified&&(o=o||f.url,Y.lastModified[o]&&_.setRequestHeader("If-Modified-Since",Y.lastModified[o]),Y.etag[o]&&_.setRequestHeader("If-None-Match",Y.etag[o])),_.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Pn+"; q=0.01":""):f.accepts["*"]);for(p in f.headers)_.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(f.beforeSend.call(d,_,f)===!1||2===x))return _.abort();w="abort";for(p in{success:1,error:1,complete:1})_[p](f[p]);if(s=T(Ln,f,n,_)){_.readyState=1,u&&h.trigger("ajaxSend",[_,f]),f.async&&f.timeout>0&&(l=setTimeout(function(){_.abort("timeout")},f.timeout));try{x=1,s.send(v,r)}catch(k){if(!(2>x))throw k;r(-1,k)}}else r(-1,"No Transport");return _},active:0,lastModified:{},etag:{}});var $n=[],qn=/\?/,Wn=/(=)\?(?=&|$)|\?\?/,Un=Y.now();Y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=$n.pop()||Y.expando+"_"+Un++;return this[e]=!0,e}}),Y.ajaxPrefilter("json jsonp",function(n,r,o){var i,a,s,l=n.data,c=n.url,u=n.jsonp!==!1,p=u&&Wn.test(c),f=u&&!p&&"string"==typeof l&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wn.test(l);return"jsonp"===n.dataTypes[0]||p||f?(i=n.jsonpCallback=Y.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,a=e[i],p?n.url=c.replace(Wn,"$1"+i):f?n.data=l.replace(Wn,"$1"+i):u&&(n.url+=(qn.test(c)?"&":"?")+n.jsonp+"="+i),n.converters["script json"]=function(){return s||Y.error(i+" was not called"),s[0]},n.dataTypes[0]="json",e[i]=function(){s=arguments},o.always(function(){e[i]=a,n[i]&&(n.jsonpCallback=r.jsonpCallback,$n.push(i)),s&&Y.isFunction(a)&&a(s[0]),s=a=t}),"script"):t}),Y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Y.globalEval(e),e}}}),Y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=$.head||$.getElementsByTagName("head")[0]||$.documentElement;return{send:function(o,i){n=$.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,o){(o||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,o||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Qn,zn=e.ActiveXObject?function(){for(var e in Qn)Qn[e](0,1)}:!1,Xn=0;Y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&N()||S()}:N,function(e){Y.extend(Y.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Y.ajaxSettings.xhr()),Y.support.ajax&&Y.ajaxTransport(function(n){if(!n.crossDomain||Y.support.cors){var r;return{send:function(o,i){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(s in o)l.setRequestHeader(s,o[s])}catch(c){}l.send(n.hasContent&&n.data||null),r=function(e,o){var s,c,u,p,f;try{if(r&&(o||4===l.readyState))if(r=t,a&&(l.onreadystatechange=Y.noop,zn&&delete Qn[a]),o)4!==l.readyState&&l.abort();else{s=l.status,u=l.getAllResponseHeaders(),p={},f=l.responseXML,f&&f.documentElement&&(p.xml=f);try{p.text=l.responseText}catch(d){}try{c=l.statusText}catch(d){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(h){o||i(-1,h)}p&&i(s,c,p,u)},n.async?4===l.readyState?setTimeout(r,0):(a=++Xn,zn&&(Qn||(Qn={},Y(e).unload(zn)),Qn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var Jn,Vn,Kn=/^(?:toggle|show|hide)$/,Gn=RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Yn=/queueHooks$/,Zn=[H],er={"*":[function(e,t){var n,r,o=this.createTween(e,t),i=Gn.exec(t),a=o.cur(),s=+a||0,l=1,c=20;if(i){if(n=+i[2],r=i[3]||(Y.cssNumber[e]?"":"px"),"px"!==r&&s){s=Y.css(o.elem,e,!0)||n||1;do l=l||".5",s/=l,Y.style(o.elem,e,s+r);while(l!==(l=o.cur()/a)&&1!==l&&--c)}o.unit=r,o.start=s,o.end=i[1]?s+(i[1]+1)*n:n}return o}]};Y.Animation=Y.extend(O,{tweener:function(e,t){Y.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,o=e.length;o>r;r++)n=e[r],er[n]=er[n]||[],er[n].unshift(t)},prefilter:function(e,t){t?Zn.unshift(e):Zn.push(e)}}),Y.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(Y.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.pos=t=this.options.duration?Y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Y.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Y.fx.step[e.prop]?Y.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Y.cssProps[e.prop]]||Y.cssHooks[e.prop])?Y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Y.each(["toggle","show","hide"],function(e,t){var n=Y.fn[t];Y.fn[t]=function(r,o,i){return null==r||"boolean"==typeof r||!e&&Y.isFunction(r)&&Y.isFunction(o)?n.apply(this,arguments):this.animate(D(t,!0),r,o,i)}}),Y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(y).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=Y.isEmptyObject(e),i=Y.speed(t,n,r),a=function(){var t=O(this,Y.extend({},e),i);o&&t.stop(!0)};return o||i.queue===!1?this.each(a):this.queue(i.queue,a)},stop:function(e,n,r){var o=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",i=Y.timers,a=Y._data(this);if(n)a[n]&&a[n].stop&&o(a[n]);else for(n in a)a[n]&&a[n].stop&&Yn.test(n)&&o(a[n]);for(n=i.length;n--;)i[n].elem!==this||null!=e&&i[n].queue!==e||(i[n].anim.stop(r),t=!1,i.splice(n,1));(t||!r)&&Y.dequeue(this,e)})}}),Y.each({slideDown:D("show"),slideUp:D("hide"),slideToggle:D("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Y.speed=function(e,t,n){var r=e&&"object"==typeof e?Y.extend({},e):{complete:n||!n&&t||Y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!Y.isFunction(t)&&t};return r.duration=Y.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in Y.fx.speeds?Y.fx.speeds[r.duration]:Y.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){Y.isFunction(r.old)&&r.old.call(this),r.queue&&Y.dequeue(this,r.queue)},r},Y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Y.timers=[],Y.fx=I.prototype.init,Y.fx.tick=function(){var e,n=Y.timers,r=0;for(Jn=Y.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||Y.fx.stop(),Jn=t},Y.fx.timer=function(e){e()&&Y.timers.push(e)&&!Vn&&(Vn=setInterval(Y.fx.tick,Y.fx.interval))},Y.fx.interval=13,Y.fx.stop=function(){clearInterval(Vn),Vn=null},Y.fx.speeds={slow:600,fast:200,_default:400},Y.fx.step={},Y.expr&&Y.expr.filters&&(Y.expr.filters.animated=function(e){return Y.grep(Y.timers,function(t){return e===t.elem}).length});var tr=/^(?:body|html)$/i;Y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Y.offset.setOffset(this,e,t)});var n,r,o,i,a,s,l,c={top:0,left:0},u=this[0],p=u&&u.ownerDocument;if(p)return(r=p.body)===u?Y.offset.bodyOffset(u):(n=p.documentElement,Y.contains(n,u)?(u.getBoundingClientRect!==t&&(c=u.getBoundingClientRect()),o=L(p),i=n.clientTop||r.clientTop||0,a=n.clientLeft||r.clientLeft||0,s=o.pageYOffset||n.scrollTop,l=o.pageXOffset||n.scrollLeft,{top:c.top+s-i,left:c.left+l-a}):c)},Y.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return Y.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Y.css(e,"marginTop"))||0,n+=parseFloat(Y.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=Y.css(e,"position");"static"===r&&(e.style.position="relative");var o,i,a=Y(e),s=a.offset(),l=Y.css(e,"top"),c=Y.css(e,"left"),u=("absolute"===r||"fixed"===r)&&Y.inArray("auto",[l,c])>-1,p={},f={};u?(f=a.position(),o=f.top,i=f.left):(o=parseFloat(l)||0,i=parseFloat(c)||0),Y.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(p.top=t.top-s.top+o),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):a.css(p)}},Y.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),n=this.offset(),r=tr.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(Y.css(e,"marginTop"))||0,n.left-=parseFloat(Y.css(e,"marginLeft"))||0,r.top+=parseFloat(Y.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(Y.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||$.body;e&&!tr.test(e.nodeName)&&"static"===Y.css(e,"position");)e=e.offsetParent;return e||$.body})}}),Y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);Y.fn[e]=function(o){return Y.access(this,function(e,o,i){var a=L(e);return i===t?a?n in a?a[n]:a.document.documentElement[o]:e[o]:(a?a.scrollTo(r?Y(a).scrollLeft():i,r?i:Y(a).scrollTop()):e[o]=i,t)},e,o,arguments.length,null)}}),Y.each({Height:"height",Width:"width"},function(e,n){Y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,o){Y.fn[o]=function(o,i){var a=arguments.length&&(r||"boolean"!=typeof o),s=r||(o===!0||i===!0?"margin":"border");return Y.access(this,function(n,r,o){var i;return Y.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(i=n.documentElement,Math.max(n.body["scroll"+e],i["scroll"+e],n.body["offset"+e],i["offset"+e],i["client"+e])):o===t?Y.css(n,r,o,s):Y.style(n,r,o,s)},n,a?o:t,a,null)}})}),e.jQuery=e.$=Y,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Y})}(window),/*! ========================================================= * bootstrap-modal.js v2.2.2 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Twitter, Inc. require the following notice to accompany Bootstrap: * * Copyright (c) 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work * except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing permissions and limitations under the License. * * ========================================================= */ !function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault(),t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=e.support.transition&&n;this.$backdrop=e('<div class="modal-backdrop '+n+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),r?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(this.removeBackdrop,this)):this.removeBackdrop()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),o=r.data("modal"),i=e.extend({},e.fn.modal.defaults,r.data(),"object"==typeof n&&n);o||r.data("modal",o=new t(this,i)),"string"==typeof n?o[n]():i.show&&o.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),o=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),i=o.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},o.data(),n.data());t.preventDefault(),o.modal(i).one("hide",function(){n.focus()})})}(window.jQuery);/*! * This file creates $ and jQuery variables within the F2 closure scope */ var $,jQuery=$=window.jQuery.noConflict(!0);/*! * Hij1nx requires the following notice to accompany EventEmitter: * * Copyright (c) 2011 hij1nx * * http://www.twitter.com/hij1nx * * 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(e){function t(){this._events={}}function n(e){e&&(e.delimiter&&(this.delimiter=e.delimiter),e.wildcard&&(this.wildcard=e.wildcard),this.wildcard&&(this.listenerTree={}))}function r(e){this._events={},n.call(this,e)}function o(e,t,n,r){if(!n)return[];var i,a,s,l,c,u,p,f=[],d=t.length,h=t[r],g=t[r+1];if(r===d&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(i=0,a=n._listeners.length;a>i;i++)e&&e.push(n._listeners[i]);return[n]}if("*"===h||"**"===h||n[h]){if("*"===h){for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&(f=f.concat(o(e,t,n[s],r+1)));return f}if("**"===h){p=r+1===d||r+2===d&&"*"===g,p&&n._listeners&&(f=f.concat(o(e,t,n,d)));for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&("*"===s||"**"===s?(n[s]._listeners&&!p&&(f=f.concat(o(e,t,n[s],d))),f=f.concat(o(e,t,n[s],r))):f=s===g?f.concat(o(e,t,n[s],r+2)):f.concat(o(e,t,n[s],r)));return f}f=f.concat(o(e,t,n[h],r+1))}if(l=n["*"],l&&o(e,t,l,r+1),c=n["**"])if(d>r){c._listeners&&o(e,t,c,d);for(s in c)"_listeners"!==s&&c.hasOwnProperty(s)&&(s===g?o(e,t,c[s],r+2):s===h?o(e,t,c[s],r+1):(u={},u[s]=c[s],o(e,t,{"**":u},r+1)))}else c._listeners?o(e,t,c,d):c["*"]&&c["*"]._listeners&&o(e,t,c["*"],d);return f}function i(e,t){e="string"==typeof e?e.split(this.delimiter):e.slice();for(var n=0,r=e.length;r>n+1;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var o=this.listenerTree,i=e.shift();i;){if(o[i]||(o[i]={}),o=o[i],0===e.length){if(o._listeners){if("function"==typeof o._listeners)o._listeners=[o._listeners,t];else if(a(o._listeners)&&(o._listeners.push(t),!o._listeners.warned)){var l=s;this._events.maxListeners!==undefined&&(l=this._events.maxListeners),l>0&&o._listeners.length>l&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}else o._listeners=t;return!0}i=e.shift()}return!0}var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;r.prototype.delimiter=".",r.prototype.setMaxListeners=function(e){this._events||t.call(this),this._events.maxListeners=e},r.prototype.event="",r.prototype.once=function(e,t){return this.many(e,1,t),this},r.prototype.many=function(e,t,n){function r(){0===--t&&o.off(e,r),n.apply(this,arguments)}var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");return r._origin=n,this.on(e,r),o},r.prototype.emit=function(){this._events||t.call(this);var e=arguments[0];if("newListener"===e&&!this._events.newListener)return!1;if(this._all){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(i=0,n=this._all.length;n>i;i++)this.event=e,this._all[i].apply(this,r)}if("error"===e&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");var a;if(this.wildcard){a=[];var s="string"==typeof e?e.split(this.delimiter):e.slice();o.call(this,a,s,this.listenerTree,0)}else a=this._events[e];if("function"==typeof a){if(this.event=e,1===arguments.length)a.call(this);else if(arguments.length>1)switch(arguments.length){case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];a.apply(this,r)}return!0}if(a){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var l=a.slice(),i=0,n=l.length;n>i;i++)this.event=e,l[i].apply(this,r);return l.length>0||this._all}return this._all},r.prototype.on=function(e,n){if("function"==typeof e)return this.onAny(e),this;if("function"!=typeof n)throw Error("on only accepts instances of Function");if(this._events||t.call(this),this.emit("newListener",e,n),this.wildcard)return i.call(this,e,n),this;if(this._events[e]){if("function"==typeof this._events[e])this._events[e]=[this._events[e],n];else if(a(this._events[e])&&(this._events[e].push(n),!this._events[e].warned)){var r=s;this._events.maxListeners!==undefined&&(r=this._events.maxListeners),r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}else this._events[e]=n;return this},r.prototype.onAny=function(e){if(this._all||(this._all=[]),"function"!=typeof e)throw Error("onAny only accepts instances of Function");return this._all.push(e),this},r.prototype.addListener=r.prototype.on,r.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();r=o.call(this,null,i,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var s=0;r.length>s;s++){var l=r[s];if(n=l._listeners,a(n)){for(var c=-1,u=0,p=n.length;p>u;u++)if(n[u]===t||n[u].listener&&n[u].listener===t||n[u]._origin&&n[u]._origin===t){c=u;break}if(0>c)return this;this.wildcard?l._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete l._listeners:delete this._events[e])}else(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete l._listeners:delete this._events[e])}return this},r.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(t=this._all,n=0,r=t.length;r>n;n++)if(e===t[n])return t.splice(n,1),this}else this._all=[];return this},r.prototype.removeListener=r.prototype.off,r.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||t.call(this),this;if(this.wildcard)for(var n="string"==typeof e?e.split(this.delimiter):e.slice(),r=o.call(this,null,n,this.listenerTree,0),i=0;r.length>i;i++){var a=r[i];a._listeners=null}else{if(!this._events[e])return this;this._events[e]=null}return this},r.prototype.listeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return o.call(this,n,r,this.listenerTree,0),n}return this._events||t.call(this),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},r.prototype.listenersAny=function(){return this._all?this._all:[]},e.EventEmitter2=r}("undefined"!=typeof process&&process.title!==void 0&&exports!==void 0?exports:window),/*! * Øyvind Sean Kinsey and others require the following notice to accompany easyXDM: * * http://easyxdm.net/ * Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected]. * * 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(e,t,n,r,o,i){function a(e,t){var n=typeof e[t];return"function"==n||!("object"!=n||!e[t])||"unknown"==n}function s(e,t){return!("object"!=typeof e[t]||!e[t])}function l(e){return"[object Array]"===Object.prototype.toString.call(e)}function c(){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return F=Array.prototype.slice.call(e.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),N=parseInt(F[0],10)>9&&parseInt(F[1],10)>0,e=null,!0}catch(t){return!1}}function u(){if(!U){U=!0;for(var e=0;Q.length>e;e++)Q[e]();Q.length=0}}function p(e,t){return U?(e.call(t),void 0):(Q.push(function(){e.call(t)}),void 0)}function f(){var e=parent;if(""!==L)for(var t=0,n=L.split(".");n.length>t;t++)e=e[n[t]];return e.easyXDM}function d(t){return e.easyXDM=B,L=t,L&&($="easyXDM_"+L.replace(".","_")+"_"),P}function h(e){return e.match(H)[3]}function g(e){return e.match(H)[4]||""}function m(e){var t=e.toLowerCase().match(H),n=t[2],r=t[3],o=t[4]||"";return("http:"==n&&":80"==o||"https:"==n&&":443"==o)&&(o=""),n+"//"+r+o}function y(e){if(e=e.replace(D,"$1/"),!e.match(/^(http||https):\/\//)){var t="/"===e.substring(0,1)?"":n.pathname;"/"!==t.substring(t.length-1)&&(t=t.substring(0,t.lastIndexOf("/")+1)),e=n.protocol+"//"+n.host+t+e}for(;I.test(e);)e=e.replace(I,"");return e}function v(e,t){var n="",r=e.indexOf("#");-1!==r&&(n=e.substring(r),e=e.substring(0,r));var o=[];for(var a in t)t.hasOwnProperty(a)&&o.push(a+"="+i(t[a]));return e+(q?"#":-1==e.indexOf("?")?"?":"&")+o.join("&")+n}function b(e){return e===void 0}function x(e,t,n){var r;for(var o in t)t.hasOwnProperty(o)&&(o in e?(r=t[o],"object"==typeof r?x(e[o],r,n):n||(e[o]=t[o])):e[o]=t[o]);return e}function w(){var e=t.body.appendChild(t.createElement("form")),n=e.appendChild(t.createElement("input"));n.name=$+"TEST"+O,E=n!==e.elements[n.name],t.body.removeChild(e)}function _(e){b(E)&&w();var n;E?n=t.createElement('<iframe name="'+e.props.name+'"/>'):(n=t.createElement("IFRAME"),n.name=e.props.name),n.id=n.name=e.props.name,delete e.props.name,e.onLoad&&S(n,"load",e.onLoad),"string"==typeof e.container&&(e.container=t.getElementById(e.container)),e.container||(x(n.style,{position:"absolute",top:"-2000px"}),e.container=t.body);var r=e.props.src;return delete e.props.src,x(n,e.props),n.border=n.frameBorder=0,n.allowTransparency=!0,e.container.appendChild(n),n.src=r,e.props.src=r,n}function C(e,t){"string"==typeof e&&(e=[e]);for(var n,r=e.length;r--;)if(n=e[r],n=RegExp("^"==n.substr(0,1)?n:"^"+n.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"),n.test(t))return!0;return!1}function A(r){var o,i=r.protocol;if(r.isHost=r.isHost||b(X.xdm_p),q=r.hash||!1,r.props||(r.props={}),r.isHost)r.remote=y(r.remote),r.channel=r.channel||"default"+O++,r.secret=Math.random().toString(16).substring(2),b(i)&&(m(n.href)==m(r.remote)?i="4":a(e,"postMessage")||a(t,"postMessage")?i="1":r.swf&&a(e,"ActiveXObject")&&c()?i="6":"Gecko"===navigator.product&&"frameElement"in e&&-1==navigator.userAgent.indexOf("WebKit")?i="5":r.remoteHelper?(r.remoteHelper=y(r.remoteHelper),i="2"):i="0");else if(r.channel=X.xdm_c,r.secret=X.xdm_s,r.remote=X.xdm_e,i=X.xdm_p,r.acl&&!C(r.acl,r.remote))throw Error("Access denied for "+r.remote);switch(r.protocol=i,i){case"0":if(x(r,{interval:100,delay:2e3,useResize:!0,useParent:!1,usePolling:!1},!0),r.isHost){if(!r.local){for(var s,l=n.protocol+"//"+n.host,u=t.body.getElementsByTagName("img"),p=u.length;p--;)if(s=u[p],s.src.substring(0,l.length)===l){r.local=s.src;break}r.local||(r.local=e)}var f={xdm_c:r.channel,xdm_p:0};r.local===e?(r.usePolling=!0,r.useParent=!0,r.local=n.protocol+"//"+n.host+n.pathname+n.search,f.xdm_e=r.local,f.xdm_pa=1):f.xdm_e=y(r.local),r.container&&(r.useResize=!1,f.xdm_po=1),r.remote=v(r.remote,f)}else x(r,{channel:X.xdm_c,remote:X.xdm_e,useParent:!b(X.xdm_pa),usePolling:!b(X.xdm_po),useResize:r.useParent?!1:r.useResize});o=[new P.stack.HashTransport(r),new P.stack.ReliableBehavior({}),new P.stack.QueueBehavior({encode:!0,maxLength:4e3-r.remote.length}),new P.stack.VerifyBehavior({initiate:r.isHost})];break;case"1":o=[new P.stack.PostMessageTransport(r)];break;case"2":o=[new P.stack.NameTransport(r),new P.stack.QueueBehavior,new P.stack.VerifyBehavior({initiate:r.isHost})];break;case"3":o=[new P.stack.NixTransport(r)];break;case"4":o=[new P.stack.SameOriginTransport(r)];break;case"5":o=[new P.stack.FrameElementTransport(r)];break;case"6":F||c(),o=[new P.stack.FlashTransport(r)]}return o.push(new P.stack.QueueBehavior({lazy:r.lazy,remove:!0})),o}function T(e){for(var t,n={incoming:function(e,t){this.up.incoming(e,t)},outgoing:function(e,t){this.down.outgoing(e,t)},callback:function(e){this.up.callback(e)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},r=0,o=e.length;o>r;r++)t=e[r],x(t,n,!0),0!==r&&(t.down=e[r-1]),r!==o-1&&(t.up=e[r+1]);return t}function k(e){e.up.down=e.down,e.down.up=e.up,e.up=e.down=null}var E,F,N,S,j,R=this,O=Math.floor(1e4*Math.random()),M=Function.prototype,H=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,I=/[\-\w]+\/\.\.\//,D=/([^:])\/\//g,L="",P={},B=e.easyXDM,$="easyXDM_",q=!1;if(a(e,"addEventListener"))S=function(e,t,n){e.addEventListener(t,n,!1)},j=function(e,t,n){e.removeEventListener(t,n,!1)};else{if(!a(e,"attachEvent"))throw Error("Browser not supported");S=function(e,t,n){e.attachEvent("on"+t,n)},j=function(e,t,n){e.detachEvent("on"+t,n)}}var W,U=!1,Q=[];if("readyState"in t?(W=t.readyState,U="complete"==W||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==W||"interactive"==W)):U=!!t.body,!U){if(a(e,"addEventListener"))S(t,"DOMContentLoaded",u);else if(S(t,"readystatechange",function(){"complete"==t.readyState&&u()}),t.documentElement.doScroll&&e===top){var z=function(){if(!U){try{t.documentElement.doScroll("left")}catch(e){return r(z,1),void 0}u()}};z()}S(e,"load",u)}var X=function(e){e=e.substring(1).split("&");for(var t,n={},r=e.length;r--;)t=e[r].split("="),n[t[0]]=o(t[1]);return n}(/xdm_e=/.test(n.search)?n.search:n.hash),J=function(){var e={},t={a:[1,2,3]},n='{"a":[1,2,3]}';return"undefined"!=typeof JSON&&"function"==typeof JSON.stringify&&JSON.stringify(t).replace(/\s/g,"")===n?JSON:(Object.toJSON&&Object.toJSON(t).replace(/\s/g,"")===n&&(e.stringify=Object.toJSON),"function"==typeof String.prototype.evalJSON&&(t=n.evalJSON(),t.a&&3===t.a.length&&3===t.a[2]&&(e.parse=function(e){return e.evalJSON()})),e.stringify&&e.parse?(J=function(){return e},e):null)};x(P,{version:"2.4.15.118",query:X,stack:{},apply:x,getJSONObject:J,whenReady:p,noConflict:d}),P.DomHelper={on:S,un:j,requiresJSON:function(n){s(e,"JSON")||t.write('<script type="text/javascript" src="'+n+'"><'+"/script>")}},function(){var e={};P.Fn={set:function(t,n){e[t]=n},get:function(t,n){var r=e[t];return n&&delete e[t],r}}}(),P.Socket=function(e){var t=T(A(e).concat([{incoming:function(t,n){e.onMessage(t,n)},callback:function(t){e.onReady&&e.onReady(t)}}])),n=m(e.remote);this.origin=m(e.remote),this.destroy=function(){t.destroy()},this.postMessage=function(e){t.outgoing(e,n)},t.init()},P.Rpc=function(e,t){if(t.local)for(var n in t.local)if(t.local.hasOwnProperty(n)){var r=t.local[n];"function"==typeof r&&(t.local[n]={method:r})}var o=T(A(e).concat([new P.stack.RpcBehavior(this,t),{callback:function(t){e.onReady&&e.onReady(t)}}]));this.origin=m(e.remote),this.destroy=function(){o.destroy()},o.init()},P.stack.SameOriginTransport=function(e){var t,o,i,a;return t={outgoing:function(e,t,n){i(e),n&&n()},destroy:function(){o&&(o.parentNode.removeChild(o),o=null)},onDOMReady:function(){a=m(e.remote),e.isHost?(x(e.props,{src:v(e.remote,{xdm_e:n.protocol+"//"+n.host+n.pathname,xdm_c:e.channel,xdm_p:4}),name:$+e.channel+"_provider"}),o=_(e),P.Fn.set(e.channel,function(e){return i=e,r(function(){t.up.callback(!0)},0),function(e){t.up.incoming(e,a)}})):(i=f().Fn.get(e.channel,!0)(function(e){t.up.incoming(e,a)}),r(function(){t.up.callback(!0)},0))},init:function(){p(t.onDOMReady,t)}}},P.stack.FlashTransport=function(e){function o(e){r(function(){a.up.incoming(e,l)},0)}function i(n){var r=e.swf+"?host="+e.isHost,o="easyXDM_swf_"+Math.floor(1e4*Math.random());P.Fn.set("flash_loaded"+n.replace(/[\-.]/g,"_"),function(){P.stack.FlashTransport[n].swf=c=u.firstChild;for(var e=P.stack.FlashTransport[n].queue,t=0;e.length>t;t++)e[t]();e.length=0}),e.swfContainer?u="string"==typeof e.swfContainer?t.getElementById(e.swfContainer):e.swfContainer:(u=t.createElement("div"),x(u.style,N&&e.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),t.body.appendChild(u));var i="callback=flash_loaded"+n.replace(/[\-.]/g,"_")+"&proto="+R.location.protocol+"&domain="+h(R.location.href)+"&port="+g(R.location.href)+"&ns="+L;u.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+o+"' data='"+r+"'>"+"<param name='allowScriptAccess' value='always'></param>"+"<param name='wmode' value='transparent'>"+"<param name='movie' value='"+r+"'></param>"+"<param name='flashvars' value='"+i+"'></param>"+"<embed type='application/x-shockwave-flash' FlashVars='"+i+"' allowScriptAccess='always' wmode='transparent' src='"+r+"' height='1' width='1'></embed>"+"</object>"}var a,s,l,c,u;return a={outgoing:function(t,n,r){c.postMessage(e.channel,""+t),r&&r()},destroy:function(){try{c.destroyChannel(e.channel)}catch(t){}c=null,s&&(s.parentNode.removeChild(s),s=null)},onDOMReady:function(){l=e.remote,P.Fn.set("flash_"+e.channel+"_init",function(){r(function(){a.up.callback(!0)})}),P.Fn.set("flash_"+e.channel+"_onMessage",o),e.swf=y(e.swf);var t=h(e.swf),u=function(){P.stack.FlashTransport[t].init=!0,c=P.stack.FlashTransport[t].swf,c.createChannel(e.channel,e.secret,m(e.remote),e.isHost),e.isHost&&(N&&e.swfNoThrottle&&x(e.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),x(e.props,{src:v(e.remote,{xdm_e:m(n.href),xdm_c:e.channel,xdm_p:6,xdm_s:e.secret}),name:$+e.channel+"_provider"}),s=_(e))};P.stack.FlashTransport[t]&&P.stack.FlashTransport[t].init?u():P.stack.FlashTransport[t]?P.stack.FlashTransport[t].queue.push(u):(P.stack.FlashTransport[t]={queue:[u]},i(t))},init:function(){p(a.onDOMReady,a)}}},P.stack.PostMessageTransport=function(t){function o(e){if(e.origin)return m(e.origin);if(e.uri)return m(e.uri);if(e.domain)return n.protocol+"//"+e.domain;throw"Unable to retrieve the origin of the event"}function i(e){var n=o(e);n==c&&e.data.substring(0,t.channel.length+1)==t.channel+" "&&a.up.incoming(e.data.substring(t.channel.length+1),n)}var a,s,l,c;return a={outgoing:function(e,n,r){l.postMessage(t.channel+" "+e,n||c),r&&r()},destroy:function(){j(e,"message",i),s&&(l=null,s.parentNode.removeChild(s),s=null)},onDOMReady:function(){if(c=m(t.remote),t.isHost){var o=function(n){n.data==t.channel+"-ready"&&(l="postMessage"in s.contentWindow?s.contentWindow:s.contentWindow.document,j(e,"message",o),S(e,"message",i),r(function(){a.up.callback(!0)},0))};S(e,"message",o),x(t.props,{src:v(t.remote,{xdm_e:m(n.href),xdm_c:t.channel,xdm_p:1}),name:$+t.channel+"_provider"}),s=_(t)}else S(e,"message",i),l="postMessage"in e.parent?e.parent:e.parent.document,l.postMessage(t.channel+"-ready",c),r(function(){a.up.callback(!0)},0)},init:function(){p(a.onDOMReady,a)}}},P.stack.FrameElementTransport=function(o){var i,a,s,l;return i={outgoing:function(e,t,n){s.call(this,e),n&&n()},destroy:function(){a&&(a.parentNode.removeChild(a),a=null)},onDOMReady:function(){l=m(o.remote),o.isHost?(x(o.props,{src:v(o.remote,{xdm_e:m(n.href),xdm_c:o.channel,xdm_p:5}),name:$+o.channel+"_provider"}),a=_(o),a.fn=function(e){return delete a.fn,s=e,r(function(){i.up.callback(!0)},0),function(e){i.up.incoming(e,l)}}):(t.referrer&&m(t.referrer)!=X.xdm_e&&(e.top.location=X.xdm_e),s=e.frameElement.fn(function(e){i.up.incoming(e,l)}),i.up.callback(!0))},init:function(){p(i.onDOMReady,i)}}},P.stack.NameTransport=function(e){function t(t){var n=e.remoteHelper+(s?"#_3":"#_2")+e.channel;l.contentWindow.sendMessage(t,n)}function n(){s?2!==++u&&s||a.up.callback(!0):(t("ready"),a.up.callback(!0))}function o(e){a.up.incoming(e,d)}function i(){f&&r(function(){f(!0)},0)}var a,s,l,c,u,f,d,h;return a={outgoing:function(e,n,r){f=r,t(e)},destroy:function(){l.parentNode.removeChild(l),l=null,s&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){s=e.isHost,u=0,d=m(e.remote),e.local=y(e.local),s?(P.Fn.set(e.channel,function(t){s&&"ready"===t&&(P.Fn.set(e.channel,o),n())}),h=v(e.remote,{xdm_e:e.local,xdm_c:e.channel,xdm_p:2}),x(e.props,{src:h+"#"+e.channel,name:$+e.channel+"_provider"}),c=_(e)):(e.remoteHelper=e.remote,P.Fn.set(e.channel,o)),l=_({props:{src:e.local+"#_4"+e.channel},onLoad:function t(){var o=l||this;j(o,"load",t),P.Fn.set(e.channel+"_load",i),function a(){"function"==typeof o.contentWindow.sendMessage?n():r(a,50)}()}})},init:function(){p(a.onDOMReady,a)}}},P.stack.HashTransport=function(t){function n(e){if(g){var n=t.remote+"#"+d++ +"_"+e;(l||!y?g.contentWindow:g).location=n}}function o(e){f=e,s.up.incoming(f.substring(f.indexOf("_")+1),v)}function i(){if(h){var e=h.location.href,t="",n=e.indexOf("#");-1!=n&&(t=e.substring(n)),t&&t!=f&&o(t)}}function a(){c=setInterval(i,u)}var s,l,c,u,f,d,h,g,y,v;return s={outgoing:function(e){n(e)},destroy:function(){e.clearInterval(c),(l||!y)&&g.parentNode.removeChild(g),g=null},onDOMReady:function(){if(l=t.isHost,u=t.interval,f="#"+t.channel,d=0,y=t.useParent,v=m(t.remote),l){if(t.props={src:t.remote,name:$+t.channel+"_provider"},y)t.onLoad=function(){h=e,a(),s.up.callback(!0)};else{var n=0,o=t.delay/50;(function i(){if(++n>o)throw Error("Unable to reference listenerwindow");try{h=g.contentWindow.frames[$+t.channel+"_consumer"]}catch(e){}h?(a(),s.up.callback(!0)):r(i,50)})()}g=_(t)}else h=e,a(),y?(g=parent,s.up.callback(!0)):(x(t,{props:{src:t.remote+"#"+t.channel+new Date,name:$+t.channel+"_consumer"},onLoad:function(){s.up.callback(!0)}}),g=_(t))},init:function(){p(s.onDOMReady,s)}}},P.stack.ReliableBehavior=function(){var e,t,n=0,r=0,o="";return e={incoming:function(i,a){var s=i.indexOf("_"),l=i.substring(0,s).split(",");i=i.substring(s+1),l[0]==n&&(o="",t&&t(!0)),i.length>0&&(e.down.outgoing(l[1]+","+n+"_"+o,a),r!=l[1]&&(r=l[1],e.up.incoming(i,a)))},outgoing:function(i,a,s){o=i,t=s,e.down.outgoing(r+","+ ++n+"_"+i,a)}}},P.stack.QueueBehavior=function(e){function t(){if(e.remove&&0===s.length)return k(n),void 0;if(!l&&0!==s.length&&!a){l=!0;var o=s.shift();n.down.outgoing(o.data,o.origin,function(e){l=!1,o.callback&&r(function(){o.callback(e)},0),t()})}}var n,a,s=[],l=!0,c="",u=0,p=!1,f=!1;return n={init:function(){b(e)&&(e={}),e.maxLength&&(u=e.maxLength,f=!0),e.lazy?p=!0:n.down.init()},callback:function(e){l=!1;var r=n.up;t(),r.callback(e)},incoming:function(t,r){if(f){var i=t.indexOf("_"),a=parseInt(t.substring(0,i),10);c+=t.substring(i+1),0===a&&(e.encode&&(c=o(c)),n.up.incoming(c,r),c="")}else n.up.incoming(t,r)},outgoing:function(r,o,a){e.encode&&(r=i(r));var l,c=[];if(f){for(;0!==r.length;)l=r.substring(0,u),r=r.substring(l.length),c.push(l);for(;l=c.shift();)s.push({data:c.length+"_"+l,origin:o,callback:0===c.length?a:null})}else s.push({data:r,origin:o,callback:a});p?n.down.init():t()},destroy:function(){a=!0,n.down.destroy()}}},P.stack.VerifyBehavior=function(e){function t(){r=Math.random().toString(16).substring(2),n.down.outgoing(r)}var n,r,o;return n={incoming:function(i,a){var s=i.indexOf("_");-1===s?i===r?n.up.callback(!0):o||(o=i,e.initiate||t(),n.down.outgoing(i)):i.substring(0,s)===o&&n.up.incoming(i.substring(s+1),a)},outgoing:function(e,t,o){n.down.outgoing(r+"_"+e,t,o)},callback:function(){e.initiate&&t()}}},P.stack.RpcBehavior=function(e,t){function n(e){e.jsonrpc="2.0",i.down.outgoing(a.stringify(e))}function r(e,t){var r=Array.prototype.slice;return function(){var o,i=arguments.length,a={method:t};i>0&&"function"==typeof arguments[i-1]?(i>1&&"function"==typeof arguments[i-2]?(o={success:arguments[i-2],error:arguments[i-1]},a.params=r.call(arguments,0,i-2)):(o={success:arguments[i-1]},a.params=r.call(arguments,0,i-1)),c[""+ ++s]=o,a.id=s):a.params=r.call(arguments,0),e.namedParams&&1===a.params.length&&(a.params=a.params[0]),n(a)}}function o(e,t,r,o){if(!r)return t&&n({id:t,error:{code:-32601,message:"Procedure not found."}}),void 0;var i,a;t?(i=function(e){i=M,n({id:t,result:e})},a=function(e,r){a=M;var o={id:t,error:{code:-32099,message:e}};r&&(o.error.data=r),n(o)}):i=a=M,l(o)||(o=[o]);try{var s=r.method.apply(r.scope,o.concat([i,a]));b(s)||i(s)}catch(c){a(c.message)}}var i,a=t.serializer||J(),s=0,c={};return i={incoming:function(e){var r=a.parse(e);if(r.method)t.handle?t.handle(r,n):o(r.method,r.id,t.local[r.method],r.params);else{var i=c[r.id];r.error?i.error&&i.error(r.error):i.success&&i.success(r.result),delete c[r.id]}},init:function(){if(t.remote)for(var n in t.remote)t.remote.hasOwnProperty(n)&&(e[n]=r(t.remote[n],n));i.down.init()},destroy:function(){for(var n in t.remote)t.remote.hasOwnProperty(n)&&e.hasOwnProperty(n)&&delete e[n];i.down.destroy()}}},R.easyXDM=P}(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);/*! * F2 v1.3.1 10-15-2013 * Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org * * "F2" is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * * Please note that F2 ("Software") may contain third party material that Markit * On Demand Inc. has a license to use and include within the Software (the * "Third Party Material"). A list of the software comprising the Third Party Material * and the terms and conditions under which such Third Party Material is distributed * are reproduced in the ThirdPartyMaterial.md file available at: * * https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md * * The inclusion of the Third Party Material in the Software does not grant, provide * nor result in you having acquiring any rights whatsoever, other than as stipulated * in the terms and conditions related to the specific Third Party Material, if any. * */ var F2;F2=function(){var e=function(e,n){function r(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}return n=t(n||""),e=t(e||""),n&&e?(n.protocol||e.protocol)+(n.protocol||n.authority?n.authority:e.authority)+r(n.protocol||n.authority||"/"===n.pathname.charAt(0)?n.pathname:n.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+n.pathname:e.pathname)+(n.protocol||n.authority||n.pathname?n.search:n.search||e.search)+n.hash:null},t=function(e){var t=(e+"").replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null};return{appConfigReplacer:function(e,t){return"root"==e||"ui"==e||"height"==e?void 0:t},Apps:{},extend:function(e,t,n){var r="function"==typeof t,o=e?e.split("."):[],i=this;t=t||{},"F2"===o[0]&&(o=o.slice(1));for(var a=0,s=o.length;s>a;a++)i[o[a]]||(i[o[a]]=r&&a+1==s?t:{}),i=i[o[a]];if(!r)for(var l in t)(i[l]===void 0||n)&&(i[l]=t[l]);return i},guid:function(){var e=function(){return(0|65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},inArray:function(e,t){return jQuery.inArray(e,t)>-1},isLocalRequest:function(t){var n,r,o=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,i=t.toLowerCase(),a=o.exec(i);try{n=location.href}catch(s){n=document.createElement("a"),n.href="",n=n.href}n=n.toLowerCase(),a||(i=e(n,i).toLowerCase(),a=o.exec(i)),r=o.exec(n)||[];var l=!(a&&(a[1]!==r[1]||a[2]!==r[2]||(a[3]||("http:"===a[1]?"80":"443"))!==(r[3]||("http:"===r[1]?"80":"443"))));return l},isNativeDOMNode:function(e){var t="object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName,n="object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName;return t||n},log:function(){for(var e,t,n,r="log",o=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],a=i.length,s=window.console=window.console||{};a--;)t=i[a],s[t]||(s[t]=o),arguments&&arguments.length>1&&arguments[0]==t&&(r=t,n=Array.prototype.slice.call(arguments,1));e=Function.prototype.bind?Function.prototype.bind.call(s[r],s):function(){Function.prototype.apply.call(s[r],s,n||arguments)},e.apply(this,n||arguments)},parse:function(e){return JSON.parse(e)},stringify:function(e,t,n){return JSON.stringify(e,t,n)},version:function(){return"{{sdk.version}}"}}}(),F2.extend("AppHandlers",function(){var e=F2.guid(),t=F2.guid(),n={appCreateRoot:[],appRenderBefore:[],appDestroyBefore:[],appRenderAfter:[],appDestroyAfter:[],appRender:[],appDestroy:[],appScriptLoadFailed:[]},r={appRender:function(e,t){var n=null;F2.isNativeDOMNode(e.root)?(n=jQuery(e.root),n.append(t)):(e.root=jQuery(t).get(0),n=jQuery(e.root)),jQuery("body").append(n)},appDestroy:function(e){e&&e.app&&e.app.destroy&&"function"==typeof e.app.destroy?e.app.destroy():e&&e.app&&e.app.destroy&&F2.log(e.config.appId+" has a destroy property, but destroy is not of type function and as such will not be executed."),jQuery(e.config.root).fadeOut(500,function(){jQuery(this).remove()})}},o=function(e,t,n,r){i(e);var o={func:n,namespace:t,domNode:F2.isNativeDOMNode(n)?n:null};if(!o.func&&!o.domNode)throw"Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.";if(o.domNode&&!r)throw"Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.";return o},i=function(n){if(e!=n&&t!=n)throw"Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken()."},a=function(e,t,r){if(i(e),r||t)if(!r&&t)n[t]=[];else if(r&&!t){r=r.toLowerCase();for(var o in n){for(var a=n[o],s=[],l=0,c=a.length;c>l;l++){var u=a[l];u&&(u.namespace&&u.namespace.toLowerCase()==r||s.push(u))}a=s}}else if(r&&n[t]){r=r.toLowerCase();for(var p=[],f=0,d=n[t].length;d>f;f++){var h=n[t][f];h&&(h.namespace&&h.namespace.toLowerCase()==r||p.push(h))}n[t]=p}};return{getToken:function(){return delete this.getToken,e},__f2GetToken:function(){return delete this.__f2GetToken,t},__trigger:function(e,o){if(e!=t)throw"Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().";if(!n||!n[o])throw"Invalid EventKey passed. Check your inputs and try again.";for(var i=[],a=2,s=arguments.length;s>a;a++)i.push(arguments[a]);if(0===n[o].length&&r[o])return r[o].apply(F2,i),this;if(0===n[o].length&&!n[o])return this;for(var l=0,c=n[o].length;c>l;l++){var u=n[o][l];if(u.domNode&&arguments[2]&&arguments[2].root&&arguments[3]){var p=jQuery(arguments[2].root).append(arguments[3]);jQuery(u.domNode).append(p)}else u.domNode&&arguments[2]&&!arguments[2].root&&arguments[3]?(arguments[2].root=jQuery(arguments[3]).get(0),jQuery(u.domNode).append(arguments[2].root)):u.func.apply(F2,i)}return this},on:function(e,t,r){var i=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var a=t.split(".");t=a[0],i=a[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return n[t].push(o(e,i,r,"appRender"==t)),this},off:function(e,t){var r=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var o=t.split(".");t=o[0],r=o[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return a(e,t,r),this}}}()),F2.extend("Constants",{AppHandlers:function(){return{APP_CREATE_ROOT:"appCreateRoot",APP_RENDER_BEFORE:"appRenderBefore",APP_RENDER:"appRender",APP_RENDER_AFTER:"appRenderAfter",APP_DESTROY_BEFORE:"appDestroyBefore",APP_DESTROY:"appDestroy",APP_DESTROY_AFTER:"appDestroyAfter",APP_SCRIPT_LOAD_FAILED:"appScriptLoadFailed"}}()}),F2.extend("",{App:function(){return{init:function(){}}},AppConfig:{appId:"",context:{},enableBatchRequests:!1,height:0,instanceId:"",isSecure:!1,manifestUrl:"",maxWidth:0,minGridSize:4,minWidth:300,name:"",root:void 0,ui:void 0,views:[]},AppManifest:{apps:[],inlineScripts:[],scripts:[],styles:[]},AppContent:{data:{},html:"",status:""},ContainerConfig:{afterAppRender:function(){},appRender:function(){},beforeAppRender:function(){},debugMode:!1,scriptErrorTimeout:7e3,isSecureAppPage:!1,secureAppPagePath:"",supportedViews:[],UI:{Mask:{backgroundColor:"#FFF",loadingIcon:"",opacity:.6,useClasses:!1,zIndex:2}},xhr:{dataType:function(){},type:function(){},url:function(){}}}}),F2.extend("Constants",{Css:function(){var e="f2-";return{APP:e+"app",APP_CONTAINER:e+"app-container",APP_TITLE:e+"app-title",APP_VIEW:e+"app-view",APP_VIEW_TRIGGER:e+"app-view-trigger",MASK:e+"mask",MASK_CONTAINER:e+"mask-container"}}(),Events:function(){var e="App.",t="Container.";return{APP_SYMBOL_CHANGE:e+"symbolChange",APP_WIDTH_CHANGE:e+"widthChange.",CONTAINER_SYMBOL_CHANGE:t+"symbolChange",CONTAINER_WIDTH_CHANGE:t+"widthChange"}}(),JSONP_CALLBACK:"F2_jsonpCallback_",Sockets:{EVENT:"__event__",LOAD:"__socketLoad__",RPC:"__rpc__",RPC_CALLBACK:"__rpcCallback__",UI_RPC:"__uiRpc__"},Views:{DATA_ATTRIBUTE:"data-f2-view",ABOUT:"about",HELP:"help",HOME:"home",REMOVE:"remove",SETTINGS:"settings"}}),F2.extend("Events",function(){var e=new EventEmitter2({wildcard:!0});return e.setMaxListeners(0),{_socketEmit:function(){return EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},emit:function(){return F2.Rpc.broadcast(F2.Constants.Sockets.EVENT,[].slice.call(arguments)),EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},many:function(t,n,r){return e.many(t,n,r)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)},once:function(t,n){return e.once(t,n)}}}()),F2.extend("Rpc",function(){var e={},t="",n={},r=RegExp("^"+F2.Constants.Sockets.EVENT),o=RegExp("^"+F2.Constants.Sockets.RPC),i=RegExp("^"+F2.Constants.Sockets.RPC_CALLBACK),a=RegExp("^"+F2.Constants.Sockets.LOAD),s=RegExp("^"+F2.Constants.Sockets.UI_RPC),l=function(){var e,t=!1,r=[],o=new easyXDM.Socket({onMessage:function(i,s){if(!t&&a.test(i)){i=i.replace(a,"");var l=F2.parse(i);2==l.length&&(e=l[0],n[e.instanceId]={config:e,socket:o},F2.registerApps([e],[l[1]]),jQuery.each(r,function(){p(e,i,s)}),t=!0)}else t?p(e,i,s):r.push(i)}})},c=function(e,n){var r=jQuery(e.root);if(r.is("."+F2.Constants.Css.APP_CONTAINER)||r.find("."+F2.Constants.Css.APP_CONTAINER),!r.length)return F2.log("Unable to locate app in order to establish secure connection."),void 0;var o={scrolling:"no",style:{width:"100%"}};e.height&&(o.style.height=e.height+"px");var i=new easyXDM.Socket({remote:t,container:r.get(0),props:o,onMessage:function(t,n){p(e,t,n)},onReady:function(){i.postMessage(F2.Constants.Sockets.LOAD+F2.stringify([e,n],F2.appConfigReplacer))}});return i},u=function(e,t){return function(){F2.Rpc.call(e,F2.Constants.Sockets.RPC_CALLBACK,t,[].slice.call(arguments).slice(2))}},p=function(t,n){function a(e,t){for(var n=(t+"").split("."),r=0;n.length>r;r++){if(void 0===e[n[r]]){e=void 0;break}e=e[n[r]]}return e}function l(e,t,n){var r=F2.parse(t.replace(e,""));return r.params&&r.params.length&&r.callbacks&&r.callbacks.length&&jQuery.each(r.callbacks,function(e,t){jQuery.each(r.params,function(e,o){t==o&&(r.params[e]=u(n,t))})}),r}var c,p;s.test(n)?(c=l(s,n,t.instanceId),p=a(t.ui,c.functionName),void 0!==p?p.apply(t.ui,c.params):F2.log("Unable to locate UI RPC function: "+c.functionName)):o.test(n)?(c=l(o,n,t.instanceId),p=a(window,c.functionName),void 0!==p?p.apply(p,c.params):F2.log("Unable to locate RPC function: "+c.functionName)):i.test(n)?(c=l(i,n,t.instanceId),void 0!==e[c.functionName]&&(e[c.functionName].apply(e[c.functionName],c.params),delete e[c.functionName])):r.test(n)&&(c=l(r,n,t.instanceId),F2.Events._socketEmit.apply(F2.Events,c))},f=function(t){var n=F2.guid();return e[n]=t,n};return{broadcast:function(e,t){var r=e+F2.stringify(t);jQuery.each(n,function(e,t){t.socket.postMessage(r)})},call:function(e,t,r,o){var i=[];jQuery.each(o,function(e,t){if("function"==typeof t){var n=f(t);o[e]=n,i.push(n)}}),n[e].socket.postMessage(t+F2.stringify({functionName:r,params:o,callbacks:i}))},init:function(e){t=e,t||l()},isRemote:function(e){return void 0!==n[e]&&n[e].config.isSecure&&0===jQuery(n[e].config.root).find("iframe").length},register:function(e,t){e&&t?n[e.instanceId]={config:e,socket:c(e,t)}:F2.log("Unable to register socket connection. Please check container configuration.")}}}()),F2.extend("UI",function(){var e,t=function(e){var t=e,n=jQuery(e.root),r=function(e){e=e||jQuery(t.root).outerHeight(),F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"updateHeight",[e]):(t.height=e,n.find("iframe").height(t.height))};return{hideMask:function(e){F2.UI.hideMask(t.instanceId,e)},Modals:function(){var e=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Alert!</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button class="btn btn-primary btn-ok">OK</button>',"</div>","</div>"].join("")},n=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Confirm</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button type="button" class="btn btn-primary btn-ok">OK</button>','<button type="button" class="btn btn-cancel">Cancel</button">',"</div>","</div>"].join("")};return{alert:function(n,r){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.alert",[].slice.call(arguments)):jQuery(e(n)).on("show",function(){var e=this;jQuery(e).find(".btn-primary").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.alert()"),void 0)},confirm:function(e,r,o){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.confirm",[].slice.call(arguments)):jQuery(n(e)).on("show",function(){var e=this;jQuery(e).find(".btn-ok").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()}),jQuery(e).find(".btn-cancel").on("click",function(){jQuery(e).modal("hide").remove(),(o||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.confirm()"),void 0)}}}(),setTitle:function(e){F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"setTitle",[e]):jQuery(t.root).find("."+F2.Constants.Css.APP_TITLE).text(e)},showMask:function(e,n){F2.UI.showMask(t.instanceId,e,n)},updateHeight:r,Views:function(){var e=new EventEmitter2,o=/change/i;e.setMaxListeners(0);var i=function(e){return o.test(e)?!0:(F2.log('"'+e+'" is not a valid F2.UI.Views event name'),!1)};return{change:function(o){"function"==typeof o?this.on("change",o):"string"==typeof o&&(t.isSecure&&!F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Views.change",[].slice.call(arguments)):F2.inArray(o,t.views)&&(jQuery("."+F2.Constants.Css.APP_VIEW,n).addClass("hide").filter('[data-f2-view="'+o+'"]',n).removeClass("hide"),r(),e.emit("change",o)))},off:function(t,n){i(t)&&e.off(t,n)},on:function(t,n){i(t)&&e.on(t,n)}}}()}};return t.hideMask=function(e,t){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.hideMask()"),void 0;if(F2.Rpc.isRemote(e)&&!jQuery(t).is("."+F2.Constants.Css.APP))F2.Rpc.call(e,F2.Constants.Sockets.RPC,"F2.UI.hideMask",[e,jQuery(t).selector]);else{var n=jQuery(t);n.find("> ."+F2.Constants.Css.MASK).remove(),n.removeClass(F2.Constants.Css.MASK_CONTAINER),n.data(F2.Constants.Css.MASK_CONTAINER)&&n.css({position:"static"})}},t.init=function(t){e=t,e.UI=jQuery.extend(!0,{},F2.ContainerConfig.UI,e.UI||{})},t.showMask=function(t,n,r){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.showMask()"),void 0;if(F2.Rpc.isRemote(t)&&jQuery(n).is("."+F2.Constants.Css.APP))F2.Rpc.call(t,F2.Constants.Sockets.RPC,"F2.UI.showMask",[t,jQuery(n).selector,r]);else{r&&!e.UI.Mask.loadingIcon&&F2.log("Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();");var o=jQuery(n).addClass(F2.Constants.Css.MASK_CONTAINER),i=jQuery("<div>").height("100%").width("100%").addClass(F2.Constants.Css.MASK);e.UI.Mask.useClasses||i.css({"background-color":e.UI.Mask.backgroundColor,"background-image":e.UI.Mask.loadingIcon?"url("+e.UI.Mask.loadingIcon+")":"","background-position":"50% 50%","background-repeat":"no-repeat",display:"block",left:0,"min-height":30,padding:0,position:"absolute",top:0,"z-index":e.UI.Mask.zIndex,filter:"alpha(opacity="+100*e.UI.Mask.opacity+")",opacity:e.UI.Mask.opacity}),"static"===o.css("position")&&(o.css({position:"relative"}),o.data(F2.Constants.Css.MASK_CONTAINER,!0)),o.append(i)}},t}()),F2.extend("",function(){var _apps={},_config=!1,_bUsesAppHandlers=!1,_sAppHandlerToken=F2.AppHandlers.__f2GetToken(),_afterAppRender=function(e,t){var n=_config.afterAppRender||function(e,t){return jQuery(t).appendTo("body")},r=n(e,t);return _config.afterAppRender&&!r?(F2.log("F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app"),void 0):(jQuery(r).addClass(F2.Constants.Css.APP),r.get(0))},_appRender=function(e,t){return t=_outerHtml(jQuery(t).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)),_config.appRender&&(t=_config.appRender(e,t)),_outerHtml(t)},_beforeAppRender=function(e){var t=_config.beforeAppRender||jQuery.noop;return t(e)},_appScriptLoadFailed=function(e,t){var n=_config.appScriptLoadFailed||jQuery.noop;return n(e,t)},_createAppConfig=function(e){return e=jQuery.extend(!0,{},e),e.instanceId=e.instanceId||F2.guid(),e.views=e.views||[],F2.inArray(F2.Constants.Views.HOME,e.views)||e.views.push(F2.Constants.Views.HOME),e},_hydrateContainerConfig=function(e){e.scriptErrorTimeout||(e.scriptErrorTimeout=F2.ContainerConfig.scriptErrorTimeout),e.debugMode!==!0&&(e.debugMode=F2.ContainerConfig.debugMode)},_initAppEvents=function(e){jQuery(e.root).on("click","."+F2.Constants.Css.APP_VIEW_TRIGGER+"["+F2.Constants.Views.DATA_ATTRIBUTE+"]",function(t){t.preventDefault();var n=jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();n==F2.Constants.Views.REMOVE?F2.removeApp(e.instanceId):e.ui.Views.change(n)})},_initContainerEvents=function(){var e,t=function(){F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE)};jQuery(window).on("resize",function(){clearTimeout(e),e=setTimeout(t,100)})},_isInit=function(){return!!_config},_createAppInstance=function(e,t){e.ui=new F2.UI(e),void 0!==F2.Apps[e.appId]&&("function"==typeof F2.Apps[e.appId]?setTimeout(function(){_apps[e.instanceId].app=new F2.Apps[e.appId](e,t,e.root),void 0!==_apps[e.instanceId].app.init&&_apps[e.instanceId].app.init()},0):F2.log("app initialization class is defined but not a function. ("+e.appId+")"))},_loadApps=function(appConfigs,appManifest){if(appConfigs=[].concat(appConfigs),1==appConfigs.length&&appConfigs[0].isSecure&&!_config.isSecureAppPage)return _loadSecureApp(appConfigs[0],appManifest),void 0;if(appConfigs.length!=appManifest.apps.length)return F2.log("The number of apps defined in the AppManifest do not match the number requested.",appManifest),void 0;var scripts=appManifest.scripts||[],styles=appManifest.styles||[],inlines=appManifest.inlineScripts||[],scriptCount=scripts.length,scriptsLoaded=0,appInit=function(){jQuery.each(appConfigs,function(e,t){_createAppInstance(t,appManifest.apps[e])})},isFileReady=function(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e},_onload=function(e){if("load"==e.type||isFileReady((e.currentTarget||e.srcElement).readyState)){var t=e.currentTarget||e.srcElement;t.detachEvent?t.detachEvent("onreadystatechange",_onload):(removeEventListener(t,_onload,"load"),removeEventListener(t,_error,"error"))}++scriptsLoaded==scriptCount&&(evalInlines(),appInit())},_error=function(e){setTimeout(function(){var t={src:e.target.src,appId:appConfigs[0].appId};F2.log("Script defined in '"+t.appId+"' failed to load '"+t.src+"'"),F2.Events.emit("RESOURCE_FAILED_TO_LOAD",t),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],t.src):_appScriptLoadFailed(appConfigs[0],t.src)},_config.scriptErrorTimeout)},evalInlines=function(){jQuery.each(inlines,function(i,e){try{eval(e)}catch(exception){F2.log("Error loading inline script: "+exception+"\n\n"+e),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],exception):_appScriptLoadFailed(appConfigs[0],exception)}})},stylesFragment=null,useCreateStyleSheet=!!document.createStyleSheet;jQuery.each(styles,function(e,t){useCreateStyleSheet?document.createStyleSheet(t):(stylesFragment=stylesFragment||[],stylesFragment.push('<link rel="stylesheet" type="text/css" href="'+t+'"/>'))}),stylesFragment&&jQuery("head").append(stylesFragment.join("")),jQuery.each(appManifest.apps,function(e,t){if(_bUsesAppHandlers){F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,appConfigs[e],_outerHtml(t.html));var n=appConfigs[e].appId;if(!appConfigs[e].root)throw"Root for "+n+" must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.";var r=jQuery(appConfigs[e].root);if(0===r.parents("body:first").length)throw"App root for "+n+" was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,appConfigs[e]),!F2.isNativeDOMNode(appConfigs[e].root))throw"App root for "+n+" must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.";r.addClass(F2.Constants.Css.APP_CONTAINER+" "+n)}else appConfigs[e].root=_afterAppRender(appConfigs[e],_appRender(appConfigs[e],t.html));_initAppEvents(appConfigs[e])}),jQuery.each(scripts,function(e,t){var n=document,r=n.createElement("script"),o=t;_config.debugMode&&(o+="?cachebuster="+(new Date).getTime()),r.async=!1,r.src=o,r.type="text/javascript",r.charset="utf-8",!r.attachEvent||r.attachEvent.toString&&0>(""+r.attachEvent).indexOf("[native code")?(r.addEventListener("load",_onload,!1),r.addEventListener("error",_error,!1)):r.attachEvent("onreadystatechange",_onload),n.body.appendChild(r)}),scriptCount||(evalInlines(),appInit())},_loadSecureApp=function(e,t){if(_config.secureAppPagePath){if(_bUsesAppHandlers){var n=jQuery(e.root);if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,e,t.html),0===n.parents("body:first").length)throw"App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,e),!e.root)throw"App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";if(!F2.isNativeDOMNode(e.root))throw"App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";jQuery(e.root).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)}else e.root=_afterAppRender(e,_appRender(e,"<div></div>"));e.ui=new F2.UI(e),_initAppEvents(e),F2.Rpc.register(e,t)}else F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.')},_outerHtml=function(e){return jQuery("<div></div>").append(e).html()},_validateApp=function(e){return e.appId?e.root||e.manifestUrl?!0:(F2.log('"manifestUrl" missing from app object'),!1):(F2.log('"appId" missing from app object'),!1)},_validateContainerConfig=function(){if(_config&&_config.xhr){if("function"!=typeof _config.xhr&&"object"!=typeof _config.xhr)throw"ContainerConfig.xhr should be a function or an object";if(_config.xhr.dataType&&"function"!=typeof _config.xhr.dataType)throw"ContainerConfig.xhr.dataType should be a function";if(_config.xhr.type&&"function"!=typeof _config.xhr.type)throw"ContainerConfig.xhr.type should be a function";if(_config.xhr.url&&"function"!=typeof _config.xhr.url)throw"ContainerConfig.xhr.url should be a function"}return!0};return{getContainerState:function(){return _isInit()?jQuery.map(_apps,function(e){return{appId:e.config.appId}}):(F2.log("F2.init() must be called before F2.getContainerState()"),void 0)},init:function(e){_config=e||{},_validateContainerConfig(),_hydrateContainerConfig(_config),_bUsesAppHandlers=!(_config.beforeAppRender||_config.appRender||_config.afterAppRender||_config.appScriptLoadFailed),(_config.secureAppPagePath||_config.isSecureAppPage)&&F2.Rpc.init(_config.secureAppPagePath?_config.secureAppPagePath:!1),F2.UI.init(_config),_config.isSecureAppPage||_initContainerEvents()},isInit:_isInit,registerApps:function(e,t){if(!_isInit())return F2.log("F2.init() must be called before F2.registerApps()"),void 0;if(!e)return F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0;var n=[],r={},o={},i=!1;return e=[].concat(e),t=[].concat(t||[]),i=!!t.length,e.length?e.length&&i&&e.length!=t.length?(F2.log('The length of "apps" does not equal the length of "appManifests"'),void 0):(jQuery.each(e,function(e,o){if(o=_createAppConfig(o),o.root=o.root||null,_validateApp(o)){if(_apps[o.instanceId]={config:o},o.root){if(!o.root&&"string"!=typeof o.root&&!F2.isNativeDOMNode(o.root))throw F2.log("AppConfig invalid for pre-load, not a valid string and not dom node"),F2.log("AppConfig instance:",o),"Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.";if(1!=jQuery(o.root).length)throw F2.log("AppConfig invalid for pre-load, root not unique"),F2.log("AppConfig instance:",o),F2.log("Number of dom node instances:",jQuery(o.root).length),"Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.";return _createAppInstance(o),_initAppEvents(o),void 0}_bUsesAppHandlers?(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_CREATE_ROOT,o),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_BEFORE,o)):o.root=_beforeAppRender(o),i?_loadApps(o,t[e]):o.enableBatchRequests&&!o.isSecure?(r[o.manifestUrl.toLowerCase()]=r[o.manifestUrl.toLowerCase()]||[],r[o.manifestUrl.toLowerCase()].push(o)):n.push({apps:[o],url:o.manifestUrl})}}),i||(jQuery.each(r,function(e,t){n.push({url:e,apps:t})}),jQuery.each(n,function(e,t){var n=F2.Constants.JSONP_CALLBACK+t.apps[0].appId;o[n]=o[n]||[],o[n].push(t)}),jQuery.each(o,function(e,t){var n=function(r,o){if(o){var i=o.url,a="GET",s="jsonp",l=function(){n(e,t.pop())},c=function(){jQuery.each(o.apps,function(e,t){F2.log("Removed failed "+t.name+" app",t),F2.removeApp(t.instanceId)})},u=function(e){_loadApps(o.apps,e)};if(_config.xhr&&_config.xhr.dataType&&(s=_config.xhr.dataType(o.url,o.apps),"string"!=typeof s))throw"ContainerConfig.xhr.dataType should return a string";if(_config.xhr&&_config.xhr.type&&(a=_config.xhr.type(o.url,o.apps),"string"!=typeof a))throw"ContainerConfig.xhr.type should return a string";if(_config.xhr&&_config.xhr.url&&(i=_config.xhr.url(o.url,o.apps),"string"!=typeof i))throw"ContainerConfig.xhr.url should return a string";var p=_config.xhr;"function"!=typeof p&&(p=function(e,t,n,i,l){jQuery.ajax({url:e,type:a,data:{params:F2.stringify(o.apps,F2.appConfigReplacer)},jsonp:!1,jsonpCallback:r,dataType:s,success:n,error:function(e,t,n){F2.log("Failed to load app(s)",""+n,o.apps),i()},complete:l})}),p(i,o.apps,u,c,l)}};n(e,t.pop())})),void 0):(F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0)},removeAllApps:function(){return _isInit()?(jQuery.each(_apps,function(e,t){F2.removeApp(t.config.instanceId)}),void 0):(F2.log("F2.init() must be called before F2.removeAllApps()"),void 0)},removeApp:function(e){return _isInit()?(_apps[e]&&(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_BEFORE,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_AFTER,_apps[e]),delete _apps[e]),void 0):(F2.log("F2.init() must be called before F2.removeApp()"),void 0)}}}()),exports.F2=F2,"undefined"!=typeof define&&define.amd&&define(function(){return F2})}})("undefined"!=typeof exports?exports:window); //@ sourceMappingURL=f2.min.map
react-js/browser-history-production/test/test_helper.js
vanyaland/react-demos
import _$ from 'jquery'; import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; import jsdom from 'jsdom'; import chai, { expect } from 'chai'; import chaiJquery from 'chai-jquery'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducers from '../src/reducers'; global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = global.document.defaultView; global.navigator = global.window.navigator; const $ = _$(window); chaiJquery(chai, chai.util, $); function renderComponent(ComponentClass, props = {}, state = {}) { const componentInstance = TestUtils.renderIntoDocument( <Provider store={createStore(reducers, state)}> <ComponentClass {...props} /> </Provider> ); return $(ReactDOM.findDOMNode(componentInstance)); } $.fn.simulate = function(eventName, value) { if (value) { this.val(value); } TestUtils.Simulate[eventName](this[0]); }; export {renderComponent, expect};
definitions/npm/styled-components_v3.x.x/flow_v0.104.x-/test_styled-components_native_v3.x.x.js
splodingsocks/FlowTyped
// @flow import nativeStyled, { ThemeProvider as NativeThemeProvider, withTheme as nativeWithTheme, keyframes as nativeKeyframes, } from 'styled-components/native' import React from 'react' import type { Theme as NativeTheme, Interpolation as NativeInterpolation, ReactComponentFunctional as NativeReactComponentFunctional, ReactComponentFunctionalUndefinedDefaultProps as NativeReactComponentFunctionalUndefinedDefaultProps, ReactComponentClass as NativeReactComponentClass, ReactComponentStyled as NativeReactComponentStyled, ReactComponentStyledTaggedTemplateLiteral as NativeReactComponentStyledTaggedTemplateLiteral, ReactComponentUnion as NativeReactComponentUnion, ReactComponentIntersection as NativeReactComponentIntersection, } from 'styled-components' import styled from 'styled-components'; const Wrapper = styled.View``; const NativeTitleTaggedTemplateLiteral: NativeReactComponentStyledTaggedTemplateLiteral<*> = nativeStyled.Text; const NativeTitleStyled: NativeReactComponentStyled<*> = nativeStyled.Text` font-size: 1.5em; `; const NativeTitleGeneric: NativeReactComponentIntersection<*> = nativeStyled.Text` font-size: 1.5em; `; const NativeTitleFunctional: NativeReactComponentFunctional<*> = nativeStyled.Text` font-size: 1.5em; `; const NativeTitleClass: NativeReactComponentClass<*> = nativeStyled.Text` font-size: 1.5em; `; declare var nativeNeedsReactComponentFunctional: NativeReactComponentFunctional<*> => void declare var nativeNeedsReactComponentClass: NativeReactComponentClass<*> => void nativeNeedsReactComponentFunctional(NativeTitleStyled) nativeNeedsReactComponentClass(NativeTitleStyled) const NativeExtendedTitle: NativeReactComponentIntersection<*> = nativeStyled(NativeTitleStyled)` font-size: 2em; `; const NativeWrapper: NativeReactComponentIntersection<*> = nativeStyled.View` padding: 4em; background: ${({theme}) => theme.background}; `; // ---- EXTEND ---- const NativeAttrs0ReactComponent: NativeReactComponentStyled<*> = nativeStyled.View.extend``; const NativeAttrs0ExtendReactComponent: NativeReactComponentIntersection<*> = NativeAttrs0ReactComponent.extend``; const NativeAttrs0SyledComponent: NativeReactComponentStyledTaggedTemplateLiteral<*> = nativeStyled.View; const NativeAttrs0ExtendStyledComponent: NativeReactComponentIntersection<*> = NativeAttrs0SyledComponent.extend``; // ---- ATTRIBUTES ---- const NativeAttrs1: NativeReactComponentStyledTaggedTemplateLiteral<*> = nativeStyled.View.attrs({ testProp: 'foo' }); // $FlowExpectedError const NativeAttrs1Error: NativeReactComponentStyledTaggedTemplateLiteral<*> = nativeStyled.View.attrs({ testProp: 'foo' })``; declare var needsString: string => void nativeNeedsReactComponentFunctional(nativeStyled.View.attrs({})``) nativeNeedsReactComponentClass(nativeStyled.View.attrs({})``) // $FlowExpectedError needsString(nativeStyled.View.attrs({})``) const NativeAttrs2: NativeReactComponentStyledTaggedTemplateLiteral<*> = nativeStyled.View .attrs({ testProp1: 'foo' }) .attrs({ testProp2: 'bar' }); const NativeAttrs3Styled: NativeReactComponentStyled<*> = nativeStyled.View.attrs({ testProp: 'foo' })` background-color: red; `; const NativeAttrs3Generic: NativeReactComponentIntersection<*> = nativeStyled.View.attrs({ testProp: 'foo' })` background-color: red; `; const NativeAttrs3Functional: NativeReactComponentFunctional<*> = nativeStyled.View.attrs({ testProp: 'foo' })` background-color: red; `; const NativeAttrs3Class: NativeReactComponentClass<*> = nativeStyled.View.attrs({ testProp: 'foo' })` background-color: red; `; const nativeTheme: NativeTheme = { background: "papayawhip" }; // ---- WithComponent ---- const NativeWithComponent1: NativeReactComponentStyled<*> = nativeStyled.View.withComponent('Text'); const NativeWithComponent2: NativeReactComponentStyled<*> = nativeStyled.View.withComponent(NativeWithComponent1); const NativeWithComponent3: NativeReactComponentStyled<*> = nativeStyled.View.withComponent(NativeAttrs3Class); const NativeWithComponent4: NativeReactComponentStyled<*> = nativeStyled('View').withComponent('Text'); const NativeWithComponent5: NativeReactComponentStyled<*> = nativeStyled('View').withComponent(NativeWithComponent1); const NativeWithComponent6: NativeReactComponentStyled<*> = nativeStyled('View').withComponent(NativeAttrs3Class); // $FlowExpectedError const NativeWithComponentError1: NativeReactComponentStyled<*> = nativeStyled.View.withComponent(0); // $FlowExpectedError const NativeWithComponentError2: NativeReactComponentStyled<*> = nativeStyled.View.withComponent('NotHere'); class NativeCustomComponentError3 extends React.Component<{ foo: string, ... }> { render() { return <div />; } } // $FlowExpectedError const NativeWithComponentError3 = nativeStyled(NativeCustomComponentError3).withComponent('Text'); // $FlowExpectedError const NativeWithComponentError4 = nativeStyled(NativeCustomComponentError3).withComponent(NativeWithComponent1); // $FlowExpectedError const NativeWithComponentError5 = nativeStyled(NativeCustomComponentError3).withComponent(NativeAttrs3Class); // $FlowExpectedError const NativeWithComponentError6 = nativeStyled(NativeCustomComponentError3).withComponent(0); // $FlowExpectedError const NativeWithComponentError7 = nativeStyled(NativeCustomComponentError3).withComponent('NotHere'); // ---- WithTheme ---- const NativeComponent: NativeReactComponentFunctionalUndefinedDefaultProps<{ theme: NativeTheme, ... }> = ({ theme }) => ( <NativeThemeProvider theme={theme}> <NativeWrapper> <NativeTitleStyled>Hello World, this is my first styled component!</NativeTitleStyled> </NativeWrapper> </NativeThemeProvider> ); const NativeComponentWithTheme: NativeReactComponentFunctionalUndefinedDefaultProps<{...}> = nativeWithTheme(NativeComponent); const NativeComponent2: NativeReactComponentFunctionalUndefinedDefaultProps<{...}> = () => ( <NativeThemeProvider theme={outerTheme => outerTheme}> <NativeWrapper> <NativeTitleStyled>Hello World, this is my first styled component!</NativeTitleStyled> </NativeWrapper> </NativeThemeProvider> ); const NativeOpacityKeyFrame: string = nativeKeyframes` 0% { opacity: 0; } 100% { opacity: 1; } `; // $FlowExpectedError const NativeNoExistingElementWrapper = nativeStyled.nonexisting` padding: 4em; background: papayawhip; `; const nativeNum: 9 = 9 // $FlowExpectedError const NativeNoExistingComponentWrapper = nativeStyled()` padding: 4em; background: papayawhip; `; // $FlowExpectedError const NativeNumberWrapper = nativeStyled(nativeNum)` padding: 4em; background: papayawhip; `; // ---- COMPONENT CLASS TESTS ---- class NativeNeedsThemeReactClass extends React.Component<{ foo: string, theme: NativeTheme, ... }> { render() { return <div />; } } class NativeReactClass extends React.Component<{ foo: string, ... }> { render() { return <div />; } } const NativeStyledClass: NativeReactComponentClass<{ foo: string, theme: NativeTheme, ... }> = nativeStyled(NativeNeedsThemeReactClass)` color: red; `; const NativeNeedsFoo1Class: NativeReactComponentClass<{ foo: string, ... }, { theme: NativeTheme, ... }> = nativeWithTheme(NativeNeedsThemeReactClass); // $FlowExpectedError const NativeNeedsFoo0ClassError: NativeReactComponentClass<{ foo: string, ... }> = nativeWithTheme(NativeReactClass); // $FlowExpectedError const NativeNeedsFoo1ClassError: NativeReactComponentClass<{ foo: string, ... }> = nativeWithTheme(NeedsFoo1Class); // $FlowExpectedError const NativeNeedsFoo1ErrorClass: NativeReactComponentClass<{ foo: number, ... }> = nativeWithTheme(NativeNeedsThemeReactClass); // $FlowExpectedError const NativeNeedsFoo2ErrorClass: NativeReactComponentClass<{ foo: string, ... }, { theme: string, ... }> = nativeWithTheme(NativeNeedsThemeReactClass); // $FlowExpectedError const NativeNeedsFoo3ErrorClass: NativeReactComponentClass<{ foo: string, theme: NativeTheme, ... }> = nativeWithTheme(NativeNeedsFoo1Class); // $FlowExpectedError const NativeNeedsFoo4ErrorClass: NativeReactComponentClass<{ foo: number, ... }> = nativeWithTheme(NativeNeedsFoo1Class); // $FlowExpectedError const NativeNeedsFoo5ErrorClass: NativeReactComponentClass<{ foo: string, theme: string, ... }> = nativeWithTheme(NativeNeedsFoo1Class); // ---- INTERPOLATION TESTS ---- const nativeInterpolation: Array<NativeInterpolation> = nativeStyled.css` background-color: red; `; // $FlowExpectedError const nativeInterpolationError: Array<NativeInterpolation | boolean> = nativeStyled.css` background-color: red; `; // ---- DEFAULT COMPONENT TESTS ---- const NativeDefaultComponent: NativeReactComponentIntersection<{...}> = nativeStyled.View` background-color: red; `; // $FlowExpectedError const NativeDefaultComponentError: {...} => string = nativeStyled.View` background-color: red; `; // ---- FUNCTIONAL COMPONENT TESTS ---- declare var View: ({...}) => React$Element<*> const NativeFunctionalComponent: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: string, theme: NativeTheme, ... }> = props => <View />; const NativeNeedsFoo1: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: string, theme: NativeTheme, ... }> = nativeStyled(NativeFunctionalComponent)` background-color: red; `; // $FlowExpectedError const NativeNeedsFoo1Error: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: number, ... }> = nativeStyled(NativeFunctionalComponent)` background-color: red; `; const NativeNeedsFoo2: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: string, theme: NativeTheme, ... }> = nativeStyled(NativeNeedsFoo1)` background-color: red; `; // $FlowExpectedError const NativeNeedsFoo2Error: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: number, ... }> = nativeStyled(NativeNeedsFoo1)` background-color: red; `; const NativeNeedsNothingInferred = nativeStyled(() => <View />); // ---- FUNCTIONAL COMPONENT TESTS (nativeWithTheme)---- const NativeNeedsFoo1Functional: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: string, theme: NativeTheme, ... }> = nativeWithTheme(NativeFunctionalComponent); const NativeNeedsFoo2Functional: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: string, ... }> = nativeWithTheme(NativeNeedsFoo1Functional); const NativeNeedsFoo1FunctionalDefaultProps: NativeReactComponentFunctional<{ foo: string, theme: NativeTheme, ... }, { theme: NativeTheme, ... }> = nativeWithTheme(NativeFunctionalComponent); const NativeNeedsFoo2FunctionalDefaultProps: NativeReactComponentFunctional<{ foo: string, ... }, { theme: NativeTheme, ... }> = nativeWithTheme(NativeNeedsFoo1FunctionalDefaultProps); // $FlowExpectedError const NativeNeedsFoo1ErrorFunctional: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: number, ... }> = nativeWithTheme(NativeFunctionalComponent); // $FlowExpectedError const NativeNeedsFoo2ErrorFunctional: NativeReactComponentFunctional<{ foo: string, ... }, { theme: string, ... }> = nativeWithTheme(NativeFunctionalComponent); // $FlowExpectedError const NativeNeedsFoo3ErrorFunctional: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: number, theme: NativeTheme, ... }> = nativeWithTheme(NativeFunctionalComponent); // $FlowExpectedError const NativeNeedsFoo4ErrorFunctional: NativeReactComponentFunctionalUndefinedDefaultProps<{ foo: number, ... }> = nativeWithTheme(NativeNeedsFoo1Functional); // $FlowExpectedError const NativeNeedsFoo5ErrorFunctional: NativeReactComponentFunctional<{ foo: string, ... }, { theme: string, ... }> = nativeWithTheme(NativeNeedsFoo1Functional); // $FlowExpectedError const NativeNeedsFoo6ErrorFunctional: NativeReactComponentFunctional<{ foo: number, ... }, { theme: NativeTheme, ... }> = nativeWithTheme(NativeNeedsFoo1Functional);
auth/src/components/common/Input.js
dunkvalio/ReactNative
import React from 'react'; import { TextInput, View, Text } from 'react-native'; const Input = ({ label, value, onChangeText, placeholder, secureTextEntry }) => { const { inputStyle, labelStyle, containerStyle } = styles; return ( <View style={containerStyle}> <Text style={labelStyle}>{label}</Text> <TextInput secureTextEntry={secureTextEntry} style={inputStyle} value={value} placeholder={placeholder} onChangeText={onChangeText} /> </View> ); }; const styles = { labelStyle: { fontSize: 18, paddingLeft: 20, flex: 1, }, inputStyle: { color: '#000', paddingRight: 5, paddingLeft: 5, fontSize: 18, lineHeight: 23, flex: 2, }, containerStyle: { height: 40, flex: 1, flexDirection: 'row', alignItems: 'center', }, }; export { Input };
src/containers/ImageModal.js
Hylozoic/hylo-redux
import React from 'react' import Modal from '../components/Modal' import Icon from '../components/Icon' const { func, string } = React.PropTypes const leftOffset = () => { if (typeof window === 'undefined') return 0 const main = document.getElementById('main') if (!main) return 0 // this should be the case only during tests return main.offsetLeft } export default class ImageModal extends React.Component { static propTypes = {url: string, onCancel: func} handleClick (event) { const { onCancel } = this.props if (event.target.nodeName !== 'IMG') onCancel() } render () { const { url, onCancel } = this.props const marginLeft = leftOffset() + 100 const maxWidth = document.documentElement.clientWidth - marginLeft * 2 const modalStyle = {marginLeft, width: maxWidth} const imgStyle = {maxWidth} return <Modal className='modal' id='image-modal' title='' style={modalStyle}> <div className='image-cancel' onClick={this.handleClick.bind(this)}> <div className='image-wrapper'> <img src={url} style={imgStyle} /> <a className='close' onClick={onCancel}> <Icon name='Fail' /> </a> </div> </div> </Modal> } }
ajax/libs/instantsearch.js/1.8.6/instantsearch-preact.min.js
sreym/cdnjs
/*! instantsearch.js 1.8.6 | © Algolia Inc. and other contributors; Licensed MIT | github.com/algolia/instantsearch.js */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.instantsearch=t():e.instantsearch=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i);e.exports=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),n(2),n(3);var i=n(4),o=r(i),a=n(5),s=r(a),u=n(34),c=r(u),l=n(324),f=r(l),p=n(341),d=r(p),h=n(345),m=r(h),v=n(349),g=r(v),y=n(354),b=r(y),_=n(358),w=r(_),x=n(362),R=r(x),j=n(364),P=r(j),C=n(366),O=r(C),S=n(367),E=r(S),F=n(376),k=r(F),N=n(381),T=r(N),A=n(383),M=r(A),H=n(390),L=r(H),U=n(391),D=r(U),I=n(394),V=r(I),q=n(397),B=r(q),Q=n(321),z=r(Q),W=(0,o.default)(s.default);W.widgets={clearAll:f.default,currentRefinedValues:d.default,hierarchicalMenu:m.default,hits:g.default,hitsPerPageSelector:b.default,menu:w.default,refinementList:R.default,numericRefinementList:P.default,numericSelector:O.default,pagination:E.default,priceRanges:k.default,searchBox:T.default,rangeSlider:M.default,sortBySelector:L.default,starRating:D.default,stats:V.default,toggle:B.default},W.version=z.default,W.createQueryString=c.default.url.getQueryStringFromState,t.default=W},function(e,t){"use strict";Object.freeze||(Object.freeze=function(e){if(Object(e)!==e)throw new TypeError("Object.freeze can only be called on Objects.");return e})},function(e,t){"use strict";var n={};Object.setPrototypeOf||n.__proto__||!function(){var e=Object.getPrototypeOf;Object.getPrototypeOf=function(t){return t.__proto__?t.__proto__:e.call(Object,t)}}()},function(e,t){"use strict";function n(e){var t=function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return new(r.apply(e,[null].concat(n)))};return t.__proto__=e,t.prototype=e.prototype,t}var r=Function.prototype.bind;e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(){return"#"}function u(e){return function(t,n){if(!n.getConfiguration)return t;var r=n.getConfiguration(t,e),i=function e(t,n){return Array.isArray(t)?(0,_.default)(t,n):(0,j.default)(t)?(0,y.default)({},t,n,e):void 0};return(0,y.default)({},t,r,i)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(6),p=r(f),d=n(34),h=r(d),m=n(155),v=r(m),g=n(315),y=r(g),b=n(316),_=r(b),w=n(319),x=r(w),R=n(44),j=r(R),P=n(300),C=n(320),O=r(C),S=n(321),E=r(S),F=n(323),k=r(F),N=function(e){function t(e){var n=e.appId,r=void 0===n?null:n,a=e.apiKey,s=void 0===a?null:a,u=e.indexName,l=void 0===u?null:u,f=e.numberLocale,d=e.searchParameters,h=void 0===d?{}:d,m=e.urlSync,v=void 0===m?null:m,g=e.searchFunction;i(this,t);var y=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null===r||null===s||null===l){var b="\nUsage: instantsearch({\n appId: 'my_application_id',\n apiKey: 'my_search_api_key',\n indexName: 'my_index_name'\n});";throw new Error(b)}var _=(0,p.default)(r,s);return _.addAlgoliaAgent("instantsearch.js "+E.default),y.client=_,y.helper=null,y.indexName=l,y.searchParameters=c({},h,{index:l}),y.widgets=[],y.templatesConfig={helpers:(0,k.default)({numberLocale:f}),compileOptions:{}},g&&(y._searchFunction=g),y.urlSync=v===!0?{}:v,y}return a(t,e),l(t,[{key:"addWidget",value:function(e){if(void 0===e.render&&void 0===e.init)throw new Error("Widget definition missing render or init method");this.widgets.push(e)}},{key:"start",value:function(){var e=this;if(!this.widgets)throw new Error("No widgets were added to instantsearch.js");var t=void 0;if(this.urlSync){var n=(0,O.default)(this.urlSync);this._createURL=n.createURL.bind(n),this._createAbsoluteURL=function(t){return e._createURL(t,{absolute:!0})},this._onHistoryChange=n.onHistoryChange.bind(n),this.widgets.push(n),t=n.searchParametersFromUrl}else this._createURL=s,this._createAbsoluteURL=s,this._onHistoryChange=function(){};this.searchParameters=this.widgets.reduce(u(t),this.searchParameters);var r=(0,h.default)(this.client,this.searchParameters.index||this.indexName,this.searchParameters);this._searchFunction&&(this._originalHelperSearch=r.search.bind(r),r.search=this._wrappedSearch.bind(this)),this.helper=r,this._init(r.state,r),r.on("result",this._render.bind(this,r)),r.search()}},{key:"_wrappedSearch",value:function(){var e=(0,x.default)(this.helper);e.search=this._originalHelperSearch,this._searchFunction(e)}},{key:"createURL",value:function(e){if(!this._createURL)throw new Error("You need to call start() before calling createURL()");return this._createURL(this.helper.state.setQueryParameters(e))}},{key:"_render",value:function(e,t,n){var r=this;(0,v.default)(this.widgets,function(i){i.render&&i.render({templatesConfig:r.templatesConfig,results:t,state:n,helper:e,createURL:r._createAbsoluteURL})}),this.emit("render")}},{key:"_init",value:function(e,t){var n=this;(0,v.default)(this.widgets,function(r){r.init&&r.init({state:e,helper:t,templatesConfig:n.templatesConfig,createURL:n._createAbsoluteURL,onHistoryChange:n._onHistoryChange})})}}]),t}(P.EventEmitter);t.default=N},function(e,t,n){"use strict";var r=n(7),i=n(21);e.exports=i(r,"(lite) ")},function(e,t,n){function r(e,t,r){var o=n(17)("algoliasearch"),s=n(20),c=n(15),l=n(16),f="Usage: algoliasearch(applicationID, apiKey, opts)";if(r._allowEmptyCredentials!==!0&&!e)throw new u.AlgoliaSearchError("Please provide an application ID. "+f);if(r._allowEmptyCredentials!==!0&&!t)throw new u.AlgoliaSearchError("Please provide an API key. "+f);this.applicationID=e,this.apiKey=t;var p=a([this.applicationID+"-1.algolianet.com",this.applicationID+"-2.algolianet.com",this.applicationID+"-3.algolianet.com"]);this.hosts={read:[],write:[]},this.hostIndex={read:0,write:0},r=r||{};var d=r.protocol||"https:",h=void 0===r.timeout?2e3:r.timeout;if(/:$/.test(d)||(d+=":"),"http:"!==r.protocol&&"https:"!==r.protocol)throw new u.AlgoliaSearchError("protocol must be `http:` or `https:` (was `"+r.protocol+"`)");r.hosts?c(r.hosts)?(this.hosts.read=s(r.hosts),this.hosts.write=s(r.hosts)):(this.hosts.read=s(r.hosts.read),this.hosts.write=s(r.hosts.write)):(this.hosts.read=[this.applicationID+"-dsn.algolia.net"].concat(p),this.hosts.write=[this.applicationID+".algolia.net"].concat(p)),this.hosts.read=l(this.hosts.read,i(d)),this.hosts.write=l(this.hosts.write,i(d)),this.requestTimeout=h,this.extraHeaders=[],this.cache=r._cache||{},this._ua=r._ua,this._useCache=!(void 0!==r._useCache&&!r._cache)||r._useCache,this._useFallback=void 0===r.useFallback||r.useFallback,this._setTimeout=r._setTimeout,o("init done, %j",this)}function i(e){return function(t){return e+"//"+t.toLowerCase()}}function o(e){if(void 0===Array.prototype.toJSON)return JSON.stringify(e);var t=Array.prototype.toJSON;delete Array.prototype.toJSON;var n=JSON.stringify(e);return Array.prototype.toJSON=t,n}function a(e){for(var t,n,r=e.length;0!==r;)n=Math.floor(Math.random()*r),r-=1,t=e[r],e[r]=e[n],e[n]=t;return e}function s(e){var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r;r="x-algolia-api-key"===n||"x-algolia-application-id"===n?"**hidden for security purposes**":e[n],t[n]=r}return t}e.exports=r;var u=n(8),c=n(11),l=n(12),f=500;r.prototype.initIndex=function(e){return new l(this,e)},r.prototype.setExtraHeader=function(e,t){this.extraHeaders.push({name:e.toLowerCase(),value:t})},r.prototype.addAlgoliaAgent=function(e){this._ua+=";"+e},r.prototype._jsonRequest=function(e){function t(n,c){function f(e){var t=e&&e.body&&e.body.message&&e.body.status||e.statusCode||e&&e.body&&200;a("received response: statusCode: %s, computed statusCode: %d, headers: %j",e.statusCode,t,e.headers);var n=2===Math.floor(t/100),o=new Date;if(v.push({currentHost:x,headers:s(i),content:r||null,contentLength:void 0!==r?r.length:null,method:c.method,timeout:c.timeout,url:c.url,startTime:w,endTime:o,duration:o-w,statusCode:t}),n)return p._useCache&&l&&(l[_]=e.responseText),e.body;var f=4!==Math.floor(t/100);if(f)return d+=1,y();a("unrecoverable error");var h=new u.AlgoliaSearchError(e.body&&e.body.message,{debugData:v,statusCode:t});return p._promise.reject(h)}function g(t){a("error: %s, stack: %s",t.message,t.stack);var n=new Date;return v.push({currentHost:x,headers:s(i),content:r||null,contentLength:void 0!==r?r.length:null,method:c.method,timeout:c.timeout,url:c.url,startTime:w,endTime:n,duration:n-w}),t instanceof u.AlgoliaSearchError||(t=new u.Unknown(t&&t.message,t)),d+=1,t instanceof u.Unknown||t instanceof u.UnparsableJSON||d>=p.hosts[e.hostType].length&&(h||!m)?(t.debugData=v,p._promise.reject(t)):t instanceof u.RequestTimeout?b():y()}function y(){return a("retrying request"),p.hostIndex[e.hostType]=(p.hostIndex[e.hostType]+1)%p.hosts[e.hostType].length,t(n,c)}function b(){return a("retrying request with higher timeout"),p.hostIndex[e.hostType]=(p.hostIndex[e.hostType]+1)%p.hosts[e.hostType].length,c.timeout=p.requestTimeout*(d+1),t(n,c)}var _,w=new Date;if(p._useCache&&(_=e.url),p._useCache&&r&&(_+="_body_"+c.body),p._useCache&&l&&void 0!==l[_])return a("serving response from cache"),p._promise.resolve(JSON.parse(l[_]));if(d>=p.hosts[e.hostType].length)return!m||h?(a("could not get any response"),p._promise.reject(new u.AlgoliaSearchError("Cannot connect to the AlgoliaSearch API. Send an email to [email protected] to report and resolve the issue. Application id was: "+p.applicationID,{debugData:v}))):(a("switching to fallback"),d=0,c.method=e.fallback.method,c.url=e.fallback.url,c.jsonBody=e.fallback.body,c.jsonBody&&(c.body=o(c.jsonBody)),i=p._computeRequestHeaders(),c.timeout=p.requestTimeout*(d+1),p.hostIndex[e.hostType]=0,h=!0,t(p._request.fallback,c));var x=p.hosts[e.hostType][p.hostIndex[e.hostType]],R=x+c.url,j={body:c.body,jsonBody:c.jsonBody,method:c.method,headers:i,timeout:c.timeout,debug:a};return a("method: %s, url: %s, headers: %j, timeout: %d",j.method,R,j.headers,j.timeout),n===p._request.fallback&&a("using fallback"),n.call(p,R,j).then(f,g)}var r,i,a=n(17)("algoliasearch:"+e.url),l=e.cache,p=this,d=0,h=!1,m=p._useFallback&&p._request.fallback&&e.fallback;this.apiKey.length>f&&void 0!==e.body&&void 0!==e.body.params?(e.body.apiKey=this.apiKey,i=this._computeRequestHeaders(!1)):i=this._computeRequestHeaders(),void 0!==e.body&&(r=o(e.body)),a("request start");var v=[],g=t(p._request,{url:e.url,method:e.method,body:r,jsonBody:e.body,timeout:p.requestTimeout*(d+1)});return e.callback?void g.then(function(t){c(function(){e.callback(null,t)},p._setTimeout||setTimeout)},function(t){c(function(){e.callback(t)},p._setTimeout||setTimeout)}):g},r.prototype._getSearchParams=function(e,t){if(void 0===e||null===e)return t;for(var n in e)null!==n&&void 0!==e[n]&&e.hasOwnProperty(n)&&(t+=""===t?"":"&",t+=n+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(e[n])?o(e[n]):e[n]));return t},r.prototype._computeRequestHeaders=function(e){var t=n(10),r={"x-algolia-agent":this._ua,"x-algolia-application-id":this.applicationID};return e!==!1&&(r["x-algolia-api-key"]=this.apiKey),this.userToken&&(r["x-algolia-usertoken"]=this.userToken),this.securityTags&&(r["x-algolia-tagfilters"]=this.securityTags),this.extraHeaders&&t(this.extraHeaders,function(e){r[e.name]=e.value}),r},r.prototype.search=function(e,t,r){var i=n(15),o=n(16),a="Usage: client.search(arrayOfQueries[, callback])";if(!i(e))throw new Error(a);"function"==typeof t?(r=t,t={}):void 0===t&&(t={});var s=this,u={requests:o(e,function(e){var t="";return void 0!==e.query&&(t+="query="+encodeURIComponent(e.query)),{indexName:e.indexName,params:s._getSearchParams(e.params,t)}})},c=o(u.requests,function(e,t){return t+"="+encodeURIComponent("/1/indexes/"+encodeURIComponent(e.indexName)+"?"+e.params)}).join("&"),l="/1/indexes/*/queries";return void 0!==t.strategy&&(l+="?strategy="+t.strategy),this._jsonRequest({cache:this.cache,method:"POST",url:l,body:u,hostType:"read",fallback:{method:"GET",url:"/1/indexes/*",body:{params:c}},callback:r})},r.prototype.setSecurityTags=function(e){if("[object Array]"===Object.prototype.toString.call(e)){for(var t=[],n=0;n<e.length;++n)if("[object Array]"===Object.prototype.toString.call(e[n])){for(var r=[],i=0;i<e[n].length;++i)r.push(e[n][i]);t.push("("+r.join(",")+")")}else t.push(e[n]);e=t.join(",")}this.securityTags=e},r.prototype.setUserToken=function(e){this.userToken=e},r.prototype.clearCache=function(){this.cache={}},r.prototype.setRequestTimeout=function(e){e&&(this.requestTimeout=parseInt(e,10))}},function(e,t,n){"use strict";function r(e,t){var r=n(10),i=this;"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):i.stack=(new Error).stack||"Cannot get a stacktrace, browser is too old",this.name="AlgoliaSearchError",this.message=e||"Unknown error",t&&r(t,function(e,t){i[t]=e})}function i(e,t){function n(){var n=Array.prototype.slice.call(arguments,0);"string"!=typeof n[0]&&n.unshift(t),r.apply(this,n),this.name="AlgoliaSearch"+e+"Error"}return o(n,r),n}var o=n(9);o(r,Error),e.exports={AlgoliaSearchError:r,UnparsableJSON:i("UnparsableJSON","Could not parse the incoming response as JSON, see err.more for details"),RequestTimeout:i("RequestTimeout","Request timedout before getting a response"),Network:i("Network","Network issue, see err.more for details"),JSONPScriptFail:i("JSONPScriptFail","<script> was loaded but did not call our provided callback"),JSONPScriptError:i("JSONPScriptError","<script> unable to load due to an `error` event on it"),Unknown:i("Unknown","Unknown error occured")}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,t,i){if("[object Function]"!==r.call(t))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var a=0;a<o;a++)t.call(i,e[a],a,e);else for(var s in e)n.call(e,s)&&t.call(i,e[s],s,e)}},function(e,t){e.exports=function(e,t){t(e,0)}},function(e,t,n){function r(e,t){this.indexName=t,this.as=e,this.typeAheadArgs=null,this.typeAheadValueOption=null,this.cache={}}var i=n(13);e.exports=r,r.prototype.clearCache=function(){this.cache={}},r.prototype.search=i("query"),r.prototype.similarSearch=i("similarQuery"),r.prototype.browse=function(e,t,r){var i,o,a=n(14),s=this;0===arguments.length||1===arguments.length&&"function"==typeof arguments[0]?(i=0,r=arguments[0],e=void 0):"number"==typeof arguments[0]?(i=arguments[0],"number"==typeof arguments[1]?o=arguments[1]:"function"==typeof arguments[1]&&(r=arguments[1],o=void 0),e=void 0,t=void 0):"object"==typeof arguments[0]?("function"==typeof arguments[1]&&(r=arguments[1]),t=arguments[0],e=void 0):"string"==typeof arguments[0]&&"function"==typeof arguments[1]&&(r=arguments[1],t=void 0),t=a({},t||{},{page:i,hitsPerPage:o,query:e});var u=this.as._getSearchParams(t,"");return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(s.indexName)+"/browse?"+u,hostType:"read",callback:r})},r.prototype.browseFrom=function(e,t){return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/browse?cursor="+encodeURIComponent(e),hostType:"read",callback:t})},r.prototype._search=function(e,t,n){return this.as._jsonRequest({cache:this.cache,method:"POST",url:t||"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:e},hostType:"read",fallback:{method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:{params:e}},callback:n})},r.prototype.getObject=function(e,t,n){var r=this;1!==arguments.length&&"function"!=typeof t||(n=t,t=void 0);var i="";if(void 0!==t){i="?attributes=";for(var o=0;o<t.length;++o)0!==o&&(i+=","),i+=t[o]}return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(r.indexName)+"/"+encodeURIComponent(e)+i,hostType:"read",callback:n})},r.prototype.getObjects=function(e,t,r){var i=n(15),o=n(16),a="Usage: index.getObjects(arrayOfObjectIDs[, callback])";if(!i(e))throw new Error(a);var s=this;1!==arguments.length&&"function"!=typeof t||(r=t,t=void 0);var u={requests:o(e,function(e){var n={indexName:s.indexName,objectID:e};return t&&(n.attributesToRetrieve=t.join(",")),n})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/*/objects",hostType:"read",body:u,callback:r})},r.prototype.as=null,r.prototype.indexName=null,r.prototype.typeAheadArgs=null,r.prototype.typeAheadValueOption=null},function(e,t,n){function r(e,t){return function(n,r,o){if("function"==typeof n&&"object"==typeof r||"object"==typeof o)throw new i.AlgoliaSearchError("index.search usage is index.search(query, params, cb)");0===arguments.length||"function"==typeof n?(o=n,n=""):1!==arguments.length&&"function"!=typeof r||(o=r,r=void 0),"object"==typeof n&&null!==n?(r=n,n=void 0):void 0!==n&&null!==n||(n="");var a="";return void 0!==n&&(a+=e+"="+encodeURIComponent(n)),void 0!==r&&(a=this.as._getSearchParams(r,a)),this._search(a,t,o)}}e.exports=r;var i=n(8)},function(e,t,n){var r=n(10);e.exports=function e(t){var n=Array.prototype.slice.call(arguments);return r(n,function(n){for(var r in n)n.hasOwnProperty(r)&&("object"==typeof t[r]&&"object"==typeof n[r]?t[r]=e({},t[r],n[r]):void 0!==n[r]&&(t[r]=n[r]))}),t}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var r=n(10);e.exports=function(e,t){var n=[];return r(e,function(r,i){n.push(t(r,i,e))}),n}},function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function s(){var e;try{e=t.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(18),t.log=o,t.formatArgs=i,t.save=a,t.load=s,t.useColors=r,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(s())},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function i(e){function n(){}function i(){var e=i,n=+new Date,o=n-(c||n);e.diff=o,e.prev=c,e.curr=n,c=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;s++;var i=t.formatters[r];if("function"==typeof i){var o=a[s];n=i.call(e,o),a.splice(s,1),s--}return n}),"function"==typeof t.formatArgs&&(a=t.formatArgs.apply(e,a));var u=i.log||t.log||console.log.bind(console);u.apply(e,a)}n.enabled=!1,i.enabled=!0;var o=t.enabled(e)?i:n;return o.namespace=e,o}function o(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,i=0;i<r;i++)n[i]&&(e=n[i].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function s(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=i,t.coerce=u,t.disable=a,t.enable=o,t.enabled=s,t.humanize=n(19),t.names=[],t.skips=[],t.formatters={};var c,l=0},function(e,t){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function r(e){return e>=c?Math.round(e/c)+"d":e>=u?Math.round(e/u)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return o(e,c,"day")||o(e,u,"hour")||o(e,s,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,s=60*a,u=60*s,c=24*u,l=365.25*c;e.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?i(e):r(e)}},function(e,t){e.exports=function(e){return JSON.parse(JSON.stringify(e))}},function(e,t,n){"use strict";var r=n(22),i=r.Promise||n(23).Promise;e.exports=function(e,t){function o(e,t,r){var i=n(20),s=n(32);return r=i(r||{}),void 0===r.protocol&&(r.protocol=s()),r._ua=r._ua||o.ua,new a(e,t,r)}function a(){e.apply(this,arguments)}var s=n(9),u=n(8),c=n(28),l=n(30),f=n(31);t=t||"",o.version=n(33),o.ua="Algolia for vanilla JavaScript "+t+o.version,o.initPlaces=f(o),r.__algolia={debug:n(17),algoliasearch:o};var p={hasXMLHttpRequest:"XMLHttpRequest"in r,hasXDomainRequest:"XDomainRequest"in r};return p.hasXMLHttpRequest&&(p.cors="withCredentials"in new XMLHttpRequest,p.timeout="timeout"in new XMLHttpRequest),s(a,e),a.prototype._request=function(e,t){return new i(function(n,r){function i(){if(!l){p.timeout||clearTimeout(s);var e;try{e={body:JSON.parse(d.responseText),responseText:d.responseText,statusCode:d.status,headers:d.getAllResponseHeaders&&d.getAllResponseHeaders()||{}}}catch(t){e=new u.UnparsableJSON({more:d.responseText})}e instanceof u.UnparsableJSON?r(e):n(e)}}function o(e){l||(p.timeout||clearTimeout(s),r(new u.Network({more:e})))}function a(){p.timeout||(l=!0,d.abort()),r(new u.RequestTimeout)}if(!p.cors&&!p.hasXDomainRequest)return void r(new u.Network("CORS not supported"));e=c(e,t.headers);var s,l,f=t.body,d=p.cors?new XMLHttpRequest:new XDomainRequest;d instanceof XMLHttpRequest?d.open(t.method,e,!0):d.open(t.method,e),p.cors&&(f&&("POST"===t.method?d.setRequestHeader("content-type","application/x-www-form-urlencoded"):d.setRequestHeader("content-type","application/json")),d.setRequestHeader("accept","application/json")),d.onprogress=function(){},d.onload=i,d.onerror=o,p.timeout?(d.timeout=t.timeout,d.ontimeout=a):s=setTimeout(a,t.timeout),d.send(f)})},a.prototype._request.fallback=function(e,t){return e=c(e,t.headers),new i(function(n,r){l(e,t,function(e,t){return e?void r(e):void n(t)})})},a.prototype._promise={reject:function(e){return i.reject(e)},resolve:function(e){return i.resolve(e)},delay:function(e){return new i(function(t){setTimeout(t,e)})}},o}},function(e,t){(function(t){"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(t,function(){return this}())},function(e,t,n){var r;(function(e,i,o){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function s(e){return"function"==typeof e}function u(e){G=e}function c(e){ee=e}function l(){return function(){e.nextTick(m)}}function f(){return function(){J(m)}}function p(){var e=0,t=new re(m),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=m,function(){e.port2.postMessage(0)}}function h(){return function(){setTimeout(m,1)}}function m(){for(var e=0;e<Z;e+=2){var t=ae[e],n=ae[e+1];t(n),ae[e]=void 0,ae[e+1]=void 0}Z=0}function v(){try{var e=n(26);return J=e.runOnLoop||e.runOnContext,f()}catch(e){return h()}}function g(e,t){var n=this,r=new this.constructor(b);void 0===r[ce]&&U(r);var i=n._state;if(i){var o=arguments[i-1];ee(function(){M(i,r,o,n._result)})}else k(n,r,e,t);return r}function y(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return O(n,e),n}function b(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function w(){return new TypeError("A promises callback cannot return that same promise.")}function x(e){try{return e.then}catch(e){return de.error=e,de}}function R(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}function j(e,t,n){ee(function(e){var r=!1,i=R(n,t,function(n){r||(r=!0,t!==n?O(e,n):E(e,n))},function(t){r||(r=!0,F(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,F(e,i))},e)}function P(e,t){t._state===fe?E(e,t._result):t._state===pe?F(e,t._result):k(t,void 0,function(t){O(e,t)},function(t){F(e,t)})}function C(e,t,n){t.constructor===e.constructor&&n===se&&constructor.resolve===ue?P(e,t):n===de?F(e,de.error):void 0===n?E(e,t):s(n)?j(e,t,n):E(e,t)}function O(e,t){e===t?F(e,_()):a(t)?C(e,t,x(t)):E(e,t)}function S(e){e._onerror&&e._onerror(e._result),N(e)}function E(e,t){e._state===le&&(e._result=t,e._state=fe,0!==e._subscribers.length&&ee(N,e))}function F(e,t){e._state===le&&(e._state=pe,e._result=t,ee(S,e))}function k(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+fe]=n,i[o+pe]=r,0===o&&e._state&&ee(N,e)}function N(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?M(n,r,i,o):i(o);e._subscribers.length=0}}function T(){this.error=null}function A(e,t){try{return e(t)}catch(e){return he.error=e,he}}function M(e,t,n,r){var i,o,a,u,c=s(n);if(c){if(i=A(n,r),i===he?(u=!0,o=i.error,i=null):a=!0,t===i)return void F(t,w())}else i=r,a=!0;t._state!==le||(c&&a?O(t,i):u?F(t,o):e===fe?E(t,i):e===pe&&F(t,i))}function H(e,t){try{t(function(t){O(e,t)},function(t){F(e,t)})}catch(t){F(e,t)}}function L(){return me++}function U(e){e[ce]=me++,e._state=void 0,e._result=void 0,e._subscribers=[]}function D(e){return new _e(this,e).promise}function I(e){var t=this;return new t(Y(e)?function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function V(e){var t=this,n=new t(b);return F(n,e),n}function q(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function Q(e){this[ce]=L(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&q(),this instanceof Q?H(this,e):B())}function z(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[ce]||U(this.promise),Y(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):F(this.promise,W())}function W(){return new Error("Array Methods must be provided an Array")}function K(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;t&&"[object Promise]"===Object.prototype.toString.call(t.resolve())&&!t.cast||(e.Promise=be)}var $;$=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,G,X,Y=$,Z=0,ee=function(e,t){ae[Z]=e,ae[Z+1]=t,Z+=2,2===Z&&(G?G(m):X())},te="undefined"!=typeof window?window:void 0,ne=te||{},re=ne.MutationObserver||ne.WebKitMutationObserver,ie="undefined"==typeof self&&"undefined"!=typeof e&&"[object process]"==={}.toString.call(e),oe="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ae=new Array(1e3);X=ie?l():re?p():oe?d():void 0===te?v():h();var se=g,ue=y,ce=Math.random().toString(36).substring(16),le=void 0,fe=1,pe=2,de=new T,he=new T,me=0,ve=D,ge=I,ye=V,be=Q;Q.all=ve,Q.race=ge,Q.resolve=ue,Q.reject=ye,Q._setScheduler=u,Q._setAsap=c,Q._asap=ee,Q.prototype={constructor:Q,then:se,catch:function(e){return this.then(null,e)}};var _e=z;z.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===le&&n<e;n++)this._eachEntry(t[n],n)},z.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===ue){var i=x(e);if(i===se&&e._state!==le)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===be){var o=new n(b);C(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},z.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===le&&(this._remaining--,e===pe?F(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},z.prototype._willSettleAt=function(e,t){var n=this;k(e,void 0,function(e){n._settledAt(fe,t,e)},function(e){n._settledAt(pe,t,e)})};var we=K,xe={Promise:be,polyfill:we};n(27).amd?(r=function(){return xe}.call(t,n,t,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=xe:"undefined"!=typeof this&&(this.ES6Promise=xe),we()}).call(this)}).call(t,n(24),function(){return this}(),n(25)(e))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?h=d.concat(h):v=-1,h.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=h.length;t;){for(d=h,h=[];++v<t;)d&&d[v].run();v=-1,t=h.length}d=null,m=!1,o(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,f,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}(); var d,h=[],m=!1,v=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||m||i(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";function r(e,t){return e+=/\?/.test(e)?"&":"?",e+i(t)}e.exports=r;var i=n(29)},function(e,t){"use strict";function n(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,a,s){return t=t||"&",a=a||"=",null===e&&(e=void 0),"object"==typeof e?n(o(e),function(o){var s=encodeURIComponent(r(o))+a;return i(e[o])?n(e[o],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[o]))}).join(t):s?encodeURIComponent(r(s))+a+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){"use strict";function r(e,t,n){function r(){t.debug("JSONP: success"),v||p||(v=!0,f||(t.debug("JSONP: Fail. Script loaded but did not call the callback"),s(),n(new i.JSONPScriptFail)))}function a(){"loaded"!==this.readyState&&"complete"!==this.readyState||r()}function s(){clearTimeout(g),h.onload=null,h.onreadystatechange=null,h.onerror=null,d.removeChild(h)}function u(){try{delete window[m],delete window[m+"_loaded"]}catch(e){window[m]=window[m+"_loaded"]=void 0}}function c(){t.debug("JSONP: Script timeout"),p=!0,s(),n(new i.RequestTimeout)}function l(){t.debug("JSONP: Script error"),v||p||(s(),n(new i.JSONPScriptError))}if("GET"!==t.method)return void n(new Error("Method "+t.method+" "+e+" is not supported by JSONP."));t.debug("JSONP: start");var f=!1,p=!1;o+=1;var d=document.getElementsByTagName("head")[0],h=document.createElement("script"),m="algoliaJSONP_"+o,v=!1;window[m]=function(e){return u(),p?void t.debug("JSONP: Late answer, ignoring"):(f=!0,s(),void n(null,{body:e}))},e+="&callback="+m,t.jsonBody&&t.jsonBody.params&&(e+="&"+t.jsonBody.params);var g=setTimeout(c,t.timeout);h.onreadystatechange=a,h.onload=r,h.onerror=l,h.async=!0,h.defer=!0,h.src=e,d.appendChild(h)}e.exports=r;var i=n(8),o=0},function(e,t,n){function r(e){return function(t,r,o){var a=n(20);o=o&&a(o)||{},o.hosts=o.hosts||["places-dsn.algolia.net","places-1.algolianet.com","places-2.algolianet.com","places-3.algolianet.com"],0!==arguments.length&&"object"!=typeof t&&void 0!==t||(t="",r="",o._allowEmptyCredentials=!0);var s=e(t,r,o),u=s.initIndex("places");return u.search=i("query","/1/places/query"),u}}e.exports=r;var i=n(13)},function(e,t){"use strict";function n(){var e=window.document.location.protocol;return"http:"!==e&&"https:"!==e&&(e="http:"),e}e.exports=n},function(e,t){"use strict";e.exports="3.18.0"},function(e,t,n){"use strict";function r(e,t,n){return new i(e,t,n)}var i=n(35),o=n(36),a=n(242);r.version=n(314),r.AlgoliaSearchHelper=i,r.SearchParameters=o,r.SearchResults=a,r.url=n(302),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){this.client=e;var r=n||{};r.index=t,this.state=a.make(r),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}function i(e){if(e<0)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this}function o(){return this.state.page}var a=n(36),s=n(242),u=n(296),c=n(297),l=n(300),f=n(155),p=n(301),d=n(189),h=n(302);c.inherits(r,l.EventEmitter),r.prototype.search=function(){return this._search(),this},r.prototype.searchOnce=function(e,t){var n=e?this.state.setQueryParameters(e):this.state,r=u._getQueries(n.index,n);return t?this.client.search(r,function(e,r){t(e,new s(n,r),n)}):this.client.search(r).then(function(e){return{content:new s(n,e),state:n,_originalResponse:e}})},r.prototype.setQuery=function(e){return this.state=this.state.setPage(0).setQuery(e),this._change(),this},r.prototype.clearRefinements=function(e){return this.state=this.state.setPage(0).clearRefinements(e),this._change(),this},r.prototype.clearTags=function(){return this.state=this.state.setPage(0).clearTags(),this._change(),this},r.prototype.addDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.addHierarchicalFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addHierarchicalFacetRefinement(e,t),this._change(),this},r.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.setPage(0).addNumericRefinement(e,t,n),this._change(),this},r.prototype.addFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addFacetRefinement(e,t),this._change(),this},r.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},r.prototype.addFacetExclusion=function(e,t){return this.state=this.state.setPage(0).addExcludeRefinement(e,t),this._change(),this},r.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},r.prototype.addTag=function(e){return this.state=this.state.setPage(0).addTagRefinement(e),this._change(),this},r.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.setPage(0).removeNumericRefinement(e,t,n),this._change(),this},r.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.setPage(0).removeDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.removeHierarchicalFacetRefinement=function(e){return this.state=this.state.setPage(0).removeHierarchicalFacetRefinement(e),this._change(),this},r.prototype.removeFacetRefinement=function(e,t){return this.state=this.state.setPage(0).removeFacetRefinement(e,t),this._change(),this},r.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},r.prototype.removeFacetExclusion=function(e,t){return this.state=this.state.setPage(0).removeExcludeRefinement(e,t),this._change(),this},r.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},r.prototype.removeTag=function(e){return this.state=this.state.setPage(0).removeTagRefinement(e),this._change(),this},r.prototype.toggleFacetExclusion=function(e,t){return this.state=this.state.setPage(0).toggleExcludeFacetRefinement(e,t),this._change(),this},r.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},r.prototype.toggleRefinement=function(e,t){return this.state=this.state.setPage(0).toggleRefinement(e,t),this._change(),this},r.prototype.toggleRefine=function(){return this.toggleRefinement.apply(this,arguments)},r.prototype.toggleTag=function(e){return this.state=this.state.setPage(0).toggleTagRefinement(e),this._change(),this},r.prototype.nextPage=function(){return this.setPage(this.state.page+1)},r.prototype.previousPage=function(){return this.setPage(this.state.page-1)},r.prototype.setCurrentPage=i,r.prototype.setPage=i,r.prototype.setIndex=function(e){return this.state=this.state.setPage(0).setIndex(e),this._change(),this},r.prototype.setQueryParameter=function(e,t){var n=this.state.setPage(0).setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},r.prototype.setState=function(e){return this.state=new a(e),this._change(),this},r.prototype.getState=function(e){return void 0===e?this.state:this.state.filter(e)},r.prototype.getStateAsQueryString=function(e){var t=e&&e.filters||["query","attribute:*"],n=this.getState(t);return h.getQueryStringFromState(n,e)},r.getConfigurationFromQueryString=h.getStateFromQueryString,r.getForeignConfigurationInQueryString=h.getUnrecognizedParametersInQueryString,r.prototype.setStateFromQueryString=function(e,t){var n=t&&t.triggerChange||!1,r=h.getStateFromQueryString(e,t),i=this.state.setQueryParameters(r);n?this.setState(i):this.overrideStateWithoutTriggeringChangeEvent(i)},r.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new a(e),this},r.prototype.isRefined=function(e,t){if(this.state.isConjunctiveFacet(e))return this.state.isFacetRefined(e,t);if(this.state.isDisjunctiveFacet(e))return this.state.isDisjunctiveFacetRefined(e,t);throw new Error(e+" is not properly defined in this helper configuration(use the facets or disjunctiveFacets keys to configure it)")},r.prototype.hasRefinements=function(e){return!d(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},r.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},r.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},r.prototype.hasTag=function(e){return this.state.isTagRefined(e)},r.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},r.prototype.getIndex=function(){return this.state.index},r.prototype.getCurrentPage=o,r.prototype.getPage=o,r.prototype.getTags=function(){return this.state.tagRefinements},r.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},r.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);f(n,function(e){t.push({value:e,type:"conjunctive"})});var r=this.state.getExcludeRefinements(e);f(r,function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);f(i,function(e){t.push({value:e,type:"disjunctive"})})}var o=this.state.getNumericRefinements(e);return f(o,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},r.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},r.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},r.prototype._search=function(){var e=this.state,t=u._getQueries(e.index,e);this.emit("search",e,this.lastResults),this.client.search(t,p(this._handleResponse,this,e,this._queryId++))},r.prototype._handleResponse=function(e,t,n,r){if(!(t<this._lastQueryIdReceived)){if(this._lastQueryIdReceived=t,n)return void this.emit("error",n);var i=this.lastResults=new s(e,r);this.emit("result",i,e)}},r.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},r.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},r.prototype._change=function(){this.emit("change",this.state,this.lastResults)},r.prototype.clearCache=function(){this.client.clearCache()},e.exports=r},function(e,t,n){"use strict";function r(e,t){return w(e,function(e){return g(e,t)})}function i(e){var t=e?i._parseNumbers(e):{};this.index=t.index||"",this.query=t.query||"",this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{},this.numericFilters=t.numericFilters,this.tagFilters=t.tagFilters,this.optionalTagFilters=t.optionalTagFilters,this.optionalFacetFilters=t.optionalFacetFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.minProximity=t.minProximity,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.highlightPreTag=t.highlightPreTag,this.highlightPostTag=t.highlightPostTag,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.minimumAroundRadius=t.minimumAroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox,this.insidePolygon=t.insidePolygon,this.snippetEllipsisText=t.snippetEllipsisText,this.disableExactOnAttributes=t.disableExactOnAttributes,this.enableExactOnSingleWordQuery=t.enableExactOnSingleWordQuery,this.offset=t.offset,this.length=t.length;var n=this;s(t,function(e,t){i.PARAMETERS.indexOf(t)===-1&&(n[t]=e)})}var o=n(37),a=n(53),s=n(102),u=n(155),c=n(159),l=n(162),f=n(164),p=n(167),d=n(183),h=n(187),m=n(47),v=n(189),g=n(192),y=n(193),b=n(194),_=n(43),w=n(195),x=n(198),R=n(207),j=n(214),P=n(239),C=n(240),O=n(241);i.PARAMETERS=o(new i),i._parseNumbers=function(e){if(e instanceof i)return e;var t={},n=["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"];if(u(n,function(n){var r=e[n];if(b(r)){var i=parseFloat(r);t[n]=h(i)?r:i}}),e.numericRefinements){var r={};u(e.numericRefinements,function(e,t){r[t]={},u(e,function(e,n){var i=l(e,function(e){return m(e)?l(e,function(e){return b(e)?parseFloat(e):e}):b(e)?parseFloat(e):e});r[t][n]=i})}),t.numericRefinements=r}return j({},e,t)},i.make=function(e){var t=new i(e);return u(e.hierarchicalFacets,function(e){if(e.rootPath){var n=t.getHierarchicalRefinement(e.name);n.length>0&&0!==n[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),n=t.getHierarchicalRefinement(e.name),0===n.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},i.validate=function(e,t){var n=t||{};return e.tagFilters&&n.tagRefinements&&n.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&n.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&n.numericRefinements&&!v(n.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):!v(e.numericRefinements)&&n.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},i.prototype={constructor:i,clearRefinements:function(e){var t=O.clearRefinement;return this.setQueryParameters({numericRefinements:this._clearNumericRefinements(e),facetsRefinements:t(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:t(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:t(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:t(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,n){var r=P(n);if(this.isNumericRefined(e,t,r))return this;var i=j({},this.numericRefinements);return i[e]=j({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(r)):i[e][t]=[r],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,n){if(void 0!==n){var r=P(n);return this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,i){return i===e&&n.op===t&&g(n.val,r)})}):this}return void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,n){return n===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return y(e)?{}:b(e)?p(this.numericRefinements,e):_(e)?f(this.numericRefinements,function(t,n,r){var i={};return u(n,function(t,n){var o=[];u(t,function(t){var i=e({val:t,op:n},r,"numeric");i||o.push(t)}),v(o)||(i[n]=o)}),v(i)||(t[r]=i),t},{}):void 0},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:O.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:O.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:O.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:c(this.facets,function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:c(this.disjunctiveFacets,function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:c(this.hierarchicalFacets,function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:O.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:O.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:O.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:c(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:O.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:O.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:O.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r={},i=void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+n));return i?t.indexOf(n)===-1?r[e]=[]:r[e]=[t.slice(0,t.lastIndexOf(n))]:r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:R({},r,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");var n={};return n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:R({},n,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))throw new Error(e+" is not refined.");var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:R({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return d(this.disjunctiveFacets,e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return d(this.facets,e)>-1},isFacetRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this.getHierarchicalRefinement(e);return t?d(n,t)!==-1:n.length>0},isNumericRefined:function(e,t,n){if(y(n)&&y(t))return!!this.numericRefinements[e];var i=this.numericRefinements[e]&&!y(this.numericRefinements[e][t]);if(y(n)||!i)return i;var o=P(n),a=!y(r(this.numericRefinements[e][t],o));return i&&a},isTagRefined:function(e){return d(this.tagRefinements,e)!==-1},getRefinedDisjunctiveFacets:function(){var e=a(o(this.numericRefinements),this.disjunctiveFacets);return o(this.disjunctiveFacetsRefinements).concat(e).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){return a(l(this.hierarchicalFacets,"name"),o(this.hierarchicalFacetsRefinements))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return c(this.disjunctiveFacets,function(t){return d(e,t)===-1})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={};return s(this,function(n,r){d(e,r)===-1&&void 0!==n&&(t[r]=n)}),t},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){if(!e)return this;var t=i.validate(this,e);if(t)throw t;var n=i._parseNumbers(e);return this.mutateMe(function(t){var r=o(e);return u(r,function(e){t[e]=n[e]}),t})},filter:function(e){return C(this,e)},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),t},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return w(this.hierarchicalFacets,{name:e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))throw new Error("Cannot get the breadcrumb of an unknown hierarchical facet: `"+e+"`");var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r=t.split(n);return l(r,x)}},e.exports=i},function(e,t,n){function r(e){return a(e)?i(e):o(e)}var i=n(38),o=n(49),a=n(42);e.exports=r},function(e,t,n){function r(e,t){var n=a(e)||o(e)?i(e.length,String):[],r=n.length,u=!!r;for(var l in e)!t&&!c.call(e,l)||u&&("length"==l||s(l,r))||n.push(l);return n}var i=n(39),o=n(40),a=n(47),s=n(48),u=Object.prototype,c=u.hasOwnProperty;e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}e.exports=n},function(e,t,n){function r(e){return i(e)&&s.call(e,"callee")&&(!c.call(e,"callee")||u.call(e)==o)}var i=n(41),o="[object Arguments]",a=Object.prototype,s=a.hasOwnProperty,u=a.toString,c=a.propertyIsEnumerable;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e)}var i=n(42),o=n(46);e.exports=r},function(e,t,n){function r(e){return null!=e&&o(e.length)&&!i(e)}var i=n(43),o=n(45);e.exports=r},function(e,t,n){function r(e){var t=i(e)?u.call(e):"";return t==o||t==a}var i=n(44),o="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,u=s.toString;e.exports=r},function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}e.exports=n},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(e,t){return t=null==t?r:t,!!t&&("number"==typeof e||i.test(e))&&e>-1&&e%1==0&&e<t}var r=9007199254740991,i=/^(?:0|[1-9]\d*)$/;e.exports=n},function(e,t,n){function r(e){if(!i(e))return o(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}var i=n(50),o=n(51),a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t){function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}var r=Object.prototype;e.exports=n},function(e,t,n){var r=n(52),i=r(Object.keys,Object);e.exports=i},function(e,t){function n(e,t){return function(n){return e(t(n))}}e.exports=n},function(e,t,n){var r=n(54),i=n(55),o=n(99),a=n(101),s=o(function(e){var t=r(e,a);return t.length&&t[0]===e[0]?i(t):[]});e.exports=s},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=n},function(e,t,n){function r(e,t,n){for(var r=n?a:o,f=e[0].length,p=e.length,d=p,h=Array(p),m=1/0,v=[];d--;){var g=e[d];d&&t&&(g=s(g,u(t))),m=l(g.length,m),h[d]=!n&&(t||f>=120&&g.length>=120)?new i(d&&g):void 0}g=e[0];var y=-1,b=h[0];e:for(;++y<f&&v.length<m;){var _=g[y],w=t?t(_):_;if(_=n||0!==_?_:0,!(b?c(b,w):r(v,w,n))){for(d=p;--d;){var x=h[d];if(!(x?c(x,w):r(e[d],w,n)))continue e}b&&b.push(w),v.push(_)}}return v}var i=n(56),o=n(92),a=n(96),s=n(54),u=n(97),c=n(98),l=Math.min;e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.__data__=new i;++t<n;)this.add(e[t])}var i=n(57),o=n(90),a=n(91);r.prototype.add=r.prototype.push=o,r.prototype.has=a,e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(58),o=n(84),a=n(87),s=n(88),u=n(89);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){function r(){this.__data__={hash:new i,map:new(a||o),string:new i}}var i=n(59),o=n(75),a=n(83); e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(60),o=n(71),a=n(72),s=n(73),u=n(74);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){function r(){this.__data__=i?i(null):{}}var i=n(61);e.exports=r},function(e,t,n){var r=n(62),i=r(Object,"create");e.exports=i},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(63),o=n(70);e.exports=r},function(e,t,n){function r(e){if(!s(e)||a(e))return!1;var t=i(e)||o(e)?m:l;return t.test(u(e))}var i=n(43),o=n(64),a=n(65),s=n(44),u=n(69),c=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,f=Function.prototype,p=Object.prototype,d=f.toString,h=p.hasOwnProperty,m=RegExp("^"+d.call(h).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}e.exports=n},function(e,t,n){function r(e){return!!o&&o in e}var i=n(66),o=function(){var e=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=r},function(e,t,n){var r=n(67),i=r["__core-js_shared__"];e.exports=i},function(e,t,n){var r=n(68),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(t,function(){return this}())},function(e,t){function n(e){if(null!=e){try{return i.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var r=Function.prototype,i=r.toString;e.exports=n},function(e,t){function n(e,t){return null==e?void 0:e[t]}e.exports=n},function(e,t){function n(e){return this.has(e)&&delete this.__data__[e]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__;if(i){var n=t[e];return n===o?void 0:n}return s.call(t,e)?t[e]:void 0}var i=n(61),o="__lodash_hash_undefined__",a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){var t=this.__data__;return i?void 0!==t[e]:a.call(t,e)}var i=n(61),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__;return n[e]=i&&void 0===t?o:t,this}var i=n(61),o="__lodash_hash_undefined__";e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(76),o=n(77),a=n(80),s=n(81),u=n(82);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t){function n(){this.__data__=[]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=i(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():a.call(t,n,1),!0}var i=n(78),o=Array.prototype,a=o.splice;e.exports=r},function(e,t,n){function r(e,t){for(var n=e.length;n--;)if(i(e[n][0],t))return n;return-1}var i=n(79);e.exports=r},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=i(t,e);return n<0?void 0:t[n][1]}var i=n(78);e.exports=r},function(e,t,n){function r(e){return i(this.__data__,e)>-1}var i=n(78);e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__,r=i(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}var i=n(78);e.exports=r},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Map");e.exports=o},function(e,t,n){function r(e){return i(this,e).delete(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e,t){var n=e.__data__;return i(t)?n["string"==typeof t?"string":"hash"]:n.map}var i=n(86);e.exports=r},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){function r(e){return i(this,e).get(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e){return i(this,e).has(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e,t){return i(this,e).set(e,t),this}var i=n(85);e.exports=r},function(e,t){function n(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=e?e.length:0;return!!n&&i(e,t,0)>-1}var i=n(93);e.exports=r},function(e,t,n){function r(e,t,n){if(t!==t)return i(e,o,n);for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}var i=n(94),o=n(95);e.exports=r},function(e,t){function n(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}e.exports=n},function(e,t){function n(e){return e!==e}e.exports=n},function(e,t){function n(e,t,n){for(var r=-1,i=e?e.length:0;++r<i;)if(n(t,e[r]))return!0;return!1}e.exports=n},function(e,t){function n(e){return function(t){return e(t)}}e.exports=n},function(e,t){function n(e,t){return e.has(t)}e.exports=n},function(e,t,n){function r(e,t){return t=o(void 0===t?e.length-1:t,0),function(){for(var n=arguments,r=-1,a=o(n.length-t,0),s=Array(a);++r<a;)s[r]=n[t+r];r=-1;for(var u=Array(t+1);++r<t;)u[r]=n[r];return u[t]=s,i(e,this,u)}}var i=n(100),o=Math.max;e.exports=r},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}e.exports=n},function(e,t,n){function r(e){return i(e)?e:[]}var i=n(41);e.exports=r},function(e,t,n){function r(e,t){return e&&i(e,o(t,3))}var i=n(103),o=n(106);e.exports=r},function(e,t,n){function r(e,t){return e&&i(e,t,o)}var i=n(104),o=n(37);e.exports=r},function(e,t,n){var r=n(105),i=r();e.exports=i},function(e,t){function n(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var u=a[e?s:++i];if(n(o[u],u,o)===!1)break}return t}}e.exports=n},function(e,t,n){function r(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?s(e)?o(e[0],e[1]):i(e):u(e)}var i=n(107),o=n(137),a=n(151),s=n(47),u=n(152);e.exports=r},function(e,t,n){function r(e){var t=o(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||i(n,e,t)}}var i=n(108),o=n(134),a=n(136);e.exports=r},function(e,t,n){function r(e,t,n,r){var u=n.length,c=u,l=!r;if(null==e)return!c;for(e=Object(e);u--;){var f=n[u];if(l&&f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++u<c;){f=n[u];var p=f[0],d=e[p],h=f[1];if(l&&f[2]){if(void 0===d&&!(p in e))return!1}else{var m=new i;if(r)var v=r(d,h,p,e,t,m);if(!(void 0===v?o(h,d,r,a|s,m):v))return!1}}return!0}var i=n(109),o=n(115),a=1,s=2;e.exports=r},function(e,t,n){function r(e){this.__data__=new i(e)}var i=n(75),o=n(110),a=n(111),s=n(112),u=n(113),c=n(114);r.prototype.clear=o,r.prototype.delete=a,r.prototype.get=s,r.prototype.has=u,r.prototype.set=c,e.exports=r},function(e,t,n){function r(){this.__data__=new i}var i=n(75);e.exports=r},function(e,t){function n(e){return this.__data__.delete(e)}e.exports=n},function(e,t){function n(e){return this.__data__.get(e)}e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=this.__data__;if(n instanceof i){var r=n.__data__;if(!o||r.length<s-1)return r.push([e,t]),this;n=this.__data__=new a(r)}return n.set(e,t),this}var i=n(75),o=n(83),a=n(57),s=200;e.exports=r},function(e,t,n){function r(e,t,n,s,u){return e===t||(null==e||null==t||!o(e)&&!a(t)?e!==e&&t!==t:i(e,t,r,n,s,u))}var i=n(116),o=n(44),a=n(46);e.exports=r},function(e,t,n){function r(e,t,n,r,v,y){var b=c(e),_=c(t),w=h,x=h;b||(w=u(e),w=w==d?m:w),_||(x=u(t),x=x==d?m:x);var R=w==m&&!l(e),j=x==m&&!l(t),P=w==x;if(P&&!R)return y||(y=new i),b||f(e)?o(e,t,n,r,v,y):a(e,t,w,n,r,v,y);if(!(v&p)){var C=R&&g.call(e,"__wrapped__"),O=j&&g.call(t,"__wrapped__");if(C||O){var S=C?e.value():e,E=O?t.value():t;return y||(y=new i),n(S,E,r,v,y)}}return!!P&&(y||(y=new i),s(e,t,n,r,v,y))}var i=n(109),o=n(117),a=n(119),s=n(124),u=n(125),c=n(47),l=n(64),f=n(131),p=2,d="[object Arguments]",h="[object Array]",m="[object Object]",v=Object.prototype,g=v.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t,n,r,u,c){var l=u&s,f=e.length,p=t.length;if(f!=p&&!(l&&p>f))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var h=-1,m=!0,v=u&a?new i:void 0;for(c.set(e,t),c.set(t,e);++h<f;){var g=e[h],y=t[h];if(r)var b=l?r(y,g,h,t,e,c):r(g,y,h,e,t,c);if(void 0!==b){if(b)continue;m=!1;break}if(v){if(!o(t,function(e,t){if(!v.has(t)&&(g===e||n(g,e,r,u,c)))return v.add(t)})){m=!1;break}}else if(g!==y&&!n(g,y,r,u,c)){m=!1;break}}return c.delete(e),c.delete(t),m}var i=n(56),o=n(118),a=1,s=2;e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=n},function(e,t,n){function r(e,t,n,r,i,R,P){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case w:return!(e.byteLength!=t.byteLength||!r(new o(e),new o(t)));case p:case d:case v:return a(+e,+t);case h:return e.name==t.name&&e.message==t.message;case g:case b:return e==t+"";case m:var C=u;case y:var O=R&f;if(C||(C=c),e.size!=t.size&&!O)return!1;var S=P.get(e);if(S)return S==t;R|=l,P.set(e,t);var E=s(C(e),C(t),r,i,R,P);return P.delete(e),E;case _:if(j)return j.call(e)==j.call(t)}return!1}var i=n(120),o=n(121),a=n(79),s=n(117),u=n(122),c=n(123),l=1,f=2,p="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Map]",v="[object Number]",g="[object RegExp]",y="[object Set]",b="[object String]",_="[object Symbol]",w="[object ArrayBuffer]",x="[object DataView]",R=i?i.prototype:void 0,j=R?R.valueOf:void 0;e.exports=r},function(e,t,n){var r=n(67),i=r.Symbol;e.exports=i},function(e,t,n){var r=n(67),i=r.Uint8Array;e.exports=i},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}e.exports=n},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}e.exports=n},function(e,t,n){function r(e,t,n,r,a,u){var c=a&o,l=i(e),f=l.length,p=i(t),d=p.length;if(f!=d&&!c)return!1;for(var h=f;h--;){var m=l[h];if(!(c?m in t:s.call(t,m)))return!1}var v=u.get(e);if(v&&u.get(t))return v==t;var g=!0;u.set(e,t),u.set(t,e);for(var y=c;++h<f;){m=l[h];var b=e[m],_=t[m];if(r)var w=c?r(_,b,m,t,e,u):r(b,_,m,e,t,u);if(!(void 0===w?b===_||n(b,_,r,a,u):w)){g=!1;break}y||(y="constructor"==m)}if(g&&!y){var x=e.constructor,R=t.constructor;x!=R&&"constructor"in e&&"constructor"in t&&!("function"==typeof x&&x instanceof x&&"function"==typeof R&&R instanceof R)&&(g=!1)}return u.delete(e),u.delete(t),g}var i=n(37),o=2,a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(126),i=n(83),o=n(127),a=n(128),s=n(129),u=n(130),c=n(69),l="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",h="[object WeakMap]",m="[object DataView]",v=Object.prototype,g=v.toString,y=c(r),b=c(i),_=c(o),w=c(a),x=c(s),R=u;(r&&R(new r(new ArrayBuffer(1)))!=m||i&&R(new i)!=l||o&&R(o.resolve())!=p||a&&R(new a)!=d||s&&R(new s)!=h)&&(R=function(e){var t=g.call(e),n=t==f?e.constructor:void 0,r=n?c(n):void 0;if(r)switch(r){case y:return m;case b:return l;case _:return p;case w:return d;case x:return h}return t}),e.exports=R},function(e,t,n){var r=n(62),i=n(67),o=r(i,"DataView");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Promise");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Set");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"WeakMap");e.exports=o},function(e,t){function n(e){return i.call(e)}var r=Object.prototype,i=r.toString;e.exports=n},function(e,t,n){var r=n(132),i=n(97),o=n(133),a=o&&o.isTypedArray,s=a?i(a):r;e.exports=s},function(e,t,n){function r(e){return o(e)&&i(e.length)&&!!F[N.call(e)]}var i=n(45),o=n(46),a="[object Arguments]",s="[object Array]",u="[object Boolean]",c="[object Date]",l="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",R="[object Int8Array]",j="[object Int16Array]",P="[object Int32Array]",C="[object Uint8Array]",O="[object Uint8ClampedArray]",S="[object Uint16Array]",E="[object Uint32Array]",F={};F[w]=F[x]=F[R]=F[j]=F[P]=F[C]=F[O]=F[S]=F[E]=!0,F[a]=F[s]=F[b]=F[u]=F[_]=F[c]=F[l]=F[f]=F[p]=F[d]=F[h]=F[m]=F[v]=F[g]=F[y]=!1;var k=Object.prototype,N=k.toString;e.exports=r},function(e,t,n){(function(e){var r=n(68),i="object"==typeof t&&t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===i,s=a&&r.process,u=function(){try{return s&&s.binding("util")}catch(e){}}();e.exports=u}).call(t,n(25)(e))},function(e,t,n){function r(e){for(var t=o(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,i(a)]}return t}var i=n(135),o=n(37);e.exports=r},function(e,t,n){function r(e){return e===e&&!i(e)}var i=n(44);e.exports=r},function(e,t){function n(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}e.exports=n},function(e,t,n){function r(e,t){return s(e)&&u(t)?c(l(e),t):function(n){var r=o(n,e);return void 0===r&&r===t?a(n,e):i(t,r,void 0,f|p)}}var i=n(115),o=n(138),a=n(148),s=n(146),u=n(135),c=n(136),l=n(147),f=1,p=2;e.exports=r},function(e,t,n){function r(e,t,n){var r=null==e?void 0:i(e,t);return void 0===r?n:r}var i=n(139);e.exports=r},function(e,t,n){function r(e,t){t=o(t,e)?[t]:i(t);for(var n=0,r=t.length;null!=e&&n<r;)e=e[a(t[n++])];return n&&n==r?e:void 0}var i=n(140),o=n(146),a=n(147);e.exports=r},function(e,t,n){function r(e){return i(e)?e:o(e)}var i=n(47),o=n(141);e.exports=r},function(e,t,n){var r=n(142),i=n(143),o=/^\./,a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,u=r(function(e){e=i(e);var t=[];return o.test(e)&&t.push(""),e.replace(a,function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)}),t});e.exports=u},function(e,t,n){function r(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(r.Cache||i),n}var i=n(57),o="Expected a function";r.Cache=i,e.exports=r},function(e,t,n){function r(e){return null==e?"":i(e)}var i=n(144);e.exports=r},function(e,t,n){function r(e){if("string"==typeof e)return e;if(o(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}var i=n(120),o=n(145),a=1/0,s=i?i.prototype:void 0,u=s?s.toString:void 0;e.exports=r},function(e,t,n){function r(e){return"symbol"==typeof e||i(e)&&s.call(e)==o}var i=n(46),o="[object Symbol]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){function r(e,t){if(i(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(s.test(e)||!a.test(e)||null!=t&&e in Object(t))}var i=n(47),o=n(145),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},function(e,t,n){function r(e){if("string"==typeof e||i(e))return e;var t=e+"";return"0"==t&&1/e==-o?"-0":t}var i=n(145),o=1/0;e.exports=r},function(e,t,n){function r(e,t){return null!=e&&o(e,t,i)}var i=n(149),o=n(150);e.exports=r},function(e,t){function n(e,t){return null!=e&&t in Object(e)}e.exports=n},function(e,t,n){function r(e,t,n){t=u(t,e)?[t]:i(t);for(var r,f=-1,p=t.length;++f<p;){var d=l(t[f]);if(!(r=null!=e&&n(e,d)))break;e=e[d]}if(r)return r;var p=e?e.length:0;return!!p&&c(p)&&s(d,p)&&(a(e)||o(e))}var i=n(140),o=n(40),a=n(47),s=n(48),u=n(146),c=n(45),l=n(147);e.exports=r},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){function r(e){return a(e)?i(s(e)):o(e)}var i=n(153),o=n(154),a=n(146),s=n(147);e.exports=r},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){function r(e){return function(t){return i(t,e)}}var i=n(139);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:o;return n(e,a(t,3))}var i=n(156),o=n(157),a=n(106),s=n(47);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=n},function(e,t,n){var r=n(103),i=n(158),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return function(n,r){if(null==n)return n;if(!i(n))return e(n,r);for(var o=n.length,a=t?o:-1,s=Object(n);(t?a--:++a<o)&&r(s[a],a,s)!==!1;);return n}}var i=n(42);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:o;return n(e,a(t,3))}var i=n(160),o=n(161),a=n(106),s=n(47);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}e.exports=n},function(e,t,n){function r(e,t){var n=[];return i(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var i=n(157);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:a;return n(e,o(t,3))}var i=n(54),o=n(106),a=n(163),s=n(47);e.exports=r},function(e,t,n){function r(e,t){var n=-1,r=o(e)?Array(e.length):[];return i(e,function(e,i,o){r[++n]=t(e,i,o)}),r}var i=n(157),o=n(42);e.exports=r},function(e,t,n){function r(e,t,n){var r=u(e)?i:s,c=arguments.length<3;return r(e,a(t,4),n,c,o)}var i=n(165),o=n(157),a=n(106),s=n(166),u=n(47);e.exports=r},function(e,t){function n(e,t,n,r){var i=-1,o=e?e.length:0;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}e.exports=n},function(e,t){function n(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}e.exports=n},function(e,t,n){var r=n(54),i=n(168),o=n(169),a=n(172),s=n(99),u=n(174),c=n(147),l=s(function(e,t){return null==e?{}:(t=r(o(t,1),c),a(e,i(u(e),t)))});e.exports=l},function(e,t,n){function r(e,t,n,r){var f=-1,p=o,d=!0,h=e.length,m=[],v=t.length;if(!h)return m;n&&(t=s(t,u(n))),r?(p=a,d=!1):t.length>=l&&(p=c,d=!1,t=new i(t));e:for(;++f<h;){var g=e[f],y=n?n(g):g;if(g=r||0!==g?g:0,d&&y===y){for(var b=v;b--;)if(t[b]===y)continue e;m.push(g)}else p(t,y,r)||m.push(g)}return m}var i=n(56),o=n(92),a=n(96),s=n(54),u=n(97),c=n(98),l=200;e.exports=r},function(e,t,n){function r(e,t,n,a,s){var u=-1,c=e.length;for(n||(n=o),s||(s=[]);++u<c;){var l=e[u];t>0&&n(l)?t>1?r(l,t-1,n,a,s):i(s,l):a||(s[s.length]=l)}return s}var i=n(170),o=n(171);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}e.exports=n},function(e,t,n){function r(e){return a(e)||o(e)||!!(s&&e&&e[s])}var i=n(120),o=n(40),a=n(47),s=i?i.isConcatSpreadable:void 0;e.exports=r},function(e,t,n){function r(e,t){return e=Object(e),i(e,t,function(t,n){return n in e})}var i=n(173);e.exports=r},function(e,t){function n(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=e[a];n(s,a)&&(o[a]=s)}return o}e.exports=n},function(e,t,n){function r(e){return i(e,a,o)}var i=n(175),o=n(176),a=n(180);e.exports=r},function(e,t,n){function r(e,t,n){var r=t(e);return o(e)?r:i(r,n(e))}var i=n(170),o=n(47);e.exports=r},function(e,t,n){var r=n(170),i=n(177),o=n(178),a=n(179),s=Object.getOwnPropertySymbols,u=s?function(e){for(var t=[];e;)r(t,o(e)),e=i(e);return t}:a;e.exports=u},function(e,t,n){var r=n(52),i=r(Object.getPrototypeOf,Object);e.exports=i},function(e,t,n){var r=n(52),i=n(179),o=Object.getOwnPropertySymbols,a=o?r(o,Object):i;e.exports=a},function(e,t){function n(){return[]}e.exports=n},function(e,t,n){function r(e){return a(e)?i(e,!0):o(e)}var i=n(38),o=n(181),a=n(42);e.exports=r},function(e,t,n){function r(e){if(!i(e))return a(e);var t=o(e),n=[];for(var r in e)("constructor"!=r||!t&&u.call(e,r))&&n.push(r);return n}var i=n(44),o=n(50),a=n(182),s=Object.prototype,u=s.hasOwnProperty;e.exports=r},function(e,t){function n(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}e.exports=n},function(e,t,n){function r(e,t,n){var r=e?e.length:0;if(!r)return-1;var s=null==n?0:o(n);return s<0&&(s=a(r+s,0)),i(e,t,s)}var i=n(93),o=n(184),a=Math.max;e.exports=r},function(e,t,n){function r(e){var t=i(e),n=t%1;return t===t?n?t-n:t:0}var i=n(185);e.exports=r},function(e,t,n){function r(e){if(!e)return 0===e?e:0;if(e=i(e),e===o||e===-o){var t=e<0?-1:1;return t*a}return e===e?e:0}var i=n(186),o=1/0,a=1.7976931348623157e308;e.exports=r},function(e,t,n){function r(e){if("number"==typeof e)return e;if(o(e))return a;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=c.test(e);return n||l.test(e)?f(e.slice(2),n?2:8):u.test(e)?a:+e}var i=n(44),o=n(145),a=NaN,s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;e.exports=r},function(e,t,n){function r(e){return i(e)&&e!=+e}var i=n(188);e.exports=r},function(e,t,n){function r(e){return"number"==typeof e||i(e)&&s.call(e)==o}var i=n(46),o="[object Number]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){function r(e){if(s(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||o(e)))return!e.length;var t=i(e);if(t==f||t==p)return!e.size;if(v||c(e))return!l(e).length;for(var n in e)if(h.call(e,n))return!1;return!0}var i=n(125),o=n(40),a=n(47),s=n(42),u=n(190),c=n(50),l=n(51),f="[object Map]",p="[object Set]",d=Object.prototype,h=d.hasOwnProperty,m=d.propertyIsEnumerable,v=!m.call({valueOf:1},"valueOf");e.exports=r},function(e,t,n){(function(e){var r=n(67),i=n(191),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o,u=s?r.Buffer:void 0,c=u?u.isBuffer:void 0,l=c||i;e.exports=l}).call(t,n(25)(e))},function(e,t){function n(){return!1}e.exports=n},function(e,t,n){function r(e,t){return i(e,t)}var i=n(115);e.exports=r},function(e,t){function n(e){return void 0===e}e.exports=n},function(e,t,n){function r(e){return"string"==typeof e||!i(e)&&o(e)&&u.call(e)==a}var i=n(47),o=n(46),a="[object String]",s=Object.prototype,u=s.toString;e.exports=r},function(e,t,n){var r=n(196),i=n(197),o=r(i);e.exports=o},function(e,t,n){function r(e){return function(t,n,r){var s=Object(t);if(!o(t)){var u=i(n,3);t=a(t),n=function(e){return u(s[e],e,s)}}var c=e(t,n,r);return c>-1?s[u?t[c]:c]:void 0}}var i=n(106),o=n(42),a=n(37);e.exports=r},function(e,t,n){function r(e,t,n){var r=e?e.length:0;if(!r)return-1;var u=null==n?0:a(n);return u<0&&(u=s(r+u,0)),i(e,o(t,3),u)}var i=n(94),o=n(106),a=n(184),s=Math.max;e.exports=r},function(e,t,n){function r(e,t,n){if(e=c(e),e&&(n||void 0===t))return e.replace(l,"");if(!e||!(t=i(t)))return e;var r=u(e),f=u(t),p=s(r,f),d=a(r,f)+1;return o(r,p,d).join("")}var i=n(144),o=n(199),a=n(201),s=n(202),u=n(203),c=n(143),l=/^\s+|\s+$/g;e.exports=r},function(e,t,n){function r(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:i(e,t,n)}var i=n(200);e.exports=r},function(e,t){function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length;n--&&i(t,e[n],0)>-1;);return n}var i=n(93);e.exports=r},function(e,t,n){function r(e,t){for(var n=-1,r=e.length;++n<r&&i(t,e[n],0)>-1;);return n}var i=n(93);e.exports=r},function(e,t,n){function r(e){return o(e)?a(e):i(e)}var i=n(204),o=n(205),a=n(206);e.exports=r},function(e,t){function n(e){return e.split("")}e.exports=n},function(e,t){function n(e){return u.test(e)}var r="\\ud800-\\udfff",i="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\ufe0e\\ufe0f",s="\\u200d",u=RegExp("["+s+r+i+o+a+"]");e.exports=n},function(e,t){function n(e){return e.match(_)||[]}var r="\\ud800-\\udfff",i="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\ufe0e\\ufe0f",s="["+r+"]",u="["+i+o+"]",c="\\ud83c[\\udffb-\\udfff]",l="(?:"+u+"|"+c+")",f="[^"+r+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",m=l+"?",v="["+a+"]?",g="(?:"+h+"(?:"+[f,p,d].join("|")+")"+v+m+")*",y=v+m+g,b="(?:"+[f+u+"?",u,p,d,s].join("|")+")",_=RegExp(c+"(?="+c+")|"+b+y,"g");e.exports=n},function(e,t,n){var r=n(100),i=n(208),o=n(209),a=n(99),s=a(function(e){return e.push(void 0,i),r(o,void 0,e)});e.exports=s},function(e,t,n){function r(e,t,n,r){return void 0===e||i(e,o[n])&&!a.call(r,n)?t:e}var i=n(79),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(210),i=n(212),o=n(180),a=i(function(e,t,n,i){r(t,o(t),e,i)});e.exports=a},function(e,t,n){function r(e,t,n,r){n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],u=r?r(n[s],e[s],s,n,e):void 0;i(n,s,void 0===u?e[s]:u)}return n}var i=n(211);e.exports=r},function(e,t,n){function r(e,t,n){var r=e[t];a.call(e,t)&&i(r,n)&&(void 0!==n||t in e)||(e[t]=n)}var i=n(79),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return i(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var u=n[r];u&&e(t,u,r,a)}return t})}var i=n(99),o=n(213);e.exports=r},function(e,t,n){function r(e,t,n){if(!s(n))return!1;var r=typeof t;return!!("number"==r?o(n)&&a(t,n.length):"string"==r&&t in n)&&i(n[t],e)}var i=n(79),o=n(42),a=n(48),s=n(44);e.exports=r},function(e,t,n){var r=n(215),i=n(212),o=i(function(e,t,n){r(e,t,n)});e.exports=o},function(e,t,n){function r(e,t,n,p,d){if(e!==t){if(!c(t)&&!f(t))var h=s(t);o(h||t,function(o,s){if(h&&(s=o,o=t[s]),l(o))d||(d=new i),u(e,t,s,n,r,p,d);else{var c=p?p(e[s],o,s+"",e,t,d):void 0;void 0===c&&(c=o),a(e,s,c)}})}}var i=n(109),o=n(156),a=n(216),s=n(181),u=n(217),c=n(47),l=n(44),f=n(131);e.exports=r},function(e,t,n){function r(e,t,n){(void 0===n||i(e[t],n))&&("number"!=typeof t||void 0!==n||t in e)||(e[t]=n)}var i=n(79);e.exports=r},function(e,t,n){function r(e,t,n,r,m,v,g){var y=e[n],b=t[n],_=g.get(b);if(_)return void i(e,n,_);var w=v?v(y,b,n+"",e,t,g):void 0,x=void 0===w;x&&(w=b,u(b)||d(b)?u(y)?w=y:c(y)?w=a(y):(x=!1,w=o(b,!0)):p(b)||s(b)?s(y)?w=h(y):!f(y)||r&&l(y)?(x=!1,w=o(b,!0)):w=y:x=!1),x&&(g.set(b,w),m(w,b,r,v,g),g.delete(b)),i(e,n,w)}var i=n(216),o=n(218),a=n(221),s=n(40),u=n(47),c=n(41),l=n(43),f=n(44),p=n(237),d=n(131),h=n(238);e.exports=r},function(e,t,n){function r(e,t,n,x,R,j,P){var S;if(x&&(S=j?x(e,R,j,P):x(e)),void 0!==S)return S;if(!b(e))return e;var E=v(e);if(E){if(S=d(e),!t)return c(e,S)}else{var k=p(e),N=k==C||k==O;if(g(e))return u(e,t);if(k==F||k==w||N&&!j){if(y(e))return j?e:{};if(S=m(N?{}:e),!t)return l(e,s(S,e))}else{if(!K[k])return j?e:{};S=h(e,k,r,t)}}P||(P=new i);var T=P.get(e);if(T)return T;if(P.set(e,S),!E)var A=n?f(e):_(e);return o(A||e,function(i,o){A&&(o=i,i=e[o]),a(S,o,r(i,t,n,x,o,e,P))}),S}var i=n(109),o=n(156),a=n(211),s=n(219),u=n(220),c=n(221),l=n(222),f=n(223),p=n(125),d=n(224),h=n(225),m=n(235),v=n(47),g=n(190),y=n(64),b=n(44),_=n(37),w="[object Arguments]",x="[object Array]",R="[object Boolean]",j="[object Date]",P="[object Error]",C="[object Function]",O="[object GeneratorFunction]",S="[object Map]",E="[object Number]",F="[object Object]",k="[object RegExp]",N="[object Set]",T="[object String]",A="[object Symbol]",M="[object WeakMap]",H="[object ArrayBuffer]",L="[object DataView]",U="[object Float32Array]",D="[object Float64Array]",I="[object Int8Array]",V="[object Int16Array]",q="[object Int32Array]",B="[object Uint8Array]",Q="[object Uint8ClampedArray]",z="[object Uint16Array]",W="[object Uint32Array]",K={};K[w]=K[x]=K[H]=K[L]=K[R]=K[j]=K[U]=K[D]=K[I]=K[V]=K[q]=K[S]=K[E]=K[F]=K[k]=K[N]=K[T]=K[A]=K[B]=K[Q]=K[z]=K[W]=!0,K[P]=K[C]=K[M]=!1,e.exports=r},function(e,t,n){function r(e,t){return e&&i(t,o(t),e)}var i=n(210),o=n(37);e.exports=r},function(e,t){function n(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}e.exports=n},function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=n},function(e,t,n){function r(e,t){return i(e,o(e),t)}var i=n(210),o=n(178);e.exports=r},function(e,t,n){function r(e){return i(e,a,o)}var i=n(175),o=n(178),a=n(37);e.exports=r},function(e,t){function n(e){var t=e.length,n=e.constructor(t);return t&&"string"==typeof e[0]&&i.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var r=Object.prototype,i=r.hasOwnProperty;e.exports=n},function(e,t,n){function r(e,t,n,r){var F=e.constructor;switch(t){case b:return i(e);case f:case p:return new F(+e);case _:return o(e,r);case w:case x:case R:case j:case P:case C:case O:case S:case E:return l(e,r);case d:return a(e,r,n);case h:case g:return new F(e);case m:return s(e);case v:return u(e,r,n);case y:return c(e)}}var i=n(226),o=n(227),a=n(228),s=n(230),u=n(231),c=n(233),l=n(234),f="[object Boolean]",p="[object Date]",d="[object Map]",h="[object Number]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object Symbol]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",R="[object Int8Array]",j="[object Int16Array]",P="[object Int32Array]",C="[object Uint8Array]",O="[object Uint8ClampedArray]",S="[object Uint16Array]",E="[object Uint32Array]";e.exports=r},function(e,t,n){function r(e){var t=new e.constructor(e.byteLength);return new i(t).set(new i(e)),t}var i=n(121);e.exports=r},function(e,t,n){function r(e,t){var n=t?i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var i=n(226);e.exports=r},function(e,t,n){function r(e,t,n){var r=t?n(a(e),!0):a(e);return o(r,i,new e.constructor)}var i=n(229),o=n(165),a=n(122);e.exports=r},function(e,t){function n(e,t){return e.set(t[0],t[1]),e}e.exports=n},function(e,t){function n(e){var t=new e.constructor(e.source,r.exec(e));return t.lastIndex=e.lastIndex,t}var r=/\w*$/;e.exports=n},function(e,t,n){function r(e,t,n){var r=t?n(a(e),!0):a(e);return o(r,i,new e.constructor)}var i=n(232),o=n(165),a=n(123);e.exports=r},function(e,t){function n(e,t){return e.add(t),e}e.exports=n},function(e,t,n){function r(e){return a?Object(a.call(e)):{}}var i=n(120),o=i?i.prototype:void 0,a=o?o.valueOf:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=t?i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var i=n(226);e.exports=r},function(e,t,n){function r(e){return"function"!=typeof e.constructor||a(e)?{}:i(o(e))}var i=n(236),o=n(177),a=n(50);e.exports=r},function(e,t,n){function r(e){return i(e)?o(e):{}}var i=n(44),o=Object.create;e.exports=r},function(e,t,n){function r(e){if(!a(e)||d.call(e)!=s||o(e))return!1;var t=i(e);if(null===t)return!0;var n=f.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==p}var i=n(177),o=n(64),a=n(46),s="[object Object]",u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=l.call(Object),d=c.toString;e.exports=r},function(e,t,n){function r(e){return i(e,o(e))}var i=n(210),o=n(180);e.exports=r},function(e,t,n){"use strict";function r(e){if(a(e))return e;if(s(e))return parseFloat(e);if(o(e))return i(e,r);throw new Error("The value should be a number, a parseable string or an array of those.")}var i=n(162),o=n(47),a=n(188),s=n(194);e.exports=r},function(e,t,n){"use strict";function r(e,t){var n={},r=o(t,function(e){return e.indexOf("attribute:")!==-1}),c=a(r,function(e){return e.split(":")[1]});u(c,"*")===-1?i(c,function(t){e.isConjunctiveFacet(t)&&e.isFacetRefined(t)&&(n.facetsRefinements||(n.facetsRefinements={}),n.facetsRefinements[t]=e.facetsRefinements[t]),e.isDisjunctiveFacet(t)&&e.isDisjunctiveFacetRefined(t)&&(n.disjunctiveFacetsRefinements||(n.disjunctiveFacetsRefinements={}),n.disjunctiveFacetsRefinements[t]=e.disjunctiveFacetsRefinements[t]),e.isHierarchicalFacet(t)&&e.isHierarchicalFacetRefined(t)&&(n.hierarchicalFacetsRefinements||(n.hierarchicalFacetsRefinements={}),n.hierarchicalFacetsRefinements[t]=e.hierarchicalFacetsRefinements[t]);var r=e.getNumericRefinements(t);s(r)||(n.numericRefinements||(n.numericRefinements={}),n.numericRefinements[t]=e.numericRefinements[t])}):(s(e.numericRefinements)||(n.numericRefinements=e.numericRefinements),s(e.facetsRefinements)||(n.facetsRefinements=e.facetsRefinements),s(e.disjunctiveFacetsRefinements)||(n.disjunctiveFacetsRefinements=e.disjunctiveFacetsRefinements),s(e.hierarchicalFacetsRefinements)||(n.hierarchicalFacetsRefinements=e.hierarchicalFacetsRefinements));var l=o(t,function(e){return e.indexOf("attribute:")===-1; });return i(l,function(t){n[t]=e[t]}),n}var i=n(155),o=n(159),a=n(162),s=n(189),u=n(183);e.exports=r},function(e,t,n){"use strict";var r=n(193),i=n(194),o=n(43),a=n(189),s=n(207),u=n(164),c=n(159),l=n(167),f={addRefinement:function(e,t,n){if(f.isRefined(e,t,n))return e;var r=""+n,i=e[t]?e[t].concat(r):[r],o={};return o[t]=i,s({},o,e)},removeRefinement:function(e,t,n){if(r(n))return f.clearRefinement(e,t);var i=""+n;return f.clearRefinement(e,function(e,n){return t===n&&i===e})},toggleRefinement:function(e,t,n){if(r(n))throw new Error("toggleRefinement should be used with a value");return f.isRefined(e,t,n)?f.removeRefinement(e,t,n):f.addRefinement(e,t,n)},clearRefinement:function(e,t,n){return r(t)?{}:i(t)?l(e,t):o(t)?u(e,function(e,r,i){var o=c(r,function(e){return!t(e,i,n)});return a(o)||(e[i]=o),e},{}):void 0},isRefined:function(e,t,i){var o=n(183),a=!!e[t]&&e[t].length>0;if(r(i)||!a)return a;var s=""+i;return o(e[t],s)!==-1}};e.exports=f},function(e,t,n){"use strict";function r(e){var t={};return d(e,function(e,n){t[e]=n}),t}function i(e,t,n){t&&t[n]&&(e.stats=t[n])}function o(e,t){return b(e,function(e){return _(e.attributes,t)})}function a(e,t){var n=t.results[0];this.query=n.query,this.parsedQuery=n.parsedQuery,this.hits=n.hits,this.index=n.index,this.hitsPerPage=n.hitsPerPage,this.nbHits=n.nbHits,this.nbPages=n.nbPages,this.page=n.page,this.processingTimeMS=y(t.results,"processingTimeMS"),this.aroundLatLng=n.aroundLatLng,this.automaticRadius=n.automaticRadius,this.serverUsed=n.serverUsed,this.timeoutCounts=n.timeoutCounts,this.timeoutHits=n.timeoutHits,this.disjunctiveFacets=[],this.hierarchicalFacets=w(e.hierarchicalFacets,function(){return[]}),this.facets=[];var a=e.getRefinedDisjunctiveFacets(),s=r(e.facets),u=r(e.disjunctiveFacets),c=1,l=this;d(n.facets,function(t,r){var a=o(e.hierarchicalFacets,r);if(a){var c=a.attributes.indexOf(r),f=v(e.hierarchicalFacets,{name:a.name});l.hierarchicalFacets[f][c]={attribute:r,data:t,exhaustive:n.exhaustiveFacetsCount}}else{var p,d=m(e.disjunctiveFacets,r)!==-1,h=m(e.facets,r)!==-1;d&&(p=u[r],l.disjunctiveFacets[p]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(l.disjunctiveFacets[p],n.facets_stats,r)),h&&(p=s[r],l.facets[p]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(l.facets[p],n.facets_stats,r))}}),this.hierarchicalFacets=h(this.hierarchicalFacets),d(a,function(r){var o=t.results[c],a=e.getHierarchicalFacetByName(r);d(o.facets,function(t,r){var s;if(a){s=v(e.hierarchicalFacets,{name:a.name});var c=v(l.hierarchicalFacets[s],{attribute:r});if(c===-1)return;l.hierarchicalFacets[s][c].data=j({},l.hierarchicalFacets[s][c].data,t)}else{s=u[r];var f=n.facets&&n.facets[r]||{};l.disjunctiveFacets[s]={name:r,data:R({},t,f),exhaustive:o.exhaustiveFacetsCount},i(l.disjunctiveFacets[s],o.facets_stats,r),e.disjunctiveFacetsRefinements[r]&&d(e.disjunctiveFacetsRefinements[r],function(t){!l.disjunctiveFacets[s].data[t]&&m(e.disjunctiveFacetsRefinements[r],t)>-1&&(l.disjunctiveFacets[s].data[t]=0)})}}),c++}),d(e.getRefinedHierarchicalFacets(),function(n){var r=e.getHierarchicalFacetByName(n),i=e._getHierarchicalFacetSeparator(r),o=e.getHierarchicalRefinement(n);if(!(0===o.length||o[0].split(i).length<2)){var a=t.results[c];d(a.facets,function(t,n){var a=v(e.hierarchicalFacets,{name:r.name}),s=v(l.hierarchicalFacets[a],{attribute:n});if(s!==-1){var u={};if(o.length>0){var c=o[0].split(i)[0];u[c]=l.hierarchicalFacets[a][s].data[c]}l.hierarchicalFacets[a][s].data=R(u,t,l.hierarchicalFacets[a][s].data)}}),c++}}),d(e.facetsExcludes,function(e,t){var r=s[t];l.facets[r]={name:t,data:n.facets[t],exhaustive:n.exhaustiveFacetsCount},d(e,function(e){l.facets[r]=l.facets[r]||{name:t},l.facets[r].data=l.facets[r].data||{},l.facets[r].data[e]=0})}),this.hierarchicalFacets=w(this.hierarchicalFacets,F(e)),this.facets=h(this.facets),this.disjunctiveFacets=h(this.disjunctiveFacets),this._state=e}function s(e,t){var n={name:t};if(e._state.isConjunctiveFacet(t)){var r=b(e.facets,n);return r?w(r.data,function(n,r){return{name:r,count:n,isRefined:e._state.isFacetRefined(t,r),isExcluded:e._state.isExcludeRefined(t,r)}}):[]}if(e._state.isDisjunctiveFacet(t)){var i=b(e.disjunctiveFacets,n);return i?w(i.data,function(n,r){return{name:r,count:n,isRefined:e._state.isDisjunctiveFacetRefined(t,r)}}):[]}if(e._state.isHierarchicalFacet(t))return b(e.hierarchicalFacets,n)}function u(e,t){if(!t.data||0===t.data.length)return t;var n=w(t.data,O(u,e)),r=e(n),i=j({},t,{data:r});return i}function c(e,t){return t.sort(e)}function l(e,t){var n=b(e,{name:t});return n&&n.stats}function f(e,t,n,r,i){var o=b(i,{name:n}),a=g(o,"data["+r+"]"),s=g(o,"exhaustive");return{type:t,attributeName:n,name:r,count:a||0,exhaustive:s||!1}}function p(e,t,n,r){for(var i=b(r,{name:t}),o=e.getHierarchicalFacetByName(t),a=n.split(o.separator),s=a[a.length-1],u=0;void 0!==i&&u<a.length;++u)i=b(i.data,{name:a[u]});var c=g(i,"count"),l=g(i,"exhaustive");return{type:"hierarchical",attributeName:t,name:s,count:c||0,exhaustive:l||!1}}var d=n(155),h=n(243),m=n(183),v=n(197),g=n(138),y=n(244),b=n(195),_=n(246),w=n(162),x=n(249),R=n(207),j=n(214),P=n(47),C=n(43),O=n(254),S=n(289),E=n(290),F=n(293);a.prototype.getFacetByName=function(e){var t={name:e};return b(this.facets,t)||b(this.disjunctiveFacets,t)||b(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var n=s(this,e);if(!n)throw new Error(e+" is not a retrieved facet.");var r=R({},t,{sortBy:a.DEFAULT_SORT});if(P(r.sortBy)){var i=E(r.sortBy,a.DEFAULT_SORT);return P(n)?x(n,i[0],i[1]):u(S(x,i[0],i[1]),n)}if(C(r.sortBy))return P(n)?n.sort(r.sortBy):u(O(c,r.sortBy),n);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},a.prototype.getFacetStats=function(e){if(this._state.isConjunctiveFacet(e))return l(this.facets,e);if(this._state.isDisjunctiveFacet(e))return l(this.disjunctiveFacets,e);throw new Error(e+" is not present in `facets` or `disjunctiveFacets`")},a.prototype.getRefinements=function(){var e=this._state,t=this,n=[];return d(e.facetsRefinements,function(r,i){d(r,function(r){n.push(f(e,"facet",i,r,t.facets))})}),d(e.facetsExcludes,function(r,i){d(r,function(r){n.push(f(e,"exclude",i,r,t.facets))})}),d(e.disjunctiveFacetsRefinements,function(r,i){d(r,function(r){n.push(f(e,"disjunctive",i,r,t.disjunctiveFacets))})}),d(e.hierarchicalFacetsRefinements,function(r,i){d(r,function(r){n.push(p(e,i,r,t.hierarchicalFacets))})}),d(e.numericRefinements,function(e,t){d(e,function(e,r){d(e,function(e){n.push({type:"numeric",attributeName:t,name:e,numericValue:e,operator:r})})})}),d(e.tagRefinements,function(e){n.push({type:"tag",attributeName:"_tags",name:e})}),n},e.exports=a},function(e,t){function n(e){for(var t=-1,n=e?e.length:0,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i}e.exports=n},function(e,t,n){function r(e,t){return e&&e.length?o(e,i(t,2)):0}var i=n(106),o=n(245);e.exports=r},function(e,t){function n(e,t){for(var n,r=-1,i=e.length;++r<i;){var o=t(e[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}e.exports=n},function(e,t,n){function r(e,t,n,r){e=o(e)?e:u(e),n=n&&!r?s(n):0;var l=e.length;return n<0&&(n=c(l+n,0)),a(e)?n<=l&&e.indexOf(t,n)>-1:!!l&&i(e,t,n)>-1}var i=n(93),o=n(42),a=n(194),s=n(184),u=n(247),c=Math.max;e.exports=r},function(e,t,n){function r(e){return e?i(e,o(e)):[]}var i=n(248),o=n(37);e.exports=r},function(e,t,n){function r(e,t){return i(t,function(t){return e[t]})}var i=n(54);e.exports=r},function(e,t,n){function r(e,t,n,r){return null==e?[]:(o(t)||(t=null==t?[]:[t]),n=r?void 0:n,o(n)||(n=null==n?[]:[n]),i(e,t,n))}var i=n(250),o=n(47);e.exports=r},function(e,t,n){function r(e,t,n){var r=-1;t=i(t.length?t:[l],u(o));var f=a(e,function(e,n,o){var a=i(t,function(t){return t(e)});return{criteria:a,index:++r,value:e}});return s(f,function(e,t){return c(e,t,n)})}var i=n(54),o=n(106),a=n(163),s=n(251),u=n(97),c=n(252),l=n(151);e.exports=r},function(e,t){function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}e.exports=n},function(e,t,n){function r(e,t,n){for(var r=-1,o=e.criteria,a=t.criteria,s=o.length,u=n.length;++r<s;){var c=i(o[r],a[r]);if(c){if(r>=u)return c;var l=n[r];return c*("desc"==l?-1:1)}}return e.index-t.index}var i=n(253);e.exports=r},function(e,t,n){function r(e,t){if(e!==t){var n=void 0!==e,r=null===e,o=e===e,a=i(e),s=void 0!==t,u=null===t,c=t===t,l=i(t);if(!u&&!l&&!a&&e>t||a&&s&&c&&!u&&!l||r&&s&&c||!n&&c||!o)return 1;if(!r&&!a&&!l&&e<t||l&&n&&o&&!r&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}var i=n(145);e.exports=r},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=32,u=r(function(e,t){var n=a(t,o(u));return i(e,s,void 0,t,n)});u.placeholder={},e.exports=u},function(e,t,n){function r(e,t,n,r,x,R,j,P){var C=t&v;if(!C&&"function"!=typeof e)throw new TypeError(h);var O=r?r.length:0;if(O||(t&=~(b|_),r=x=void 0),j=void 0===j?j:w(d(j),0),P=void 0===P?P:d(P),O-=x?x.length:0,t&_){var S=r,E=x;r=x=void 0}var F=C?void 0:c(e),k=[e,t,n,r,x,S,E,R,j,P];if(F&&l(k,F),e=k[0],t=k[1],n=k[2],r=k[3],x=k[4],P=k[9]=null==k[9]?C?0:e.length:w(k[9]-O,0),!P&&t&(g|y)&&(t&=~(g|y)),t&&t!=m)N=t==g||t==y?a(e,t,P):t!=b&&t!=(m|b)||x.length?s.apply(void 0,k):u(e,t,n,r);else var N=o(e,t,n);var T=F?i:f;return p(T(N,k),e,t)}var i=n(256),o=n(258),a=n(260),s=n(261),u=n(287),c=n(269),l=n(288),f=n(276),p=n(278),d=n(184),h="Expected a function",m=1,v=2,g=8,y=16,b=32,_=64,w=Math.max;e.exports=r},function(e,t,n){var r=n(151),i=n(257),o=i?function(e,t){return i.set(e,t),e}:r;e.exports=o},function(e,t,n){var r=n(129),i=r&&new r;e.exports=i},function(e,t,n){function r(e,t,n){function r(){var t=this&&this!==o&&this instanceof r?u:e;return t.apply(s?n:this,arguments)}var s=t&a,u=i(e);return r}var i=n(259),o=n(67),a=1;e.exports=r},function(e,t,n){function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=i(e.prototype),r=e.apply(n,t);return o(r)?r:n}}var i=n(236),o=n(44);e.exports=r},function(e,t,n){function r(e,t,n){function r(){for(var o=arguments.length,p=Array(o),d=o,h=u(r);d--;)p[d]=arguments[d];var m=o<3&&p[0]!==h&&p[o-1]!==h?[]:c(p,h);if(o-=m.length,o<n)return s(e,t,a,r.placeholder,void 0,p,m,void 0,void 0,n-o);var v=this&&this!==l&&this instanceof r?f:e;return i(v,this,p)}var f=o(e);return r}var i=n(100),o=n(259),a=n(261),s=n(265),u=n(284),c=n(286),l=n(67);e.exports=r},function(e,t,n){function r(e,t,n,b,_,w,x,R,j,P){function C(){for(var d=arguments.length,h=Array(d),m=d;m--;)h[m]=arguments[m];if(F)var v=c(C),g=a(h,v);if(b&&(h=i(h,b,_,F)),w&&(h=o(h,w,x,F)),d-=g,F&&d<P){var y=f(h,v);return u(e,t,r,C.placeholder,n,h,y,R,j,P-d)}var T=S?n:this,A=E?T[e]:e;return d=h.length,R?h=l(h,R):k&&d>1&&h.reverse(),O&&j<d&&(h.length=j),this&&this!==p&&this instanceof C&&(A=N||s(A)),A.apply(T,h)}var O=t&g,S=t&d,E=t&h,F=t&(m|v),k=t&y,N=E?void 0:s(e);return C}var i=n(262),o=n(263),a=n(264),s=n(259),u=n(265),c=n(284),l=n(285),f=n(286),p=n(67),d=1,h=2,m=8,v=16,g=128,y=512;e.exports=r},function(e,t){function n(e,t,n,i){for(var o=-1,a=e.length,s=n.length,u=-1,c=t.length,l=r(a-s,0),f=Array(c+l),p=!i;++u<c;)f[u]=t[u];for(;++o<s;)(p||o<a)&&(f[n[o]]=e[o]);for(;l--;)f[u++]=e[o++];return f}var r=Math.max;e.exports=n},function(e,t){function n(e,t,n,i){for(var o=-1,a=e.length,s=-1,u=n.length,c=-1,l=t.length,f=r(a-u,0),p=Array(f+l),d=!i;++o<f;)p[o]=e[o];for(var h=o;++c<l;)p[h+c]=t[c];for(;++s<u;)(d||o<a)&&(p[h+n[s]]=e[o++]);return p}var r=Math.max;e.exports=n},function(e,t){function n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}e.exports=n},function(e,t,n){function r(e,t,n,r,d,h,m,v,g,y){var b=t&l,_=b?m:void 0,w=b?void 0:m,x=b?h:void 0,R=b?void 0:h;t|=b?f:p,t&=~(b?p:f),t&c||(t&=~(s|u));var j=[e,t,d,x,_,R,w,v,g,y],P=n.apply(void 0,j);return i(e)&&o(P,j),P.placeholder=r,a(P,e,t)}var i=n(266),o=n(276),a=n(278),s=1,u=2,c=4,l=8,f=32,p=64;e.exports=r},function(e,t,n){function r(e){var t=a(e),n=s[t];if("function"!=typeof n||!(t in i.prototype))return!1;if(e===n)return!0;var r=o(n);return!!r&&e===r[0]}var i=n(267),o=n(269),a=n(271),s=n(273);e.exports=r},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var i=n(236),o=n(268),a=4294967295;r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){var r=n(257),i=n(270),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e){for(var t=e.name+"",n=i[t],r=a.call(i,t)?n.length:0;r--;){var o=n[r],s=o.func;if(null==s||s==e)return o.name}return t}var i=n(272),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t){var n={};e.exports=n},function(e,t,n){function r(e){if(u(e)&&!s(e)&&!(e instanceof i)){if(e instanceof o)return e;if(f.call(e,"__wrapped__"))return c(e)}return new o(e)}var i=n(267),o=n(274),a=n(268),s=n(47),u=n(46),c=n(275),l=Object.prototype,f=l.hasOwnProperty;r.prototype=a.prototype,r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var i=n(236),o=n(268);r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e){if(e instanceof i)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=a(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var i=n(267),o=n(274),a=n(221);e.exports=r},function(e,t,n){var r=n(256),i=n(277),o=150,a=16,s=function(){var e=0,t=0;return function(n,s){var u=i(),c=a-(u-t);if(t=u,c>0){if(++e>=o)return n}else e=0;return r(n,s)}}();e.exports=s},function(e,t,n){var r=n(67),i=function(){return r.Date.now()};e.exports=i},function(e,t,n){var r=n(279),i=n(280),o=n(281),a=n(151),s=n(282),u=n(283),c=i?function(e,t,n){var a=t+"";return i(e,"toString",{configurable:!0,enumerable:!1,value:r(s(a,u(o(a),n)))})}:a;e.exports=c},function(e,t){function n(e){return function(){return e}}e.exports=n},function(e,t,n){var r=n(62),i=function(){var e=r(Object,"defineProperty"),t=r.name;return t&&t.length>2?e:void 0}();e.exports=i},function(e,t){function n(e){var t=e.match(r);return t?t[1].split(i):[]}var r=/\{\n\/\* \[wrapped with (.+)\] \*/,i=/,? & /;e.exports=n},function(e,t){function n(e,t){var n=t.length,i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(r,"{\n/* [wrapped with "+t+"] */\n")}var r=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=n},function(e,t,n){function r(e,t){return i(m,function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)}),e.sort()}var i=n(156),o=n(92),a=1,s=2,u=8,c=16,l=32,f=64,p=128,d=256,h=512,m=[["ary",p],["bind",a],["bindKey",s],["curry",u],["curryRight",c],["flip",h],["partial",l],["partialRight",f],["rearg",d]];e.exports=r},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length,r=a(t.length,n),s=i(e);r--;){var u=t[r];e[r]=o(u,n)?s[u]:void 0}return e}var i=n(221),o=n(48),a=Math.min;e.exports=r},function(e,t){function n(e,t){for(var n=-1,i=e.length,o=0,a=[];++n<i;){var s=e[n];s!==t&&s!==r||(e[n]=r,a[o++]=n)}return a}var r="__lodash_placeholder__";e.exports=n},function(e,t,n){function r(e,t,n,r){function u(){for(var t=-1,o=arguments.length,s=-1,f=r.length,p=Array(f+o),d=this&&this!==a&&this instanceof u?l:e;++s<f;)p[s]=r[s];for(;o--;)p[s++]=arguments[++t];return i(d,c?n:this,p)}var c=t&s,l=o(e);return u}var i=n(100),o=n(259),a=n(67),s=1;e.exports=r},function(e,t,n){function r(e,t){var n=e[1],r=t[1],m=n|r,v=m<(u|c|p),g=r==p&&n==f||r==p&&n==d&&e[7].length<=t[8]||r==(p|d)&&t[7].length<=t[8]&&n==f;if(!v&&!g)return e;r&u&&(e[2]=t[2],m|=n&u?0:l);var y=t[3];if(y){var b=e[3];e[3]=b?i(b,y,t[4]):y,e[4]=b?a(e[3],s):t[4]}return y=t[5],y&&(b=e[5],e[5]=b?o(b,y,t[6]):y,e[6]=b?a(e[5],s):t[6]),y=t[7],y&&(e[7]=y),r&p&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var i=n(262),o=n(263),a=n(286),s="__lodash_placeholder__",u=1,c=2,l=4,f=8,p=128,d=256,h=Math.min;e.exports=r},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=64,u=r(function(e,t){var n=a(t,o(u));return i(e,s,void 0,t,n)});u.placeholder={},e.exports=u},function(e,t,n){"use strict";var r=n(164),i=n(195),o=n(291);e.exports=function(e,t){return r(e,function(e,n){var r=n.split(":");if(t&&1===r.length){var a=i(t,function(e){return o(e,n[0])});a&&(r=a.split(":"))}return e[0].push(r[0]),e[1].push(r[1]),e},[[],[]])}},function(e,t,n){function r(e,t,n){return e=s(e),n=i(a(n),0,e.length),t=o(t),e.slice(n,n+t.length)==t}var i=n(292),o=n(144),a=n(184),s=n(143);e.exports=r},function(e,t){function n(e,t,n){return e===e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}e.exports=n},function(e,t,n){"use strict";function r(e){return function(t,n){var r=e.hierarchicalFacets[n],o=e.hierarchicalFacetsRefinements[r.name]&&e.hierarchicalFacetsRefinements[r.name][0]||"",a=e._getHierarchicalFacetSeparator(r),s=e._getHierarchicalRootPath(r),u=e._getHierarchicalShowParentLevel(r),l=h(e._getHierarchicalFacetSortBy(r)),f=i(l,a,s,u,o),p=t;return s&&(p=t.slice(s.split(a).length)),c(p,f,{name:e.hierarchicalFacets[n].name,count:null,isRefined:!0,path:null,data:null})}}function i(e,t,n,r,i){return function(s,c,f){var h=s;if(f>0){var m=0;for(h=s;m<f;)h=h&&p(h.data,{isRefined:!0}),m++}if(h){var v=o(h.path||n,i,t,n,r);h.data=l(u(d(c.data,v),a(t,i)),e[0],e[1])}return s}}function o(e,t,n,r,i){return function(o,a){return(!r||0===a.indexOf(r)&&r!==a)&&(!r&&a.indexOf(n)===-1||r&&a.split(n).length-r.split(n).length===1||a.indexOf(n)===-1&&t.indexOf(n)===-1||0===t.indexOf(a)||0===a.indexOf(e+n)&&(i||0===a.indexOf(t)))}}function a(e,t){return function(n,r){return{name:f(s(r.split(e))),path:r,count:n,isRefined:t===r||0===t.indexOf(r+e),data:null}}}e.exports=r;var s=n(294),u=n(162),c=n(164),l=n(249),f=n(198),p=n(195),d=n(295),h=n(290)},function(e,t){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=n},function(e,t,n){function r(e,t){return null==e?{}:o(e,a(e),i(t))}var i=n(106),o=n(173),a=n(174);e.exports=r},function(e,t,n){"use strict";var r=n(155),i=n(162),o=n(164),a=n(214),s=n(47),u={_getQueries:function(e,t){var n=[];return n.push({indexName:e,params:u._getHitsSearchParams(t)}),r(t.getRefinedDisjunctiveFacets(),function(r){n.push({indexName:e,params:u._getDisjunctiveFacetSearchParams(t,r)})}),r(t.getRefinedHierarchicalFacets(),function(r){var i=t.getHierarchicalFacetByName(r),o=t.getHierarchicalRefinement(r),a=t._getHierarchicalFacetSeparator(i);o.length>0&&o[0].split(a).length>1&&n.push({indexName:e,params:u._getDisjunctiveFacetSearchParams(t,r,!0)})}),n},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(u._getHitsHierarchicalFacetsAttributes(e)),n=u._getFacetFilters(e),r=u._getNumericFilters(e),i=u._getTagFilters(e),o={facets:t,tagFilters:i};return n.length>0&&(o.facetFilters=n),r.length>0&&(o.numericFilters=r),a(e.getQueryParams(),o)},_getDisjunctiveFacetSearchParams:function(e,t,n){var r=u._getFacetFilters(e,t,n),i=u._getNumericFilters(e,t),o=u._getTagFilters(e),s={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],tagFilters:o},c=e.getHierarchicalFacetByName(t);return c?s.facets=u._getDisjunctiveHierarchicalFacetAttribute(e,c,n):s.facets=t,i.length>0&&(s.numericFilters=i),r.length>0&&(s.facetFilters=r),a(e.getQueryParams(),s)},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var n=[];return r(e.numericRefinements,function(e,o){r(e,function(e,a){t!==o&&r(e,function(e){if(s(e)){var t=i(e,function(e){return o+a+e});n.push(t)}else n.push(o+a+e)})})}),n},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,n){var i=[];return r(e.facetsRefinements,function(e,t){r(e,function(e){i.push(t+":"+e)})}),r(e.facetsExcludes,function(e,t){r(e,function(e){i.push(t+":-"+e)})}),r(e.disjunctiveFacetsRefinements,function(e,n){if(n!==t&&e&&0!==e.length){var o=[];r(e,function(e){o.push(n+":"+e)}),i.push(o)}}),r(e.hierarchicalFacetsRefinements,function(r,o){var a=r[0];if(void 0!==a){var s,u,c=e.getHierarchicalFacetByName(o),l=e._getHierarchicalFacetSeparator(c),f=e._getHierarchicalRootPath(c);if(t===o){if(a.indexOf(l)===-1||!f&&n===!0||f&&f.split(l).length===a.split(l).length)return;f?(u=f.split(l).length-1,a=f):(u=a.split(l).length-2,a=a.slice(0,a.lastIndexOf(l))),s=c.attributes[u]}else u=a.split(l).length-1,s=c.attributes[u];s&&i.push([s+":"+a])}}),i},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return o(e.hierarchicalFacets,function(t,n){var r=e.getHierarchicalRefinement(n.name)[0];if(!r)return t.push(n.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(n),o=r.split(i).length,a=n.attributes.slice(0,o+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,n){var r=e._getHierarchicalFacetSeparator(t);if(n===!0){var i=e._getHierarchicalRootPath(t),o=0;return i&&(o=i.split(r).length),[t.attributes[o]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",s=a.split(r).length-1;return t.attributes.slice(0,s+1)}};e.exports=u},function(e,t,n){(function(e,r){function i(e,n){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=u(e,i,r)),i}var o=c(e,n);if(o)return o;var a=Object.keys(n),m=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),P(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(n);if(0===a.length){if(C(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(j(n))return e.stylize(Date.prototype.toString.call(n),"date");if(P(n))return l(n)}var g="",y=!1,_=["{","}"];if(h(n)&&(y=!0,_=["[","]"]),C(n)){var w=n.name?": "+n.name:"";g=" [Function"+w+"]"}if(x(n)&&(g=" "+RegExp.prototype.toString.call(n)),j(n)&&(g=" "+Date.prototype.toUTCString.call(n)),P(n)&&(g=" "+l(n)),0===a.length&&(!y||0==n.length))return _[0]+g+_[1];if(r<0)return x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var R;return R=y?f(e,n,r,m,a):a.map(function(t){return p(e,n,r,m,t,y)}),e.seen.pop(),d(R,g,_)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)k(t,String(a))?o.push(p(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,n,r,i,!0))}),o}function p(e,t,n,r,i,o){var a,s,c;if(c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),k(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=v(n)?u(e,c.value,null):u(e,c.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function v(e){return null===e}function g(e){return null==e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return R(e)&&"[object RegExp]"===S(e)}function R(e){return"object"==typeof e&&null!==e}function j(e){return R(e)&&"[object Date]"===S(e)}function P(e){return R(e)&&("[object Error]"===S(e)||e instanceof Error)}function C(e){return"function"==typeof e}function O(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function S(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}function F(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,a=String(e).replace(N,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n<o;s=r[++n])a+=v(s)||!R(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(w(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var T,A={};t.debuglog=function(e){if(w(T)&&(T={NODE_ENV:"production"}.NODE_DEBUG||""),e=e.toUpperCase(),!A[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var n=r.pid;A[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else A[e]=function(){};return A[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=m,t.isNull=v,t.isNullOrUndefined=g,t.isNumber=y,t.isString=b,t.isSymbol=_,t.isUndefined=w,t.isRegExp=x,t.isObject=R,t.isDate=j,t.isError=P,t.isFunction=C,t.isPrimitive=O,t.isBuffer=n(298);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",F(),t.format.apply(t,arguments))},t.inherits=n(299),t._extend=function(e,t){if(!t||!R(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(24))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,u=0;u<i;u++)c[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=1,u=32,c=r(function(e,t,n){var r=s;if(n.length){var l=a(n,o(c));r|=u}return i(e,r,t,n,l)});c.placeholder={},e.exports=c},function(e,t,n){"use strict";function r(e){return m(e)?d(e,r):v(e)?f(e,r):h(e)?y(e):e}function i(e,t,n,r){if(null!==e&&(n=n.replace(e,""),r=r.replace(e,"")),n=t[n]||n,r=t[r]||r,_.indexOf(n)!==-1||_.indexOf(r)!==-1){ if("q"===n)return-1;if("q"===r)return 1;var i=b.indexOf(n)!==-1,o=b.indexOf(r)!==-1;if(i&&!o)return 1;if(o&&!i)return-1}return n.localeCompare(r)}var o=n(303),a=n(36),s=n(307),u=n(301),c=n(155),l=n(311),f=n(162),p=n(312),d=n(313),h=n(194),m=n(237),v=n(47),g=n(304),y=n(309).encode,b=["dFR","fR","nR","hFR","tR"],_=o.ENCODED_PARAMETERS;t.getStateFromQueryString=function(e,t){var n=t&&t.prefix||"",r=t&&t.mapping||{},i=g(r),u=s.parse(e),c=new RegExp("^"+n),f=p(u,function(e,t){var r=n&&c.test(t),a=r?t.replace(c,""):t,s=o.decode(i[a]||a);return s||a}),d=a._parseNumbers(f);return l(d,a.PARAMETERS)},t.getUnrecognizedParametersInQueryString=function(e,t){var n=t&&t.prefix,r=t&&t.mapping||{},i=g(r),a={},u=s.parse(e);if(n){var l=new RegExp("^"+n);c(u,function(e,t){l.test(t)||(a[t]=e)})}else c(u,function(e,t){o.decode(i[t]||t)||(a[t]=e)});return a},t.getQueryStringFromState=function(e,t){var n=t&&t.moreAttributes,a=t&&t.prefix||"",c=t&&t.mapping||{},l=t&&t.safe||!1,f=g(c),d=l?e:r(e),h=p(d,function(e,t){var n=o.encode(t);return a+(c[n]||n)}),m=""===a?null:new RegExp("^"+a),v=u(i,null,m,f);if(n){var y=s.stringify(h,{encode:l,sort:v}),b=s.stringify(n,{encode:l});return y?y+"&"+b:b}return s.stringify(h,{encode:l,sort:v})}},function(e,t,n){"use strict";var r=n(304),i=n(37),o={advancedSyntax:"aS",allowTyposOnNumericTokens:"aTONT",analyticsTags:"aT",analytics:"a",aroundLatLngViaIP:"aLLVIP",aroundLatLng:"aLL",aroundPrecision:"aP",aroundRadius:"aR",attributesToHighlight:"aTH",attributesToRetrieve:"aTR",attributesToSnippet:"aTS",disjunctiveFacetsRefinements:"dFR",disjunctiveFacets:"dF",distinct:"d",facetsExcludes:"fE",facetsRefinements:"fR",facets:"f",getRankingInfo:"gRI",hierarchicalFacetsRefinements:"hFR",hierarchicalFacets:"hF",highlightPostTag:"hPoT",highlightPreTag:"hPrT",hitsPerPage:"hPP",ignorePlurals:"iP",index:"idx",insideBoundingBox:"iBB",insidePolygon:"iPg",length:"l",maxValuesPerFacet:"mVPF",minimumAroundRadius:"mAR",minProximity:"mP",minWordSizefor1Typo:"mWS1T",minWordSizefor2Typos:"mWS2T",numericFilters:"nF",numericRefinements:"nR",offset:"o",optionalWords:"oW",page:"p",queryType:"qT",query:"q",removeWordsIfNoResults:"rWINR",replaceSynonymsInHighlight:"rSIH",restrictSearchableAttributes:"rSA",synonyms:"s",tagFilters:"tF",tagRefinements:"tR",typoTolerance:"tT",optionalTagFilters:"oTF",optionalFacetFilters:"oFF",snippetEllipsisText:"sET",disableExactOnAttributes:"dEOA",enableExactOnSingleWordQuery:"eEOSWQ"},a=r(o);e.exports={ENCODED_PARAMETERS:i(a),decode:function(e){return a[e]},encode:function(e){return o[e]}}},function(e,t,n){var r=n(279),i=n(305),o=n(151),a=i(function(e,t,n){e[t]=n},r(o));e.exports=a},function(e,t,n){function r(e,t){return function(n,r){return i(n,e,t(r),{})}}var i=n(306);e.exports=r},function(e,t,n){function r(e,t,n,r){return i(e,function(e,i,o){t(r,n(e),i,o)}),r}var i=n(103);e.exports=r},function(e,t,n){"use strict";var r=n(308),i=n(310);e.exports={stringify:r,parse:i}},function(e,t,n){"use strict";var r=n(309),i={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},o={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:r.encode},a=function e(t,n,i,o,a,s,u,c,l){var f=t;if("function"==typeof u)f=u(n,f);else if(f instanceof Date)f=f.toISOString();else if(null===f){if(o)return s?s(n):n;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f||r.isBuffer(f))return s?[s(n)+"="+s(f)]:[n+"="+String(f)];var p=[];if("undefined"==typeof f)return p;var d;if(Array.isArray(u))d=u;else{var h=Object.keys(f);d=c?h.sort(c):h}for(var m=0;m<d.length;++m){var v=d[m];a&&null===f[v]||(p=Array.isArray(f)?p.concat(e(f[v],i(n,v),i,o,a,s,u,c,l)):p.concat(e(f[v],n+(l?"."+v:"["+v+"]"),i,o,a,s,u,c,l)))}return p};e.exports=function(e,t){var n,r,s=e,u=t||{},c="undefined"==typeof u.delimiter?o.delimiter:u.delimiter,l="boolean"==typeof u.strictNullHandling?u.strictNullHandling:o.strictNullHandling,f="boolean"==typeof u.skipNulls?u.skipNulls:o.skipNulls,p="boolean"==typeof u.encode?u.encode:o.encode,d=p?"function"==typeof u.encoder?u.encoder:o.encoder:null,h="function"==typeof u.sort?u.sort:null,m="undefined"!=typeof u.allowDots&&u.allowDots;if(null!==u.encoder&&void 0!==u.encoder&&"function"!=typeof u.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof u.filter?(r=u.filter,s=r("",s)):Array.isArray(u.filter)&&(n=r=u.filter);var v=[];if("object"!=typeof s||null===s)return"";var g;g=u.arrayFormat in i?u.arrayFormat:"indices"in u?u.indices?"indices":"repeat":"indices";var y=i[g];n||(n=Object.keys(s)),h&&n.sort(h);for(var b=0;b<n.length;++b){var _=n[b];f&&null===s[_]||(v=v.concat(a(s[_],_,y,l,f,d,r,h,m)))}return v.join(c)}},function(e,t){"use strict";var n=function(){for(var e=new Array(256),t=0;t<256;++t)e[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();return e}();t.arrayToObject=function(e,t){for(var n=t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)"undefined"!=typeof e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,r){if(!n)return e;if("object"!=typeof n){if(Array.isArray(e))e.push(n);else{if("object"!=typeof e)return[e,n];e[n]=!0}return e}if("object"!=typeof e)return[e].concat(n);var i=e;return Array.isArray(e)&&!Array.isArray(n)&&(i=t.arrayToObject(e,r)),Object.keys(n).reduce(function(e,i){var o=n[i];return Object.prototype.hasOwnProperty.call(e,i)?e[i]=t.merge(e[i],o,r):e[i]=o,e},i)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",i=0;i<t.length;++i){var o=t.charCodeAt(i);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?r+=t.charAt(i):o<128?r+=n[o]:o<2048?r+=n[192|o>>6]+n[128|63&o]:o<55296||o>=57344?r+=n[224|o>>12]+n[128|o>>6&63]+n[128|63&o]:(i+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(i)),r+=n[240|o>>18]+n[128|o>>12&63]+n[128|o>>6&63]+n[128|63&o])}return r},t.compact=function(e,n){if("object"!=typeof e||null===e)return e;var r=n||[],i=r.indexOf(e);if(i!==-1)return r[i];if(r.push(e),Array.isArray(e)){for(var o=[],a=0;a<e.length;++a)e[a]&&"object"==typeof e[a]?o.push(t.compact(e[a],r)):"undefined"!=typeof e[a]&&o.push(e[a]);return o}for(var s=Object.keys(e),u=0;u<s.length;++u){var c=s[u];e[c]=t.compact(e[c],r)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&"undefined"!=typeof e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,n){"use strict";var r=n(309),i=Object.prototype.hasOwnProperty,o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:r.decode},a=function(e,t){for(var n={},r=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0;o<r.length;++o){var a,s,u=r[o],c=u.indexOf("]=")===-1?u.indexOf("="):u.indexOf("]=")+1;c===-1?(a=t.decoder(u),s=t.strictNullHandling?null:""):(a=t.decoder(u.slice(0,c)),s=t.decoder(u.slice(c+1))),i.call(n,a)?n[a]=[].concat(n[a]).concat(s):n[a]=s}return n},s=function e(t,n,r){if(!t.length)return n;var i,o=t.shift();if("[]"===o)i=[],i=i.concat(e(t,n,r));else{i=r.plainObjects?Object.create(null):{};var a="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,s=parseInt(a,10);!isNaN(s)&&o!==a&&String(s)===a&&s>=0&&r.parseArrays&&s<=r.arrayLimit?(i=[],i[s]=e(t,n,r)):i[a]=e(t,n,r)}return i},u=function(e,t,n){if(e){var r=n.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,o=/^([^\[\]]*)/,a=/(\[[^\[\]]*\])/g,u=o.exec(r),c=[];if(u[1]){if(!n.plainObjects&&i.call(Object.prototype,u[1])&&!n.allowPrototypes)return;c.push(u[1])}for(var l=0;null!==(u=a.exec(r))&&l<n.depth;)l+=1,(n.plainObjects||!i.call(Object.prototype,u[1].replace(/\[|\]/g,""))||n.allowPrototypes)&&c.push(u[1]);return u&&c.push("["+r.slice(u.index)+"]"),s(c,t,n)}};e.exports=function(e,t){var n=t||{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.delimiter="string"==typeof n.delimiter||r.isRegExp(n.delimiter)?n.delimiter:o.delimiter,n.depth="number"==typeof n.depth?n.depth:o.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:o.arrayLimit,n.parseArrays=n.parseArrays!==!1,n.decoder="function"==typeof n.decoder?n.decoder:o.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:o.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:o.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:o.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:o.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:o.strictNullHandling,""===e||null===e||"undefined"==typeof e)return n.plainObjects?Object.create(null):{};for(var i="string"==typeof e?a(e,n):e,s=n.plainObjects?Object.create(null):{},c=Object.keys(i),l=0;l<c.length;++l){var f=c[l],p=u(f,i[f],n);s=r.merge(s,p,n)}return r.compact(s)}},function(e,t,n){var r=n(54),i=n(169),o=n(172),a=n(99),s=n(147),u=a(function(e,t){return null==e?{}:o(e,r(i(t,1),s))});e.exports=u},function(e,t,n){function r(e,t){var n={};return t=o(t,3),i(e,function(e,r,i){n[t(e,r,i)]=e}),n}var i=n(103),o=n(106);e.exports=r},function(e,t,n){function r(e,t){var n={};return t=o(t,3),i(e,function(e,r,i){n[r]=t(e,r,i)}),n}var i=n(103),o=n(106);e.exports=r},function(e,t){"use strict";e.exports="2.14.0"},function(e,t,n){var r=n(215),i=n(212),o=i(function(e,t,n,i){r(e,t,n,i)});e.exports=o},function(e,t,n){var r=n(169),i=n(99),o=n(317),a=n(41),s=i(function(e){return o(r(e,1,a,!0))});e.exports=s},function(e,t,n){function r(e,t,n){var r=-1,f=o,p=e.length,d=!0,h=[],m=h;if(n)d=!1,f=a;else if(p>=l){var v=t?null:u(e);if(v)return c(v);d=!1,f=s,m=new i}else m=t?[]:h;e:for(;++r<p;){var g=e[r],y=t?t(g):g;if(g=n||0!==g?g:0,d&&y===y){for(var b=m.length;b--;)if(m[b]===y)continue e;t&&m.push(y),h.push(g)}else f(m,y,n)||(m!==h&&m.push(y),h.push(g))}return h}var i=n(56),o=n(92),a=n(96),s=n(98),u=n(318),c=n(123),l=200;e.exports=r},function(e,t,n){var r=n(128),i=n(270),o=n(123),a=1/0,s=r&&1/o(new r([,-0]))[1]==a?function(e){return new r(e)}:i;e.exports=s},function(e,t,n){function r(e){return i(e,!1,!0)}var i=n(218);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){var t=e;return function(){var e=Date.now(),n=e-t;return t=e,n}}function a(e){return s()+window.location.pathname+e}function s(){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.useHash||!1,n=t?R:j;return new P(n,e)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(34),f=r(l),p=n(321),d=r(p),h=n(302),m=r(h),v=n(192),g=r(v),y=n(322),b=r(y),_=f.default.AlgoliaSearchHelper,w=d.default.split(".")[0],x=!0,R={character:"#",onpopstate:function(e){window.addEventListener("hashchange",e)},pushState:function(e){window.location.assign(a(this.createURL(e)))},replaceState:function(e){window.location.replace(a(this.createURL(e)))},createURL:function(e){return window.location.search+this.character+e},readUrl:function(){return window.location.hash.slice(1)}},j={character:"?",onpopstate:function(e){window.addEventListener("popstate",e)},pushState:function(e,t){var n=t.getHistoryState;window.history.pushState(n(),"",a(this.createURL(e)))},replaceState:function(e,t){var n=t.getHistoryState;window.history.replaceState(n(),"",a(this.createURL(e)))},createURL:function(e){return this.character+e+document.location.hash},readUrl:function(){return window.location.search.slice(1)}},P=function(){function e(t,n){i(this,e),this.urlUtils=t,this.originalConfig=null,this.timer=o(Date.now()),this.mapping=n.mapping||{},this.getHistoryState=n.getHistoryState||function(){return null},this.threshold=n.threshold||700,this.trackedParameters=n.trackedParameters||["query","attribute:*","index","page","hitsPerPage"],this.searchParametersFromUrl=_.getConfigurationFromQueryString(this.urlUtils.readUrl(),{mapping:this.mapping})}return c(e,[{key:"getConfiguration",value:function(e){return this.originalConfig=(0,f.default)({},e.index,e).state,this.searchParametersFromUrl}},{key:"render",value:function(e){var t=this,n=e.helper;x&&(x=!1,this.onHistoryChange(this.onPopState.bind(this,n)),n.on("change",function(e){return t.renderURLFromState(e)}))}},{key:"onPopState",value:function(e,t){var n=e.getState(this.trackedParameters),r=(0,b.default)({},this.originalConfig,n);(0,g.default)(r,t)||e.overrideStateWithoutTriggeringChangeEvent(t).search()}},{key:"renderURLFromState",value:function(e){var t=this.urlUtils.readUrl(),n=_.getForeignConfigurationInQueryString(t,{mapping:this.mapping});n.is_v=w;var r=m.default.getQueryStringFromState(e.filter(this.trackedParameters),{moreAttributes:n,mapping:this.mapping,safe:!0});this.timer()<this.threshold?this.urlUtils.replaceState(r,{getHistoryState:this.getHistoryState}):this.urlUtils.pushState(r,{getHistoryState:this.getHistoryState})}},{key:"createURL",value:function(e,t){var n=t.absolute,r=this.urlUtils.readUrl(),i=e.filter(this.trackedParameters),o=f.default.url.getUnrecognizedParametersInQueryString(r,{mapping:this.mapping});o.is_v=w;var s=this.urlUtils.createURL(f.default.url.getQueryStringFromState(i,{mapping:this.mapping}));return n?a(s):s}},{key:"onHistoryChange",value:function(e){var t=this;this.urlUtils.onpopstate(function(){var n=t.urlUtils.readUrl(),r=_.getConfigurationFromQueryString(n,{mapping:t.mapping}),i=(0,b.default)({},t.originalConfig,r);e(i)})}}]),e}();t.default=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="1.8.6"},function(e,t,n){var r=n(211),i=n(210),o=n(212),a=n(42),s=n(50),u=n(37),c=Object.prototype,l=c.hasOwnProperty,f=c.propertyIsEnumerable,p=!f.call({valueOf:1},"valueOf"),d=o(function(e,t){if(p||s(t)||a(t))return void i(t,u(t),e);for(var n in t)l.call(t,n)&&r(e,n,t[n])});e.exports=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.numberLocale;return{formatNumber:function(e,n){return Number(n(e)).toLocaleString(t)}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.templates,r=void 0===n?g.default:n,i=e.cssClasses,o=void 0===i?{}:i,s=e.collapsible,l=void 0!==s&&s,p=e.autoHideContainer,h=void 0===p||p,v=e.excludeAttributes,y=void 0===v?[]:v;if(!t)throw new Error(w);var x=(0,c.getContainerNode)(t),R=(0,m.default)(b.default);h===!0&&(R=(0,d.default)(R));var j={root:(0,f.default)(_(null),o.root),header:(0,f.default)(_("header"),o.header),body:(0,f.default)(_("body"),o.body),footer:(0,f.default)(_("footer"),o.footer),link:(0,f.default)(_("link"),o.link)};return{init:function(e){var t=e.helper,n=e.templatesConfig;this.clearAll=this.clearAll.bind(this,t),this._templateProps=(0,c.prepareTemplateProps)({defaultTemplates:g.default,templatesConfig:n,templates:r})},render:function(e){var t=e.results,n=e.state,r=e.createURL;this.clearAttributes=(0,c.getRefinements)(t,n).map(function(e){return e.attributeName}).filter(function(e){return y.indexOf(e)===-1});var i=0!==this.clearAttributes.length,o=r((0,c.clearRefinementsFromState)(n));u.default.render(a.default.createElement(R,{clearAll:this.clearAll,collapsible:l,cssClasses:j,hasRefinements:i,shouldAutoHideContainer:!i,templateProps:this._templateProps,url:o}),x)},clearAll:function(e){this.clearAttributes.length>0&&(0,c.clearRefinementsAndSearch)(e,this.clearAttributes)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(339),g=r(v),y=n(340),b=r(y),_=(0,c.bemHelper)("ais-clear-all"),w="Usage:\nclearAll({\n container,\n [ cssClasses.{root,header,body,footer,link}={} ],\n [ templates.{header,link,footer}={link: 'Clear all'} ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ excludeAttributes=[] ]\n})";t.default=i},function(e,t,n){(function(t){!function(t,r){e.exports=r(n(326),n(327))}(this,function(e,n){function r(e,t,r){var i=t._preactCompatRendered;i&&i.parentNode!==t&&(i=null),i||(i=t.children[0]);for(var o=t.childNodes.length;o--;)t.childNodes[o]!==i&&t.removeChild(t.childNodes[o]);var a=n.render(e,t,i);return t._preactCompatRendered=a,"function"==typeof r&&r(),a&&a._component||a.base}function i(e,t,i,o){var a=n.h(I,{context:e.context},t),s=r(a,i);return o&&o(s),s}function o(e){var t=e._preactCompatRendered;return!(!t||t.parentNode!==e)&&(n.render(n.h(L),e,t),!0)}function a(e){return f.bind(null,e)}function s(e,t){for(var n=t||0;n<e.length;n++){var r=e[n];Array.isArray(r)?s(r):r&&"object"==typeof r&&!h(r)&&(r.props&&r.type||r.attributes&&r.nodeName||r.children)&&(e[n]=f(r.type||r.nodeName,r.props||r.attributes,r.children))}}function u(e){return"function"==typeof e&&!(e.prototype&&e.prototype.render)}function c(e){return function(t,n){return O.call(e,t,n),e(t,n)}}function l(e){var t=e[W];return t?t===!0?e:t:(t=c(e),Object.defineProperty(t,W,{configurable:!0,value:!0}),t.displayName=e.displayName,t.propTypes=e.propTypes,t.defaultProps=e.defaultProps,Object.defineProperty(e,W,{configurable:!0,value:t}),t)}function f(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return s(e,2),p(n.h.apply(void 0,e))}function p(e){g(e),u(e.nodeName)&&(e.nodeName=l(e.nodeName));var t=e.attributes&&e.attributes.ref,n=t&&typeof t;return!V||"string"!==n&&"number"!==n||(e.attributes.ref=m(t,V)),v(e),e}function d(e,t){for(var r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];var o=n.h(e.nodeName||e.type,e.attributes||e.props,e.children||e.props.children);return p(n.cloneElement.apply(void 0,[o,t].concat(r)))}function h(e){return e&&(e instanceof U||e.$$typeof===T)}function m(e,t){return t._refProxies[e]||(t._refProxies[e]=function(n){t&&t.refs&&(t.refs[e]=n,null===n&&(delete t._refProxies[e],t=null))})}function v(e){var t=e.nodeName,n=e.attributes;if(n&&"string"==typeof t){var r={};for(var i in n)r[i.toLowerCase()]=i;if(r.onchange){t=t.toLowerCase();var o="select"===t?"onchange":"oninput";"input"===t&&"checkbox"===String(n.type).toLowerCase()&&(o="onclick"),n[r[o]||o]=P(n[r[o]],n[r.onchange])}}}function g(e){var t=e.attributes;if(t){var n=t.className||t.class;n&&(t.className=n)}}function y(e,t,n){for(var r in t)n!==!0&&null==t[r]||(e[r]=t[r]);return e}function b(){}function _(e){function t(t,r){y(this,e),n&&x(this,n),F.call(this,t,r,M),R(this),C.call(this,t,r)}var n=e.mixins&&w(e.mixins);return e.statics&&y(t,e.statics),e.propTypes&&(t.propTypes=e.propTypes),e.defaultProps&&(t.defaultProps=e.defaultProps),e.getDefaultProps&&(t.defaultProps=e.getDefaultProps()),b.prototype=F.prototype,t.prototype=new b,t.prototype.constructor=t,t.displayName=e.displayName||"Component",t}function w(e){for(var t={},n=0;n<e.length;n++){var r=e[n];for(var i in r)r.hasOwnProperty(i)&&"function"==typeof r[i]&&(t[i]||(t[i]=[])).push(r[i])}return t}function x(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=P.apply(void 0,t[n].concat(e[n]||n)))}function R(e){for(var t in e){var n=e[t];"function"!=typeof n||n.__bound||A.hasOwnProperty(t)||((e[t]=n.bind(e)).__bound=!0)}}function j(e,t,n){if("string"==typeof t&&(t=e.constructor.prototype[t]),"function"==typeof t)return t.apply(e,n)}function P(){var e=arguments;return function(){for(var t,n=arguments,r=this,i=0;i<e.length;i++){var o=j(r,e[i],n);void 0!==o&&(t=o)}return t}}function C(e,t){O.call(this,e,t),this.componentWillReceiveProps=P(this.componentWillReceiveProps||"componentWillReceiveProps",O),this.render=P(S,this.render||"render",E)}function O(e,t){var n=this;if(e){var r=e.children;if(r&&1===r.length&&(e.children=r[0],e.children&&"object"==typeof e.children&&(e.children.length=1,e.children[0]=e.children)),H){var i="function"==typeof this?this:this.constructor,o=this.propTypes||i.propTypes;if(o)for(var a in o)if(o.hasOwnProperty(a)&&"function"==typeof o[a]){var s=n.displayName||i.name,u=o[a](e,a,s,"prop");u&&console.error(new Error(u.message||u))}}}}function S(){V=this}function E(){V===this&&(V=null)}function F(e,t,r){n.Component.call(this,e,t),this.refs={},this._refProxies={},r!==M&&C.call(this,e,t)}e="default"in e?e.default:e;var k="15.1.0",N="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr circle clipPath defs ellipse g image line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),T="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,A={constructor:1,render:1,shouldComponentUpdate:1,componentWillReceiveProps:1,componentWillUpdate:1,componentDidUpdate:1,componentWillMount:1,componentDidMount:1,componentWillUnmount:1,componentDidUnmount:1},M={},H="undefined"!=typeof t&&{NODE_ENV:"production"}&&!1,L=function(){return null},U=n.h("").constructor;U.prototype.$$typeof=T,Object.defineProperty(U.prototype,"type",{get:function(){return this.nodeName},set:function(e){this.nodeName=e},configurable:!0}),Object.defineProperty(U.prototype,"props",{get:function(){return this.attributes},set:function(e){this.attributes=e},configurable:!0});var D=n.options.vnode||L;n.options.vnode=function(e){var t=e.attributes;t||(t=e.attributes={}),Object.isExtensible&&!Object.isExtensible(t)&&(t=y({},t,!0)),t.children=e.children,D(e)};var I=function(){};I.prototype.getChildContext=function(){return this.props.context},I.prototype.render=function(e){return e.children[0]};for(var V,q=[],B={map:function(e,t,n){return e=B.toArray(e),n&&n!==e&&(t=t.bind(n)),e.map(t)},forEach:function(e,t,n){e=B.toArray(e),n&&n!==e&&(t=t.bind(n)),e.forEach(t)},count:function(e){return e=B.toArray(e),e.length},only:function(e){if(e=B.toArray(e),1!==e.length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:function(e){return Array.isArray&&Array.isArray(e)?e:q.concat(e)}},Q={},z=N.length;z--;)Q[N[z]]=a(N[z]);var W="undefined"!=typeof Symbol?Symbol.for("__preactCompatWrapper"):"__preactCompatWrapper",K=function(e){return e&&e.base||e};F.prototype=new n.Component,y(F.prototype,{constructor:F,isReactComponent:{},getDOMNode:function(){return this.base},isMounted:function(){return!!this.base}});var $={version:k,DOM:Q,PropTypes:e,Children:B,render:r,createClass:_,createFactory:a,createElement:f,cloneElement:d,isValidElement:h,findDOMNode:K,unmountComponentAtNode:o,Component:F,unstable_renderSubtreeIntoContainer:i};return $})}).call(t,n(24))},function(e,t,n){var r,i,o;!function(n,a){i=[t,e],r=a,o="function"==typeof r?r.apply(t,i):r,!(void 0!==o&&(e.exports=o))}(this,function(e,t){"use strict";function n(e){var t=e&&(x&&e[x]||e[R]);if("function"==typeof t)return t}function r(e){function t(t,n,r,i,o,a){if(i=i||j,a=a||r,null==n[r]){var s=_[o];return t?new Error("Required "+s+" `"+a+"` was not specified in "+("`"+i+"`.")):null}return e(n,r,i,o,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if(s!==e){var u=_[i],c=v(a);return new Error("Invalid "+u+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function o(){return r(w.thatReturns(null))}function a(e){function t(t,n,r,i,o){var a=t[n];if(!Array.isArray(a)){var s=_[i],u=m(a);return new Error("Invalid "+s+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,i,o+"["+c+"]");if(l instanceof Error)return l}return null}return r(t)}function s(){function e(e,t,n,r,i){if(!b.isValidElement(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function u(e){function t(t,n,r,i,o){if(!(t[n]instanceof e)){var a=_[i],s=e.name||j,u=g(t[n]);return new Error("Invalid "+a+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected ")+("instance of `"+s+"`."))}return null}return r(t)}function c(e){function t(t,n,r,i,o){for(var a=t[n],s=0;s<e.length;s++)if(a===e[s])return null;var u=_[i],c=JSON.stringify(e);return new Error("Invalid "+u+" `"+o+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+c+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function l(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=_[i];return new Error("Invalid "+u+" `"+o+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an object."))}for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,i,o+"."+c);if(l instanceof Error)return l}return null}return r(t)}function f(e){function t(t,n,r,i,o){for(var a=0;a<e.length;a++){var s=e[a];if(null==s(t,n,r,i,o))return null}var u=_[i];return new Error("Invalid "+u+" `"+o+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function p(){function e(e,t,n,r,i){if(!h(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function d(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=_[i];return new Error("Invalid "+u+" `"+o+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var l=e[c];if(l){var f=l(a,c,r,i,o+"."+c);if(f)return f}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||b.isValidElement(e))return!0;var t=n(e);if(!t)return!1;var r,i=t.call(e);if(t!==e.entries){for(;!(r=i.next()).done;)if(!h(r.value))return!1}else for(;!(r=i.next()).done;){var o=r.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:j}var y="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,b={};b.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===y};var _={prop:"prop",context:"context",childContext:"child context"},w={thatReturns:function(e){return function(){return e}}},x="function"==typeof Symbol&&Symbol.iterator,R="@@iterator",j="<<anonymous>>",P={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),any:o(),arrayOf:a,element:s(),instanceOf:u,node:p(),objectOf:l,oneOf:c,oneOfType:f,shape:d};t.exports=P})},function(e,t,n){!function(e,n){n(t)}(this,function(e){function t(e,t,n){this.nodeName=e,this.attributes=t,this.children=n,this.key=t&&t.key}function n(e,t){if(t)for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}function r(e){return n({},e)}function i(e,t){for(var n=t.split("."),r=0;r<n.length&&e;r++)e=e[n[r]];return e}function o(e,t){return[].slice.call(e,t)}function a(e){return"function"==typeof e}function s(e){return"string"==typeof e}function u(e){return void 0===e||null===e}function c(e){return e===!1||u(e)}function l(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function f(e,n,r){var i,o,u,p=arguments.length;if(p>2){var d=typeof r;if(3===p&&"object"!==d&&"function"!==d)c(r)||(i=[String(r)]);else{i=[];for(var h=2;h<p;h++){var m=arguments[h];if(!c(m)){m.join?o=m:(o=Y)[0]=m;for(var v=0;v<o.length;v++){var g=o[v],y=!(c(g)||a(g)||g instanceof t);y&&!s(g)&&(g=String(g)),y&&u?i[i.length-1]+=g:c(g)||(i.push(g),u=y)}}}}}else if(n&&n.children)return f(e,n,n.children);n&&(n.children&&delete n.children,a(e)||("className"in n&&(n.class=n.className,delete n.className),u=n.class,u&&!s(u)&&(n.class=l(u))));var b=new t(e,n||void 0,i);return K.vnode&&K.vnode(b),b}function p(e,t){return f(e.nodeName,n(r(e.attributes),t),arguments.length>2?o(arguments,2):e.children)}function d(e,t,n){var r=t.split("."),o=r[0];return function(t){var a,u,c,l=t&&t.currentTarget||this,f=e.state,p=f;if(u=s(n)?i(t,n):l.nodeName?(l.nodeName+l.type).match(/^input(check|rad)/i)?l.checked:l.value:t,r.length>1){for(c=0;c<r.length-1;c++)p=p[r[c]]||(p[r[c]]={});p[r[c]]=u,u=f[o]}e.setState((a={},a[o]=u,a))}}function h(e){1===re.push(e)&&(K.debounceRendering||X)(m)}function m(){if(re.length){var e,t=re;for(re=ie,ie=t;e=t.pop();)e._dirty&&q(e)}}function v(e){var t=e&&e.nodeName;return t&&a(t)&&!(t.prototype&&t.prototype.render)}function g(e,t){return e.nodeName(O(e),t||Z)}function y(e,t){return e[ee]||(e[ee]=t||{})}function b(e){return e instanceof Text?3:e instanceof Element?1:0}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function w(e,t,n,r,i){if(y(e)[t]=n,"key"!==t&&"children"!==t&&"innerHTML"!==t)if("class"!==t||i)if("style"===t){if((!n||s(n)||s(r))&&(e.style.cssText=n||""),n&&"object"==typeof n){if(!s(r))for(var o in r)o in n||(e.style[o]="");for(var o in n)e.style[o]="number"!=typeof n[o]||te[o]?n[o]:n[o]+"px"}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html);else if("o"==t[0]&&"n"==t[1]){var l=e._listeners||(e._listeners={});t=J(t.substring(2)),n?l[t]||e.addEventListener(t,R,!!ne[t]):l[t]&&e.removeEventListener(t,R,!!ne[t]),l[t]=n}else if("type"!==t&&!i&&t in e)x(e,t,u(n)?"":n),c(n)&&e.removeAttribute(t);else{var f=i&&t.match(/^xlink\:?(.+)/);c(n)?f?e.removeAttributeNS("http://www.w3.org/1999/xlink",J(f[1])):e.removeAttribute(t):"object"==typeof n||a(n)||(f?e.setAttributeNS("http://www.w3.org/1999/xlink",J(f[1]),n):e.setAttribute(t,n))}else e.className=n||""}function x(e,t,n){try{e[t]=n}catch(e){}}function R(e){return this._listeners[e.type](K.event&&K.event(e)||e)}function j(e){for(var t={},n=e.attributes.length;n--;)t[e.attributes[n].name]=e.attributes[n].value;return t}function P(e,t){return s(t)?3===b(e):s(t.nodeName)?C(e,t.nodeName):a(t.nodeName)?e._componentConstructor===t.nodeName||v(t):void 0}function C(e,t){return e.normalizedNodeName===t||J(e.nodeName)===J(t)}function O(e){var t=e.nodeName.defaultProps,i=r(t||e.attributes);return t&&n(i,e.attributes),e.children&&(i.children=e.children),i}function S(e){if(_(e),1===b(e)){F(e);var t=J(e.nodeName),n=oe[t];n?n.push(e):oe[t]=[e]}}function E(e,t){var n=J(e),r=oe[n]&&oe[n].pop()||(t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e));return y(r),r.normalizedNodeName=n,r}function F(e){y(e,j(e)),e._component=e._componentConstructor=null}function k(){for(var e;e=ae.pop();)e.componentDidMount&&e.componentDidMount()}function N(e,t,n,r,i,o){se++;var a=T(e,t,n,r,o);return i&&a.parentNode!==i&&i.appendChild(a),--se||k(),a}function T(e,t,n,r,i){for(var o=t&&t.attributes;v(t);)t=g(t,n);if(u(t)&&(t="",i)){if(e){if(8===e.nodeType)return e;H(e)}return document.createComment(t)}if(s(t)){if(e){if(3===b(e)&&e.parentNode)return e.nodeValue=t,e;H(e)}return document.createTextNode(t)}var c=e,l=t.nodeName,f=ue;if(a(l))return B(e,t,n,r);if(s(l)||(l=String(l)),ue="svg"===l||"foreignObject"!==l&&ue,e){if(!C(e,l)){for(c=E(l,ue);e.firstChild;)c.appendChild(e.firstChild); H(e)}}else c=E(l,ue);return t.children&&1===t.children.length&&"string"==typeof t.children[0]&&1===c.childNodes.length&&c.firstChild instanceof Text?c.firstChild.nodeValue=t.children[0]:(t.children||c.firstChild)&&A(c,t.children,n,r),L(c,t.attributes),o&&o.ref&&(c[ee].ref=o.ref)(c),ue=f,c}function A(e,t,n,r){var i,o,s,c,l=e.childNodes,f=[],p={},d=0,h=0,m=l.length,v=0,g=t&&t.length;if(m)for(var y=0;y<m;y++){var b=l[y],_=g?(o=b._component)?o.__key:(o=b[ee])?o.key:null:null;_||0===_?(d++,p[_]=b):f[v++]=b}if(g)for(var y=0;y<g;y++){s=t[y],c=null;var _=s.key;if(u(_)){if(!c&&h<v){for(i=h;i<v;i++)if(o=f[i],o&&P(o,s)){c=o,f[i]=void 0,i===v-1&&v--,i===h&&h++;break}!c&&h<v&&a(s.nodeName)&&r&&(c=f[h],f[h++]=void 0)}}else d&&_ in p&&(c=p[_],p[_]=void 0,d--);c=T(c,s,n,r),c!==l[y]&&e.insertBefore(c,l[y]||null)}if(d)for(var y in p)p[y]&&(f[h=v++]=p[y]);h<v&&M(f)}function M(e,t){for(var n=e.length;n--;){var r=e[n];r&&H(r,t)}}function H(e,t){var n=e._component;n?Q(n,!t):(e[ee]&&e[ee].ref&&e[ee].ref(null),t||S(e),e.childNodes&&e.childNodes.length&&M(e.childNodes,t))}function L(e,t){var n=e[ee]||j(e);for(var r in n)t&&r in t||w(e,r,null,n[r],ue);if(t)for(var i in t)i in n&&t[i]==n[i]&&("value"!==i&&"checked"!==i||t[i]==e[i])||w(e,i,t[i],n[i],ue)}function U(e){var t=e.constructor.name,n=ce[t];n?n.push(e):ce[t]=[e]}function D(e,t,n){var r=new e(t,n),i=ce[e.name];if(r.props=t,r.context=n,i)for(var o=i.length;o--;)if(i[o].constructor===e){r.nextBase=i[o].nextBase,i.splice(o,1);break}return r}function I(e){e._dirty||(e._dirty=!0,h(e))}function V(e,t,n,r,i){var o=e.base;e._disableRendering||(e._disableRendering=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,u(o)||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disableRendering=!1,0!==n&&(1!==n&&K.syncComponentUpdates===!1&&o?I(e):q(e,1,i)),e.__ref&&e.__ref(e))}function q(e,t,i){if(!e._disableRendering){var o,s,u=e.props,c=e.state,l=e.context,f=e.prevProps||u,p=e.prevState||c,d=e.prevContext||l,h=e.base,m=h||e.nextBase,y=e._component;if(h&&(e.props=f,e.state=p,e.context=d,2!==t&&e.shouldComponentUpdate&&e.shouldComponentUpdate(u,c,l)===!1?o=!0:e.componentWillUpdate&&e.componentWillUpdate(u,c,l),e.props=u,e.state=c,e.context=l),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!o){for(e.render&&(s=e.render(u,c,l)),e.getChildContext&&(l=n(r(l),e.getChildContext()));v(s);)s=g(s,l);var b,_,w=s&&s.nodeName;if(a(w)&&w.prototype.render){var x=y,R=O(s);x&&x.constructor===w?V(x,R,1,l):(b=x,x=D(w,R,l),x.nextBase=x.nextBase||i&&m,x._parentComponent=e,e._component=x,V(x,R,0,l),q(x,1)),_=x.base}else{var j=m;b=y,b&&(j=e._component=null),(m||1===t)&&(j&&(j._component=null),_=N(j,s,l,i||!h,m&&m.parentNode,!0))}if(m&&_!==m){var P=m.parentNode;P&&_!==P&&P.replaceChild(_,m),!b&&e._parentComponent&&(m._component=null,H(m))}if(b&&Q(b,!0),e.base=_,_){for(var C=e,S=e;S=S._parentComponent;)C=S;_._component=C,_._componentConstructor=C.constructor}}!h||i?(ae.unshift(e),se||k()):!o&&e.componentDidUpdate&&e.componentDidUpdate(f,p,d);var E,F=e._renderCallbacks;if(F)for(;E=F.pop();)E.call(e);return s}}function B(e,t,n,r){for(var i=e&&e._component,o=e,a=i&&e._componentConstructor===t.nodeName,s=a,u=O(t);i&&!s&&(i=i._parentComponent);)s=i.constructor===t.nodeName;return!s||r&&!i._component?(i&&!a&&(Q(i,!0),e=o=null),i=D(t.nodeName,u,n),e&&!i.nextBase&&(i.nextBase=e),V(i,u,1,n,r),e=i.base,o&&e!==o&&(o._component=null,H(o))):(V(i,u,3,n,r),e=i.base),e}function Q(e,t){var n=e.base;e._disableRendering=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?Q(r,t):n&&(n[ee]&&n[ee].ref&&n[ee].ref(null),e.nextBase=n,t&&(_(n),U(e)),M(n.childNodes,!t)),e.__ref&&e.__ref(null),e.componentDidUnmount&&e.componentDidUnmount()}function z(e,t){this._dirty=!0,this._disableRendering=!1,this.prevState=this.prevProps=this.prevContext=this.base=this.nextBase=this._parentComponent=this._component=this.__ref=this.__key=this._linkedStates=this._renderCallbacks=null,this.context=t,this.props=e,this.state=this.getInitialState&&this.getInitialState()||{}}function W(e,t,n){return N(n,e,{},!1,t)}var K={},$={},J=function(e){return $[e]||($[e]=e.toLowerCase())},G="undefined"!=typeof Promise&&Promise.resolve(),X=G?function(e){G.then(e)}:setTimeout,Y=[],Z={},ee="undefined"!=typeof Symbol?Symbol.for("preactattr"):"__preactattr_",te={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},ne={blur:1,error:1,focus:1,load:1,resize:1,scroll:1},re=[],ie=[],oe={},ae=[],se=0,ue=!1,ce={};n(z.prototype,{linkState:function(e,t){var n=this._linkedStates||(this._linkedStates={}),r=e+"|"+t;return n[r]||(n[r]=d(this,e,t))},setState:function(e,t){var i=this.state;this.prevState||(this.prevState=r(i)),n(i,a(e)?e(i,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),I(this)},forceUpdate:function(){q(this,2)},render:function(){return null}}),e.h=f,e.cloneElement=p,e.Component=z,e.render=W,e.rerender=m,e.options=K})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){var t="string"==typeof e,n=void 0;if(n=t?document.querySelector(e):e,!a(n)){var r="Container must be `string` or `HTMLElement`.";throw t&&(r+=" Unable to find "+e),new Error(r)}return n}function a(e){return e instanceof window.HTMLElement||Boolean(e)&&e.nodeType>0}function s(e){var t=1===e.button;return t||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function u(e){return function(t,n){return t&&!n?e+"--"+t:t&&n?e+"--"+t+"__"+n:!t&&n?e+"__"+n:e}}function c(e){var t=e.transformData,n=e.defaultTemplates,r=e.templates,i=e.templatesConfig,o=l(n,r);return v({transformData:t,templatesConfig:i},o)}function l(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=(0,F.default)([].concat(i((0,S.default)(e)),i((0,S.default)(t))));return(0,y.default)(n,function(n,r){var i=e[r],o=t[r],a=void 0!==o&&o!==i;return n.templates[r]=a?o:i,n.useCustomCompileOptions[r]=a,n},{templates:{},useCustomCompileOptions:{}})}function f(e,t,n,r,i){var o={type:t,attributeName:n,name:r},a=(0,x.default)(i,{name:n}),s=void 0;if("hierarchical"===t){var u=e.getHierarchicalFacetByName(n),c=r.split(u.separator);o.name=c[c.length-1];for(var l=0;void 0!==a&&l<c.length;++l)a=(0,x.default)(a.data,{name:c[l]});s=(0,j.default)(a,"count")}else s=(0,j.default)(a,'data["'+o.name+'"]');var f=(0,j.default)(a,"exhaustive");return void 0!==s&&(o.count=s),void 0!==f&&(o.exhaustive=f),o}function p(e,t){var n=[];return(0,_.default)(t.facetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"facet",i,r,e.facets))})}),(0,_.default)(t.facetsExcludes,function(e,t){(0,_.default)(e,function(e){n.push({type:"exclude",attributeName:t,name:e,exclude:!0})})}),(0,_.default)(t.disjunctiveFacetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"disjunctive",i,r,e.disjunctiveFacets))})}),(0,_.default)(t.hierarchicalFacetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"hierarchical",i,r,e.hierarchicalFacets))})}),(0,_.default)(t.numericRefinements,function(e,t){(0,_.default)(e,function(e,r){(0,_.default)(e,function(e){n.push({type:"numeric",attributeName:t,name:""+e,numericValue:e,operator:r})})})}),(0,_.default)(t.tagRefinements,function(e){n.push({type:"tag",attributeName:"_tags",name:e})}),n}function d(e,t){var n=e;return(0,C.default)(t)?(n=n.clearTags(),n=n.clearRefinements()):((0,_.default)(t,function(e){n="_tags"===e?n.clearTags():n.clearRefinements(e)}),n)}function h(e,t){e.setState(d(e.state,t)).search()}function m(e,t){if(t)return(0,N.default)(t,function(t,n){return e+n})}Object.defineProperty(t,"__esModule",{value:!0}),t.prefixKeys=t.clearRefinementsAndSearch=t.clearRefinementsFromState=t.getRefinements=t.isDomElement=t.isSpecialClick=t.prepareTemplateProps=t.bemHelper=t.getContainerNode=void 0;var v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=n(164),y=r(g),b=n(155),_=r(b),w=n(195),x=r(w),R=n(138),j=r(R),P=n(189),C=r(P),O=n(37),S=r(O),E=n(329),F=r(E),k=n(312),N=r(k);t.getContainerNode=o,t.bemHelper=u,t.prepareTemplateProps=c,t.isSpecialClick=s,t.isDomElement=a,t.getRefinements=p,t.clearRefinementsFromState=d,t.clearRefinementsAndSearch=h,t.prefixKeys=m},function(e,t,n){function r(e){return e&&e.length?i(e):[]}var i=n(317);e.exports=r},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===i)for(var a in r)o.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],i=function(){return n}.apply(t,r),!(void 0!==i&&(e.exports=i)))}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(){return i(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return a(n,t),u(n,[{key:"componentDidMount",value:function(){this._hideOrShowContainer(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.props.shouldAutoHideContainer!==e.shouldAutoHideContainer&&this._hideOrShowContainer(e)}},{key:"shouldComponentUpdate",value:function(e){return e.shouldAutoHideContainer===!1}},{key:"_hideOrShowContainer",value:function(e){var t=p.default.findDOMNode(this).parentNode;t.style.display=e.shouldAutoHideContainer===!0?"none":""}},{key:"render",value:function(){return l.default.createElement(e,this.props)}}]),n}(l.default.Component);return t.displayName=e.name+"-AutoHide",t}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(325),p=r(f);t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.handleHeaderClick=t.handleHeaderClick.bind(t),t.state={collapsed:e.collapsible&&e.collapsible.collapsed},t._cssClasses={root:(0,d.default)("ais-root",t.props.cssClasses.root),body:(0,d.default)("ais-body",t.props.cssClasses.body)},t._footerElement=t._getElement({type:"footer"}),t}return a(n,t),c(n,[{key:"_getElement",value:function(e){var t=e.type,n=e.handleClick,r=void 0===n?null:n,i=this.props.templateProps.templates;if(!i||!i[t])return null;var o=(0,d.default)(this.props.cssClasses[t],"ais-"+t),a=(0,m.default)(this.props,"headerFooterData."+t);return f.default.createElement(g.default,u({},this.props.templateProps,{data:a,rootProps:{className:o,onClick:r},templateKey:t,transformData:null}))}},{key:"handleHeaderClick",value:function(){this.setState({collapsed:!this.state.collapsed})}},{key:"render",value:function(){var t=[this._cssClasses.root];this.props.collapsible&&t.push("ais-root__collapsible"),this.state.collapsed&&t.push("ais-root__collapsed");var n=u({},this._cssClasses,{root:(0,d.default)(t)}),r=this._getElement({type:"header",handleClick:this.props.collapsible?this.handleHeaderClick:null});return f.default.createElement("div",{className:n.root},r,f.default.createElement("div",{className:n.body},f.default.createElement(e,this.props)),this._footerElement)}}]),n}(f.default.Component);return t.defaultProps={cssClasses:{},collapsible:!1},t.displayName=e.name+"-HeaderFooter",t}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(330),d=r(p),h=n(138),m=r(h),v=n(333),g=r(v);t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t,n){if(!e)return n;var r=(0,y.default)(n),i=void 0,o="undefined"==typeof e?"undefined":l(e);if("function"===o)i=e(r);else{if("object"!==o)throw new Error("transformData must be a function or an object, was "+o+" (key : "+t+")");i=e[t]?e[t](r):n}var a="undefined"==typeof i?"undefined":l(i),s="undefined"==typeof n?"undefined":l(n);if(a!==s)throw new Error("`transformData` must return a `"+s+"`, got `"+a+"`.");return i}function u(e){var t=e.templates,n=e.templateKey,r=e.compileOptions,i=e.helpers,o=e.data,a=t[n],s="undefined"==typeof a?"undefined":l(a),u="string"===s,p="function"===s;if(u||p){if(p)return a(o);var d=c(i,r,o),h=f({},o,{helpers:d});return x.default.compile(a,r).render(h)}throw new Error("Template must be 'string' or 'function', was '"+s+"' (key: "+n+")")}function c(e,t,n){return(0,_.default)(e,function(e){return(0,v.default)(function(r){var i=this,o=function(e){return x.default.compile(e,t).render(i)};return e.call(n,r,o)})})}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(325),h=r(d),m=n(334),v=r(m),g=n(335),y=r(g),b=n(313),_=r(b),w=n(336),x=r(w),R=n(192),j=r(R),P=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),p(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,j.default)(this.props.data,e.data)||this.props.templateKey!==e.templateKey}},{key:"render",value:function(){var e=this.props.useCustomCompileOptions[this.props.templateKey],t=e?this.props.templatesConfig.compileOptions:{},n=u({templates:this.props.templates,templateKey:this.props.templateKey,compileOptions:t,helpers:this.props.templatesConfig.helpers,data:s(this.props.transformData,this.props.templateKey,this.props.data)});return null===n?null:h.default.isValidElement(n)?h.default.createElement("div",this.props.rootProps,n):h.default.createElement("div",f({},this.props.rootProps,{dangerouslySetInnerHTML:{__html:n}}))}}]),t}(h.default.Component);P.defaultProps={data:{},useCustomCompileOptions:{},templates:{},templatesConfig:{}},t.default=P},function(e,t,n){function r(e,t,n){t=n?void 0:t;var a=i(e,o,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=r.placeholder,a}var i=n(255),o=8;r.placeholder={},e.exports=r},function(e,t,n){function r(e){return i(e,!0,!0)}var i=n(218);e.exports=r},function(e,t,n){var r=n(337);r.Template=n(338).Template,r.template=r.Template,e.exports=r},function(e,t,n){!function(e){function t(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function n(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function r(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r<i;r++)if(t.charAt(n+r)!=e.charAt(r))return!1;return!0}function i(t,n,r,s){var u=[],c=null,l=null,f=null;for(l=r[r.length-1];t.length>0;){if(f=t.shift(),l&&"<"==l.tag&&!(f.tag in w))throw new Error("Illegal content in < super tag.");if(e.tags[f.tag]<=e.tags.$||o(f,s))r.push(f),f.nodes=i(t,f.tag,r,s);else{if("/"==f.tag){if(0===r.length)throw new Error("Closing tag without opener: /"+f.n);if(c=r.pop(),f.n!=c.n&&!a(f.n,c.n,s))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==t.length||"\n"==t[0].tag)}u.push(f)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return u}function o(e,t){for(var n=0,r=t.length;n<r;n++)if(t[n].o==e.n)return e.tag="#",!0}function a(e,t,n){for(var r=0,i=n.length;r<i;r++)if(n[r].c==e&&n[r].o==t)return!0}function s(e){var t=[];for(var n in e)t.push('"'+c(n)+'": function(c,p,t,i) {'+e[n]+"}");return"{ "+t.join(",")+" }"}function u(e){var t=[];for(var n in e.partials)t.push('"'+c(n)+'":{name:"'+c(e.partials[n].name)+'", '+u(e.partials[n])+"}");return"partials: {"+t.join(",")+"}, subs: "+s(e.subs)}function c(e){return e.replace(y,"\\\\").replace(m,'\\"').replace(v,"\\n").replace(g,"\\r").replace(b,"\\u2028").replace(_,"\\u2029")}function l(e){return~e.indexOf(".")?"d":"f"}function f(e,t){var n="<"+(t.prefix||""),r=n+e.n+x++;return t.partials[r]={name:e.n,partials:{}},t.code+='t.b(t.rp("'+c(r)+'",c,p,"'+(e.indent||"")+'"));',r}function p(e,t){t.code+="t.b(t.t(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'}function d(e){return"t.b("+e+");"}var h=/\S/,m=/\"/g,v=/\n/g,g=/\r/g,y=/\\/g,b=/\u2028/,_=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(i,o){function a(){y.length>0&&(b.push({tag:"_t",text:new String(y)}),y="")}function s(){for(var t=!0,n=x;n<b.length;n++)if(t=e.tags[b[n].tag]<e.tags._v||"_t"==b[n].tag&&null===b[n].text.match(h),!t)return!1;return t}function u(e,t){if(a(),e&&s())for(var n,r=x;r<b.length;r++)b[r].text&&((n=b[r+1])&&">"==n.tag&&(n.indent=b[r].text.toString()),b.splice(r,1));else t||b.push({tag:"\n"});_=!1,x=b.length}function c(e,t){var r="="+j,i=e.indexOf(r,t),o=n(e.substring(e.indexOf("=",t)+1,i)).split(" ");return R=o[0],j=o[o.length-1],i+r.length-1}var l=i.length,f=0,p=1,d=2,m=f,v=null,g=null,y="",b=[],_=!1,w=0,x=0,R="{{",j="}}";for(o&&(o=o.split(" "),R=o[0],j=o[1]),w=0;w<l;w++)m==f?r(R,i,w)?(--w,a(),m=p):"\n"==i.charAt(w)?u(_):y+=i.charAt(w):m==p?(w+=R.length-1,g=e.tags[i.charAt(w+1)],v=g?i.charAt(w+1):"_v","="==v?(w=c(i,w),m=f):(g&&w++,m=d),_=w):r(j,i,w)?(b.push({tag:v,n:n(y),otag:R,ctag:j,i:"/"==v?_-R.length:w+j.length}),y="",w+=j.length-1,m=f,"{"==v&&("}}"==j?w++:t(b[b.length-1]))):y+=i.charAt(w);return u(_,!0),b};var w={_t:!0,"\n":!0,$:!0,"/":!0};e.stringify=function(t,n,r){return"{code: function (c,p,i) { "+e.wrapMain(t.code)+" },"+u(t)+"}"};var x=0;e.generate=function(t,n,r){x=0;var i={code:"",subs:{},partials:{}};return e.walk(t,i),r.asString?this.stringify(i,n,r):this.makeTemplate(i,n,r)},e.wrapMain=function(e){return'var t=this;t.b(i=i||"");'+e+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(e,t,n){var r=this.makePartials(e);return r.code=new Function("c","p","i",this.wrapMain(e.code)),new this.template(r,t,this,n)},e.makePartials=function(e){var t,n={subs:{},partials:e.partials,name:e.name};for(t in n.partials)n.partials[t]=this.makePartials(n.partials[t]);for(t in e.subs)n.subs[t]=new Function("c","p","t","i",e.subs[t]);return n},e.codegen={"#":function(t,n){n.code+="if(t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,0,'+t.i+","+t.end+',"'+t.otag+" "+t.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(t.nodes,n),n.code+="});c.pop();}"},"^":function(t,n){n.code+="if(!t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(t.nodes,n),n.code+="};"},">":f,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[f(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+c(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=d('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=d('"'+c(e.text)+'"')},"{":p,"&":p},e.walk=function(t,n){for(var r,i=0,o=t.length;i<o;i++)r=e.codegen[t[i].tag],r&&r(t[i],n);return n},e.parse=function(e,t,n){return n=n||{},i(e,"",[],n.sectionTags||[])},e.cache={},e.cacheKey=function(e,t){return[e,!!t.asString,!!t.disableLambda,t.delimiters,!!t.modelGet].join("||")},e.compile=function(t,n){n=n||{};var r=e.cacheKey(t,n),i=this.cache[r];if(i){var o=i.partials;for(var a in o)delete o[a].instance;return i}return i=this.generate(this.parse(this.scan(t,n.delimiters),t,n),t,n),this.cache[r]=i}}(t)},function(e,t,n){!function(e){function t(e,t,n){var r;return t&&"object"==typeof t&&(void 0!==t[e]?r=t[e]:n&&t.get&&"function"==typeof t.get&&(r=t.get(e))),r}function n(e,t,n,r,i,o){function a(){}function s(){}a.prototype=e,s.prototype=e.subs;var u,c=new a;c.subs=new s,c.subsText={},c.buf="",r=r||{},c.stackSubs=r,c.subsText=o;for(u in t)r[u]||(r[u]=t[u]);for(u in r)c.subs[u]=r[u];i=i||{},c.stackPartials=i;for(u in n)i[u]||(i[u]=n[u]);for(u in i)c.partials[u]=i[u];return c}function r(e){return String(null===e||void 0===e?"":e)}function i(e){return e=r(e),l.test(e)?e.replace(o,"&amp;").replace(a,"&lt;").replace(s,"&gt;").replace(u,"&#39;").replace(c,"&quot;"):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:i,t:r,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;if(this.partials[e].base=i,r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=void 0!==this.activeSub&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!f(r))return void n(e,t,this);for(var i=0;i<r.length;i++)e.push(r[i]),n(e,t,this),e.pop()},s:function(e,t,n,r,i,o,a){var s;return(!f(e)||0!==e.length)&&("function"==typeof e&&(e=this.ms(e,t,n,r,i,o,a)),s=!!e,!r&&s&&t&&t.push("object"==typeof e?e:t[t.length-1]),s)},d:function(e,n,r,i){var o,a=e.split("."),s=this.f(a[0],n,r,i),u=this.options.modelGet,c=null;if("."===e&&f(n[n.length-2]))s=n[n.length-1];else for(var l=1;l<a.length;l++)o=t(a[l],s,u),void 0!==o?(c=s,s=o):s="";return!(i&&!s)&&(i||"function"!=typeof s||(n.push(c),s=this.mv(s,n,r),n.pop()),s)},f:function(e,n,r,i){for(var o=!1,a=null,s=!1,u=this.options.modelGet,c=n.length-1;c>=0;c--)if(a=n[c],o=t(e,a,u),void 0!==o){s=!0;break}return s?(i||"function"!=typeof o||(o=this.mv(o,n,r)),o):!i&&""},ls:function(e,t,n,i,o){var a=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(r(e.call(t,i)),t,n)),this.options.delimiters=a,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,o,a){var s,u=t[t.length-1],c=e.call(u);return"function"==typeof c?!!r||(s=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,n,s.substring(i,o),a)):c},mv:function(e,t,n){var i=t[t.length-1],o=e.call(i);return"function"==typeof o?this.ct(r(o.call(i)),i,n):o},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var o=/&/g,a=/</g,s=/>/g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(t)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",link:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=n(328),h=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url||this.props.hasRefinements!==e.hasRefinements}},{key:"handleClick",value:function(e){(0,d.isSpecialClick)(e)||(e.preventDefault(),this.props.clearAll())}},{key:"render",value:function(){var e={hasRefinements:this.props.hasRefinements};return l.default.createElement("a",{className:this.props.cssClasses.link,href:this.props.url,onClick:this.handleClick},l.default.createElement(p.default,s({data:e,templateKey:"link"},this.props.templateProps)))}}]),t}(l.default.Component);t.default=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributes,r=void 0===n?[]:n,i=e.onlyListedAttributes,o=void 0!==i&&i,a=e.clearAll,l=void 0===a?"before":a,p=e.templates,m=void 0===p?q.default:p,g=e.collapsible,b=void 0!==g&&g,w=e.transformData,R=e.autoHideContainer,P=void 0===R||R,O=e.cssClasses,E=void 0===O?{}:O,F=(0,j.default)(r)&&(0,A.default)(r,function(e,t){return e&&(0,C.default)(t)&&(0,x.default)(t.name)&&((0,y.default)(t.label)||(0,x.default)(t.label))&&((0,y.default)(t.template)||(0,x.default)(t.template)||(0,S.default)(t.template))&&((0,y.default)(t.transformData)||(0,S.default)(t.transformData))},!0),k=["header","item","clearAll","footer"],T=(0,C.default)(m)&&(0,A.default)(m,function(e,t,n){return e&&k.indexOf(n)!==-1&&((0,x.default)(t)||(0,S.default)(t))},!0),M=["root","header","body","clearAll","list","item","link","count","footer"],H=(0,C.default)(E)&&(0,A.default)(E,function(e,t,n){return e&&M.indexOf(n)!==-1&&(0,x.default)(t)||(0,j.default)(t)},!0),L=(0,y.default)(w)||(0,S.default)(w)||(0,C.default)(w)&&(0,S.default)(w.item),D=!(((0,x.default)(t)||(0,h.isDomElement)(t))&&(0,j.default)(r)&&F&&(0,_.default)(o)&&[!1,"before","after"].indexOf(l)!==-1&&(0,C.default)(m)&&T&&L&&(0,_.default)(P)&&H);if(D)throw new Error(W);var V=(0,h.getContainerNode)(t),B=(0,U.default)(Q.default);P===!0&&(B=(0,I.default)(B));var K=(0,N.default)(r,function(e){return e.name}),$=o?K:[],J=(0,A.default)(r,function(e,t){return e[t.name]=t,e},{});return{init:function(e){var t=e.helper;this._clearRefinementsAndSearch=h.clearRefinementsAndSearch.bind(null,t,$)},render:function(e){var t=e.results,n=e.helper,r=e.state,i=e.templatesConfig,a=e.createURL,p={root:(0,v.default)(z(null),E.root),header:(0,v.default)(z("header"),E.header),body:(0,v.default)(z("body"),E.body),clearAll:(0,v.default)(z("clear-all"),E.clearAll),list:(0,v.default)(z("list"),E.list),item:(0,v.default)(z("item"),E.item),link:(0,v.default)(z("link"),E.link),count:(0,v.default)(z("count"),E.count),footer:(0,v.default)(z("footer"),E.footer)},g=(0,h.prepareTemplateProps)({transformData:w,defaultTemplates:q.default,templatesConfig:i,templates:m}),y=a((0,h.clearRefinementsFromState)(r,$)),_=s(t,r,K,o),x=_.map(function(e){return a(u(r,e))}),R=_.map(function(e){return c.bind(null,n,e)}),j=0===_.length;d.default.render(f.default.createElement(B,{attributes:J,clearAllClick:this._clearRefinementsAndSearch,clearAllPosition:l,clearAllURL:y,clearRefinementClicks:R,clearRefinementURLs:x,collapsible:b,cssClasses:p,refinements:_,shouldAutoHideContainer:j,templateProps:g}),V)}}}function o(e,t,n){var r=e.indexOf(n);return r!==-1?r:e.length+t.indexOf(n)}function a(e,t,n,r){var i=o(e,t,n.attributeName),a=o(e,t,r.attributeName);return i===a?n.name===r.name?0:n.name<r.name?-1:1:i<a?-1:1}function s(e,t,n,r){var i=(0,h.getRefinements)(e,t),o=(0,A.default)(i,function(e,t){return n.indexOf(t.attributeName)===-1&&e.indexOf(t.attributeName===-1)&&e.push(t.attributeName),e},[]);return i=i.sort(a.bind(null,n,o)),r&&!(0,F.default)(n)&&(i=(0,H.default)(i,function(e){return n.indexOf(e.attributeName)!==-1})),i}function u(e,t){switch(t.type){case"facet":return e.removeFacetRefinement(t.attributeName,t.name);case"disjunctive":return e.removeDisjunctiveFacetRefinement(t.attributeName,t.name);case"hierarchical":return e.clearRefinements(t.attributeName);case"exclude":return e.removeExcludeRefinement(t.attributeName,t.name);case"numeric":return e.removeNumericRefinement(t.attributeName,t.operator,t.numericValue);case"tag":return e.removeTagRefinement(t.name);default:throw new Error("clearRefinement: type "+t.type+" is not handled")}}function c(e,t){e.setState(u(e.state,t)).search()}Object.defineProperty(t,"__esModule",{value:!0});var l=n(325),f=r(l),p=n(325),d=r(p),h=n(328),m=n(330),v=r(m),g=n(193),y=r(g),b=n(342),_=r(b),w=n(194),x=r(w),R=n(47),j=r(R),P=n(237),C=r(P),O=n(43),S=r(O),E=n(189),F=r(E),k=n(162),N=r(k),T=n(164),A=r(T),M=n(159),H=r(M),L=n(332),U=r(L),D=n(331),I=r(D),V=n(343),q=r(V),B=n(344),Q=r(B),z=(0,h.bemHelper)("ais-current-refined-values"),W="Usage:\ncurrentRefinedValues({\n container,\n [ attributes: [{name[, label, template, transformData]}] ],\n [ onlyListedAttributes = false ],\n [ clearAll = 'before' ] // One of ['before', 'after', false]\n [ templates.{header,item,clearAll,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer = true ],\n [ cssClasses.{root, header, body, clearAll, list, item, link, count, footer} = {} ],\n [ collapsible=false ]\n})"; t.default=i},function(e,t,n){function r(e){return e===!0||e===!1||i(e)&&s.call(e)==o}var i=n(46),o="[object Boolean]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'{{#label}}{{label}}{{^operator}}:{{/operator}} {{/label}}{{#operator}}{{{displayOperator}}} {{/operator}}{{#exclude}}-{{/exclude}}{{name}} <span class="{{cssClasses.count}}">{{count}}</span>',clearAll:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return void 0!==e.template&&(t.templates={item:e.template}),void 0!==e.transformData&&(t.transformData=e.transformData),t}function u(e,t,n){var r=(0,_.default)(t);return r.cssClasses=n,void 0!==e.label&&(r.label=e.label),void 0!==r.operator&&(r.displayOperator=r.operator,">="===r.operator&&(r.displayOperator="&ge;"),"<="===r.operator&&(r.displayOperator="&le;")),r}function c(e){return function(t){(0,v.isSpecialClick)(t)||(t.preventDefault(),e())}}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(325),d=r(p),h=n(333),m=r(h),v=n(328),g=n(162),y=r(g),b=n(335),_=r(b),w=n(192),x=r(w),R=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,x.default)(this.props.refinements,e.refinements)}},{key:"_clearAllElement",value:function(e,t){if(t===e)return d.default.createElement("a",{className:this.props.cssClasses.clearAll,href:this.props.clearAllURL,onClick:c(this.props.clearAllClick)},d.default.createElement(m.default,l({templateKey:"clearAll"},this.props.templateProps)))}},{key:"_refinementElement",value:function(e,t){var n=this.props.attributes[e.attributeName]||{},r=u(n,e,this.props.cssClasses),i=s(n),o=e.attributeName+(e.operator?e.operator:":")+(e.exclude?e.exclude:"")+e.name;return d.default.createElement("div",{className:this.props.cssClasses.item,key:o},d.default.createElement("a",{className:this.props.cssClasses.link,href:this.props.clearRefinementURLs[t],onClick:c(this.props.clearRefinementClicks[t])},d.default.createElement(m.default,l({data:r,templateKey:"item"},this.props.templateProps,i))))}},{key:"render",value:function(){return d.default.createElement("div",null,this._clearAllElement("before",this.props.clearAllPosition),d.default.createElement("div",{className:this.props.cssClasses.list},(0,y.default)(this.props.refinements,this._refinementElement.bind(this))),this._clearAllElement("after",this.props.clearAllPosition))}}]),t}(d.default.Component);t.default=R},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributes,r=e.separator,i=void 0===r?" > ":r,o=e.rootPath,s=void 0===o?null:o,l=e.showParentLevel,p=void 0===l||l,h=e.limit,v=void 0===h?10:h,y=e.sortBy,x=void 0===y?["name:asc"]:y,R=e.cssClasses,j=void 0===R?{}:R,P=e.autoHideContainer,C=void 0===P||P,O=e.templates,S=void 0===O?g.default:O,E=e.collapsible,F=void 0!==E&&E,k=e.transformData;if(!t||!n||!n.length)throw new Error(w);var N=(0,c.getContainerNode)(t),T=(0,m.default)(b.default);C===!0&&(T=(0,d.default)(T));var A=n[0],M={root:(0,f.default)(_(null),j.root),header:(0,f.default)(_("header"),j.header),body:(0,f.default)(_("body"),j.body),footer:(0,f.default)(_("footer"),j.footer),list:(0,f.default)(_("list"),j.list),depth:_("list","lvl"),item:(0,f.default)(_("item"),j.item),active:(0,f.default)(_("item","active"),j.active),link:(0,f.default)(_("link"),j.link),count:(0,f.default)(_("count"),j.count)};return{getConfiguration:function(e){return{hierarchicalFacets:[{name:A,attributes:n,separator:i,rootPath:s,showParentLevel:p}],maxValuesPerFacet:void 0!==e.maxValuesPerFacet?Math.max(e.maxValuesPerFacet,v):v}},init:function(e){var t=e.helper,n=e.templatesConfig;this._toggleRefinement=function(e){return t.toggleRefinement(A,e).search()},this._templateProps=(0,c.prepareTemplateProps)({transformData:k,defaultTemplates:g.default,templatesConfig:n,templates:S})},_prepareFacetValues:function(e,t){var n=this;return e.slice(0,v).map(function(e){return Array.isArray(e.data)&&(e.data=n._prepareFacetValues(e.data,t)),e})},render:function(e){function t(e){return i(r.toggleRefinement(A,e))}var n=e.results,r=e.state,i=e.createURL,o=n.getFacetValues(A,{sortBy:x}).data||[];o=this._prepareFacetValues(o,r),u.default.render(a.default.createElement(T,{attributeNameKey:"path",collapsible:F,createURL:t,cssClasses:M,facetValues:o,shouldAutoHideContainer:0===o.length,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(346),g=r(v),y=n(347),b=r(y),_=(0,c.bemHelper)("ais-hierarchical-menu"),w="Usage:\nhierarchicalMenu({\n container,\n attributes,\n [ separator=' > ' ],\n [ rootPath ],\n [ showParentLevel=true ],\n [ limit=10 ],\n [ sortBy=['name:asc'] ],\n [ cssClasses.{root , header, body, footer, list, depth, item, active, link}={} ],\n [ templates.{header, item, footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(330),d=r(p),h=n(328),m=n(333),v=r(m),g=n(348),y=r(g),b=n(192),_=r(b),w=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={isShowMoreOpen:!1},n.handleItemClick=n.handleItemClick.bind(n),n.handleClickShowMore=n.handleClickShowMore.bind(n),n}return s(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=t!==this.state,r=!(0,_.default)(this.props.facetValues,e.facetValues),i=n||r;return i}},{key:"refine",value:function(e,t){this.props.toggleRefinement(e,t)}},{key:"_generateFacetItem",value:function(e){var n=void 0,r=e.data&&e.data.length>0;r&&(n=f.default.createElement(t,u({},this.props,{depth:this.props.depth+1,facetValues:e.data})));var o=this.props.createURL(e[this.props.attributeNameKey]),a=u({},e,{url:o,cssClasses:this.props.cssClasses}),s=(0,d.default)(this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),c=e[this.props.attributeNameKey];return void 0!==e.isRefined&&(c+="/"+e.isRefined),void 0!==e.count&&(c+="/"+e.count),f.default.createElement(y.default,{facetValueToRefine:e[this.props.attributeNameKey],handleClick:this.handleItemClick,isRefined:e.isRefined,itemClassName:s,key:c,subItems:n,templateData:a,templateKey:"item",templateProps:this.props.templateProps})}},{key:"handleItemClick",value:function(e){var t=e.facetValueToRefine,n=e.originalEvent,r=e.isRefined;if(!(0,h.isSpecialClick)(n)){if("INPUT"===n.target.tagName)return void this.refine(t,r);for(var i=n.target;i!==n.currentTarget;){if("LABEL"===i.tagName&&(i.querySelector('input[type="checkbox"]')||i.querySelector('input[type="radio"]')))return;"A"===i.tagName&&i.href&&n.preventDefault(),i=i.parentNode}n.stopPropagation(),this.refine(t,r)}}},{key:"handleClickShowMore",value:function(){var e=!this.state.isShowMoreOpen;this.setState({isShowMoreOpen:e})}},{key:"render",value:function(){var e=[this.props.cssClasses.list];this.props.cssClasses.depth&&e.push(""+this.props.cssClasses.depth+this.props.depth);var t=this.state.isShowMoreOpen?this.props.limitMax:this.props.limitMin,n=this.props.facetValues.slice(0,t),r=this.props.showMore===!0&&this.props.facetValues.length>n.length||this.state.isShowMoreOpen&&n.length>this.props.limitMin,i=r?f.default.createElement(v.default,u({rootProps:{onClick:this.handleClickShowMore},templateKey:"show-more-"+(this.state.isShowMoreOpen?"active":"inactive")},this.props.templateProps)):void 0;return f.default.createElement("div",{className:(0,d.default)(e)},n.map(this._generateFacetItem,this),i)}}]),t}(f.default.Component);w.defaultProps={cssClasses:{},depth:0,attributeNameKey:"name"},t.default=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=n(192),h=r(d),m=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,h.default)(this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick({facetValueToRefine:this.props.facetValueToRefine,isRefined:this.props.isRefined,originalEvent:e})}},{key:"render",value:function(){return l.default.createElement("div",{className:this.props.itemClassName,onClick:this.handleClick},l.default.createElement(p.default,s({data:this.props.templateData,templateKey:this.props.templateKey},this.props.templateProps)),this.props.subItems)}}]),t}(l.default.Component);t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.templates,o=void 0===i?m.default:i,s=e.transformData,l=e.hitsPerPage,p=void 0===l?20:l;if(!t)throw new Error("Must provide a container."+g);if(o.item&&o.allItems)throw new Error("Must contain only allItems OR item template."+g);var h=(0,c.getContainerNode)(t),y={root:(0,f.default)(v(null),r.root),item:(0,f.default)(v("item"),r.item),empty:(0,f.default)(v(null,"empty"),r.empty)};return{getConfiguration:function(){return{hitsPerPage:p}},init:function(e){var t=e.templatesConfig;this._templateProps=(0,c.prepareTemplateProps)({transformData:s,defaultTemplates:m.default,templatesConfig:t,templates:o})},render:function(e){var t=e.results;u.default.render(a.default.createElement(d.default,{cssClasses:y,hits:t.hits,results:t,templateProps:this._templateProps}),h)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(350),d=r(p),h=n(353),m=r(h),v=(0,c.bemHelper)("ais-hits"),g="\nUsage:\nhits({\n container,\n [ cssClasses.{root,empty,item}={} ],\n [ templates.{empty,item} | templates.{empty, allItems} ],\n [ transformData.{empty,item} | transformData.{empty, allItems} ],\n [ hitsPerPage=20 ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(162),p=r(f),d=n(333),h=r(d),m=n(351),v=r(m),g=n(330),y=r(g),b=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"renderWithResults",value:function(){var e=this,t=(0,p.default)(this.props.results.hits,function(t,n){var r=s({},t,{__hitIndex:n});return l.default.createElement(h.default,s({data:r,key:r.objectID,rootProps:{className:e.props.cssClasses.item},templateKey:"item"},e.props.templateProps))});return l.default.createElement("div",{className:this.props.cssClasses.root},t)}},{key:"renderAllResults",value:function(){var e=(0,y.default)(this.props.cssClasses.root,this.props.cssClasses.allItems);return l.default.createElement(h.default,s({data:this.props.results,rootProps:{className:e},templateKey:"allItems"},this.props.templateProps))}},{key:"renderNoResults",value:function(){var e=(0,y.default)(this.props.cssClasses.root,this.props.cssClasses.empty);return l.default.createElement(h.default,s({data:this.props.results,rootProps:{className:e},templateKey:"empty"},this.props.templateProps))}},{key:"render",value:function(){var e=this.props.results.hits.length>0,t=(0,v.default)(this.props,"templateProps.templates.allItems");return e?t?this.renderAllResults():this.renderWithResults():this.renderNoResults()}}]),t}(l.default.Component);b.defaultProps={results:{hits:[]}},t.default=b},function(e,t,n){function r(e,t){return null!=e&&o(e,t,i)}var i=n(352),o=n(150);e.exports=r},function(e,t){function n(e,t){return null!=e&&i.call(e,t)}var r=Object.prototype,i=r.hasOwnProperty;e.exports=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={empty:"No results",item:function(e){return JSON.stringify(e,null,2)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.options,r=e.cssClasses,i=void 0===r?{}:r,o=e.autoHideContainer,s=void 0!==o&&o,l=n;if(!t||!l)throw new Error(b);var p=(0,c.getContainerNode)(t),h=g.default;s===!0&&(h=(0,m.default)(h));var v={root:(0,d.default)(y(null),i.root),item:(0,d.default)(y("item"),i.item)};return{init:function(e){var t=e.helper,n=e.state,r=(0,f.default)(l,function(e){return Number(n.hitsPerPage)===Number(e.value)});r||(void 0===n.hitsPerPage?window.console&&window.console.log("[Warning][hitsPerPageSelector] hitsPerPage not defined.\nYou should probably use a `hits` widget or set the value `hitsPerPage`\nusing the searchParameters attribute of the instantsearch constructor."):window.console&&window.console.log("[Warning][hitsPerPageSelector] No option in `options`\nwith `value: hitsPerPage` (hitsPerPage: "+n.hitsPerPage+")"),l=[{value:void 0,label:""}].concat(l)),this.setHitsPerPage=function(e){return t.setQueryParameter("hitsPerPage",Number(e)).search()}},render:function(e){var t=e.state,n=e.results,r=t.hitsPerPage,i=0===n.nbHits;u.default.render(a.default.createElement(h,{cssClasses:v,currentValue:r,options:l,setValue:this.setHitsPerPage,shouldAutoHideContainer:i}),p)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(355),f=r(l),p=n(330),d=r(p),h=n(331),m=r(h),v=n(357),g=r(v),y=(0,c.bemHelper)("ais-hits-per-page-selector"),b="Usage:\nhitsPerPageSelector({\n container,\n options,\n [ cssClasses.{root,item}={} ],\n [ autoHideContainer=false ]\n})";t.default=i},function(e,t,n){function r(e,t,n){var r=s(e)?i:a;return n&&u(e,t,n)&&(t=void 0),r(e,o(t,3))}var i=n(118),o=n(106),a=n(356),s=n(47),u=n(213);e.exports=r},function(e,t,n){function r(e,t){var n;return i(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var i=n(157);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(325),c=r(u),l=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),s(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"handleChange",value:function(e){this.props.setValue(e.target.value)}},{key:"render",value:function(){var e=this,t=this.props,n=t.currentValue,r=t.options;return c.default.createElement("select",{className:this.props.cssClasses.root,onChange:this.handleChange,value:n},r.map(function(t){return c.default.createElement("option",{className:e.props.cssClasses.item,key:t.value,value:t.value},t.label)}))}}]),t}(c.default.Component);t.default=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.sortBy,i=void 0===r?["count:desc","name:asc"]:r,a=e.limit,u=void 0===a?10:a,f=e.cssClasses,d=void 0===f?{}:f,m=e.templates,g=void 0===m?_.default:m,b=e.collapsible,w=void 0!==b&&b,P=e.transformData,C=e.autoHideContainer,O=void 0===C||C,S=e.showMore,E=void 0!==S&&S,F=(0,y.default)(E);if(F&&F.limit<u)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var k=F&&F.limit||u;if(!t||!n)throw new Error(j);var N=(0,l.getContainerNode)(t),T=(0,v.default)(x.default);O===!0&&(T=(0,h.default)(T));var A=n,M=F&&(0,l.prefixKeys)("show-more-",F.templates),H=M?o({},g,M):g,L={root:(0,p.default)(R(null),d.root),header:(0,p.default)(R("header"),d.header),body:(0,p.default)(R("body"),d.body),footer:(0,p.default)(R("footer"),d.footer),list:(0,p.default)(R("list"),d.list),item:(0,p.default)(R("item"),d.item),active:(0,p.default)(R("item","active"),d.active),link:(0,p.default)(R("link"),d.link),count:(0,p.default)(R("count"),d.count)};return{getConfiguration:function(e){var t={hierarchicalFacets:[{name:A,attributes:[n]}]},r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,k),t},init:function(e){var t=e.templatesConfig,n=e.helper,r=e.createURL;this._templateProps=(0,l.prepareTemplateProps)({transformData:P,defaultTemplates:_.default,templatesConfig:t,templates:H}),this._createURL=function(e,t){return r(e.toggleRefinement(A,t))},this._toggleRefinement=function(e){return n.toggleRefinement(A,e).search()}},_prepareFacetValues:function(e,t){var n=this;return e.map(function(e){return e.url=n._createURL(t,e),e})},render:function(e){function t(e){return a(o.toggleRefinement(n,e))}var r=e.results,o=e.state,a=e.createURL,l=r.getFacetValues(A,{sortBy:i}).data||[];l=this._prepareFacetValues(l,o),c.default.render(s.default.createElement(T,{collapsible:w,createURL:t,cssClasses:L,facetValues:l,limitMax:k,limitMin:u,shouldAutoHideContainer:0===l.length,showMore:null!==F,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(330),p=r(f),d=n(331),h=r(d),m=n(332),v=r(m),g=n(359),y=r(g),b=n(361),_=r(b),w=n(347),x=r(w),R=(0,l.bemHelper)("ais-menu"),j="Usage:\nmenu({\n container,\n attributeName,\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root,list,item} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(!e)return null;if(e===!0)return u;var t=o({},e);return e.templates||(t.templates=u.templates),e.limit||(t.limit=u.limit),t}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=i;var a=n(360),s=r(a),u={templates:s.default,limit:100}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={active:'<a class="ais-show-more ais-show-more__active">Show less</a>',inactive:'<a class="ais-show-more ais-show-more__inactive">Show more</a>'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=e.container,n=e.attributeName,r=e.operator,o=void 0===r?"or":r,s=e.sortBy,c=void 0===s?["count:desc","name:asc"]:s,p=e.limit,h=void 0===p?10:p,v=e.cssClasses,y=void 0===v?{}:v,_=e.templates,x=void 0===_?R.default:_,j=e.collapsible,S=void 0!==j&&j,E=e.transformData,F=e.autoHideContainer,k=void 0===F||F,N=e.showMore,T=void 0!==N&&N,A=(0,w.default)(T);if(A&&A.limit<h)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var M=A&&A.limit||h,H=P.default;if(!t||!n)throw new Error(O);H=(0,b.default)(H),k===!0&&(H=(0,g.default)(H));var L=(0,f.getContainerNode)(t);if(o&&(o=o.toLowerCase(),"and"!==o&&"or"!==o))throw new Error(O);var U=A&&(0,f.prefixKeys)("show-more-",A.templates),D=U?a({},x,U):x,I={root:(0,d.default)(C(null),y.root),header:(0,d.default)(C("header"),y.header),body:(0,d.default)(C("body"),y.body),footer:(0,d.default)(C("footer"),y.footer),list:(0,d.default)(C("list"),y.list),item:(0,d.default)(C("item"),y.item),active:(0,d.default)(C("item","active"),y.active),label:(0,d.default)(C("label"),y.label),checkbox:(0,d.default)(C("checkbox"),y.checkbox),count:(0,d.default)(C("count"),y.count)};return{getConfiguration:function(e){var t=i({},"and"===o?"facets":"disjunctiveFacets",[n]),r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,M),t},init:function(e){var t=e.templatesConfig,r=e.helper;this._templateProps=(0,f.prepareTemplateProps)({transformData:E,defaultTemplates:R.default,templatesConfig:t,templates:D}),this.toggleRefinement=function(e){return r.toggleRefinement(n,e).search()}},render:function(e){function t(e){return o(i.toggleRefinement(n,e))}var r=e.results,i=e.state,o=e.createURL,a=r.getFacetValues(n,{sortBy:c}),s=(0,m.default)(a,{isRefined:!0}).length,f={header:{refinedFacetsCount:s}};l.default.render(u.default.createElement(H,{collapsible:S,createURL:t,cssClasses:I,facetValues:a,headerFooterData:f,limitMax:M,limitMin:h,shouldAutoHideContainer:0===a.length,showMore:null!==A,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),L)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(325),u=r(s),c=n(325),l=r(c),f=n(328),p=n(330),d=r(p),h=n(159),m=r(h),v=n(331),g=r(v),y=n(332),b=r(y),_=n(359),w=r(_),x=n(363),R=r(x),j=n(347),P=r(j),C=(0,f.bemHelper)("ais-refinement-list"),O="Usage:\nrefinementList({\n container,\n attributeName,\n [ operator='or' ],\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root, header, body, footer, list, item, active, label, checkbox, count}],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t.default=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributeName,r=e.options,i=e.cssClasses,s=void 0===i?{}:i,c=e.templates,f=void 0===c?P.default:c,h=e.collapsible,v=void 0!==h&&h,g=e.transformData,y=e.autoHideContainer,b=void 0===y||y;if(!t||!n||!r)throw new Error(E);var _=(0,d.getContainerNode)(t),x=(0,R.default)(O.default);b===!0&&(x=(0,w.default)(x));var j={root:(0,m.default)(S(null),s.root),header:(0,m.default)(S("header"),s.header),body:(0,m.default)(S("body"),s.body),footer:(0,m.default)(S("footer"),s.footer),list:(0,m.default)(S("list"),s.list),item:(0,m.default)(S("item"),s.item),label:(0,m.default)(S("label"),s.label),radio:(0,m.default)(S("radio"),s.radio),active:(0,m.default)(S("item","active"),s.active)};return{init:function(e){var t=e.templatesConfig,i=e.helper;this._templateProps=(0,d.prepareTemplateProps)({transformData:g,defaultTemplates:P.default,templatesConfig:t,templates:f}),this._toggleRefinement=function(e){var t=a(i.state,n,r,e);i.setState(t).search()}},render:function(e){function t(e){return c(a(s,n,r,e))}var i=e.results,s=e.state,c=e.createURL,f=r.map(function(e){return u({},e,{isRefined:o(s,n,e),attributeName:n})});p.default.render(l.default.createElement(x,{collapsible:v,createURL:t,cssClasses:j,facetValues:f,shouldAutoHideContainer:0===i.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),_)}}}function o(e,t,n){var r=e.getNumericRefinements(t);return void 0!==n.start&&void 0!==n.end&&n.start===n.end?s(r,"=",n.start):void 0!==n.start?s(r,">=",n.start):void 0!==n.end?s(r,"<=",n.end):void 0===n.start&&void 0===n.end?0===Object.keys(r).length:void 0}function a(e,t,n,r){var i=e,a=(0,g.default)(n,{name:r}),u=i.getNumericRefinements(t);if(void 0===a.start&&void 0===a.end)return i.clearRefinements(t);if(o(i,t,a)||(i=i.clearRefinements(t)),void 0!==a.start&&void 0!==a.end){if(a.start>a.end)throw new Error("option.start should be > to option.end");if(a.start===a.end)return i=s(u,"=",a.start)?i.removeNumericRefinement(t,"=",a.start):i.addNumericRefinement(t,"=",a.start)}return void 0!==a.start&&(i=s(u,">=",a.start)?i.removeNumericRefinement(t,">=",a.start):i.addNumericRefinement(t,">=",a.start)),void 0!==a.end&&(i=s(u,"<=",a.end)?i.removeNumericRefinement(t,"<=",a.end):i.addNumericRefinement(t,"<=",a.end)),i}function s(e,t,n){var r=void 0!==e[t],i=(0,b.default)(e[t],n);return r&&i}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(325),l=r(c),f=n(325),p=r(f),d=n(328),h=n(330),m=r(h),v=n(195),g=r(v),y=n(246),b=r(y),_=n(331),w=r(_),x=n(332),R=r(x),j=n(365),P=r(j),C=n(347),O=r(C),S=(0,d.bemHelper)("ais-refinement-list"),E="Usage:\nnumericRefinementList({\n container,\n attributeName,\n options,\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="radio" class="{{cssClasses.checkbox}}" name="{{attributeName}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.operator,r=void 0===n?"=":n,i=e.attributeName,o=e.options,s=e.cssClasses,l=void 0===s?{}:s,p=e.autoHideContainer,h=void 0!==p&&p,v=(0,c.getContainerNode)(t),b="Usage: numericSelector({\n container,\n attributeName,\n options,\n cssClasses.{root,item},\n autoHideContainer\n })",_=g.default;if(h===!0&&(_=(0,m.default)(_)),!t||!o||0===o.length||!i)throw new Error(b);var w={root:(0,f.default)(y(null),l.root),item:(0,f.default)(y("item"),l.item)};return{init:function(e){var t=e.helper,n=this._getRefinedValue(t);void 0!==n&&t.addNumericRefinement(i,r,n),this._refine=function(e){t.clearRefinements(i),void 0!==e&&t.addNumericRefinement(i,r,e),t.search()}},render:function(e){ var t=e.helper,n=e.results;u.default.render(a.default.createElement(_,{cssClasses:w,currentValue:this._getRefinedValue(t),options:o,setValue:this._refine,shouldAutoHideContainer:0===n.nbHits}),v)},_getRefinedValue:function(e){var t=e.getRefinements(i),n=(0,d.default)(t,{operator:r});return n&&void 0!==n.value&&void 0!==n.value[0]?n.value[0]:o[0].value}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(195),d=r(p),h=n(331),m=r(h),v=n(357),g=r(v),y=(0,c.bemHelper)("ais-numeric-selector");t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.labels,o=void 0===i?{}:i,s=e.maxPages,c=e.padding,f=void 0===c?3:c,h=e.showFirstLast,v=void 0===h||h,w=e.autoHideContainer,x=void 0===w||w,R=e.scrollTo,j=void 0===R?"body":R,P=j;if(!t)throw new Error(_);P===!0&&(P="body");var C=(0,d.getContainerNode)(t),O=P!==!1&&(0,d.getContainerNode)(P),S=g.default;x===!0&&(S=(0,m.default)(S));var E={root:(0,p.default)(b(null),r.root),item:(0,p.default)(b("item"),r.item),link:(0,p.default)(b("link"),r.link),page:(0,p.default)(b("item","page"),r.page),previous:(0,p.default)(b("item","previous"),r.previous),next:(0,p.default)(b("item","next"),r.next),first:(0,p.default)(b("item","first"),r.first),last:(0,p.default)(b("item","last"),r.last),active:(0,p.default)(b("item","active"),r.active),disabled:(0,p.default)(b("item","disabled"),r.disabled)},F=(0,l.default)(o,y);return{init:function(e){var t=e.helper;this.setCurrentPage=function(e){t.setCurrentPage(e),O!==!1&&O.scrollIntoView(),t.search()}},getMaxPage:function(e){return void 0!==s?Math.min(s,e.nbPages):e.nbPages},render:function(e){var t=e.results,n=e.state,r=e.createURL;u.default.render(a.default.createElement(S,{createURL:function(e){return r(n.setPage(e))},cssClasses:E,currentPage:t.page,labels:F,nbHits:t.nbHits,nbPages:this.getMaxPage(t),padding:f,setCurrentPage:this.setCurrentPage,shouldAutoHideContainer:0===t.nbHits,showFirstLast:v}),C)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(207),l=r(c),f=n(330),p=r(f),d=n(328),h=n(331),m=r(h),v=n(368),g=r(v),y={previous:"‹",next:"›",first:"«",last:"»"},b=(0,d.bemHelper)("ais-pagination"),_="Usage:\npagination({\n container,\n [ cssClasses.{root,item,page,previous,next,first,last,active,disabled}={} ],\n [ labels.{previous,next,first,last} ],\n [ maxPages ],\n [ padding=3 ],\n [ showFirstLast=true ],\n [ autoHideContainer=true ],\n [ scrollTo='body' ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(325),c=r(u),l=n(155),f=r(l),p=n(369),d=r(p),h=n(328),m=n(371),v=r(m),g=n(375),y=r(g),b=n(330),_=r(b),w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,d.default)(e,t.defaultProps)));return n.handleClick=n.handleClick.bind(n),n}return a(t,e),s(t,[{key:"pageLink",value:function(e){var t=e.label,n=e.ariaLabel,r=e.pageNumber,i=e.additionalClassName,o=void 0===i?null:i,a=e.isDisabled,s=void 0!==a&&a,u=e.isActive,l=void 0!==u&&u,f=e.createURL,p={item:(0,_.default)(this.props.cssClasses.item,o),link:(0,_.default)(this.props.cssClasses.link)};s?p.item=(0,_.default)(p.item,this.props.cssClasses.disabled):l&&(p.item=(0,_.default)(p.item,this.props.cssClasses.active));var d=f&&!s?f(r):"#";return c.default.createElement(y.default,{ariaLabel:n,cssClasses:p,handleClick:this.handleClick,isDisabled:s,key:t+r,label:t,pageNumber:r,url:d})}},{key:"previousPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Previous",additionalClassName:this.props.cssClasses.previous,isDisabled:e.isFirstPage(),label:this.props.labels.previous,pageNumber:e.currentPage-1,createURL:t})}},{key:"nextPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Next",additionalClassName:this.props.cssClasses.next,isDisabled:e.isLastPage(),label:this.props.labels.next,pageNumber:e.currentPage+1,createURL:t})}},{key:"firstPageLink",value:function(e,t){return this.pageLink({ariaLabel:"First",additionalClassName:this.props.cssClasses.first,isDisabled:e.isFirstPage(),label:this.props.labels.first,pageNumber:0,createURL:t})}},{key:"lastPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Last",additionalClassName:this.props.cssClasses.last,isDisabled:e.isLastPage(),label:this.props.labels.last,pageNumber:e.total-1,createURL:t})}},{key:"pages",value:function e(t,n){var r=this,e=[];return(0,f.default)(t.pages(),function(i){var o=i===t.currentPage;e.push(r.pageLink({ariaLabel:i+1,additionalClassName:r.props.cssClasses.page,isActive:o,label:i+1,pageNumber:i,createURL:n}))}),e}},{key:"handleClick",value:function(e,t){(0,h.isSpecialClick)(t)||(t.preventDefault(),this.props.setCurrentPage(e))}},{key:"render",value:function(){var e=new v.default({currentPage:this.props.currentPage,total:this.props.nbPages,padding:this.props.padding}),t=this.props.createURL;return c.default.createElement("ul",{className:this.props.cssClasses.root},this.props.showFirstLast?this.firstPageLink(e,t):null,this.previousPageLink(e,t),this.pages(e,t),this.nextPageLink(e,t),this.props.showFirstLast?this.lastPageLink(e,t):null)}}]),t}(c.default.Component);w.defaultProps={nbHits:0,currentPage:0,nbPages:0},t.default=w},function(e,t,n){var r=n(100),i=n(99),o=n(370),a=n(315),s=i(function(e){return e.push(void 0,o),r(a,void 0,e)});e.exports=s},function(e,t,n){function r(e,t,n,a,s,u){return o(e)&&o(t)&&(u.set(t,e),i(e,t,void 0,r,u),u.delete(t)),e}var i=n(215),o=n(44);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(372),s=r(a),u=function(){function e(t){i(this,e),this.currentPage=t.currentPage,this.total=t.total,this.padding=t.padding}return o(e,[{key:"pages",value:function(){var e=this.total,t=this.currentPage,n=this.padding,r=this.nbPagesDisplayed(n,e);if(r===e)return(0,s.default)(0,e);var i=this.calculatePaddingLeft(t,n,e,r),o=r-i,a=t-i,u=t+o;return(0,s.default)(a,u)}},{key:"nbPagesDisplayed",value:function(e,t){return Math.min(2*e+1,t)}},{key:"calculatePaddingLeft",value:function(e,t,n,r){return e<=t?e:e>=n-t?r-(n-e):t}},{key:"isLastPage",value:function(){return this.currentPage===this.total-1}},{key:"isFirstPage",value:function(){return 0===this.currentPage}}]),e}();t.default=u},function(e,t,n){var r=n(373),i=r();e.exports=i},function(e,t,n){function r(e){return function(t,n,r){return r&&"number"!=typeof r&&o(t,n,r)&&(n=r=void 0),t=a(t),void 0===n?(n=t,t=0):n=a(n),r=void 0===r?t<n?1:-1:a(r),i(t,n,r,e)}}var i=n(374),o=n(213),a=n(185);e.exports=r},function(e,t){function n(e,t,n,o){for(var a=-1,s=i(r((t-e)/(n||1)),0),u=Array(s);s--;)u[o?s:++a]=e,e+=n;return u}var r=Math.ceil,i=Math.max;e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(192),p=r(f),d=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,p.default)(this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick(this.props.pageNumber,e)}},{key:"render",value:function(){var e=this.props,t=e.cssClasses,n=e.label,r=e.ariaLabel,i=e.url,o=e.isDisabled,a="span",u={className:t.link,dangerouslySetInnerHTML:{__html:n}};o||(a="a",u=s({},u,{"aria-label":r,href:i,onClick:this.handleClick}));var c=l.default.createElement(a,u);return l.default.createElement("li",{className:t.item},c)}}]),t}(l.default.Component);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.cssClasses,i=void 0===r?{}:r,a=e.templates,u=void 0===a?h.default:a,f=e.collapsible,d=void 0!==f&&f,m=e.labels,g=void 0===m?{}:m,b=e.currency,w=void 0===b?"$":b,P=e.autoHideContainer,C=void 0===P||P,O=w;if(!t||!n)throw new Error(j);var S=(0,l.getContainerNode)(t),E=(0,y.default)(x.default);C===!0&&(E=(0,v.default)(E));var F=o({button:"Go",separator:"to"},g),k={root:(0,_.default)(R(null),i.root),header:(0,_.default)(R("header"),i.header),body:(0,_.default)(R("body"),i.body),list:(0,_.default)(R("list"),i.list),link:(0,_.default)(R("link"),i.link),item:(0,_.default)(R("item"),i.item),active:(0,_.default)(R("item","active"),i.active),form:(0,_.default)(R("form"),i.form),label:(0,_.default)(R("label"),i.label),input:(0,_.default)(R("input"),i.input),currency:(0,_.default)(R("currency"),i.currency),button:(0,_.default)(R("button"),i.button),separator:(0,_.default)(R("separator"),i.separator),footer:(0,_.default)(R("footer"),i.footer)};return void 0!==g.currency&&g.currency!==O&&(O=g.currency),{getConfiguration:function(){return{facets:[n]}},_generateRanges:function(e){var t=e.getFacetStats(n);return(0,p.default)(t)},_extractRefinedRange:function(e){var t=e.getRefinements(n),r=void 0,i=void 0;return 0===t.length?[]:(t.forEach(function(e){e.operator.indexOf(">")!==-1?r=Math.floor(e.value[0]):e.operator.indexOf("<")!==-1&&(i=Math.ceil(e.value[0]))}),[{from:r,to:i,isRefined:!0}])},_refine:function(e,t,r){var i=this._extractRefinedRange(e);e.clearRefinements(n),0!==i.length&&i[0].from===t&&i[0].to===r||("undefined"!=typeof t&&e.addNumericRefinement(n,">=",Math.floor(t)),"undefined"!=typeof r&&e.addNumericRefinement(n,"<=",Math.ceil(r))),e.search()},init:function(e){var t=e.helper,n=e.templatesConfig;this._refine=this._refine.bind(this,t),this._templateProps=(0,l.prepareTemplateProps)({defaultTemplates:h.default,templatesConfig:n,templates:u})},render:function(e){var t=e.results,r=e.helper,i=e.state,o=e.createURL,a=void 0;t.hits.length>0?(a=this._extractRefinedRange(r),0===a.length&&(a=this._generateRanges(t))):a=[],a.map(function(e){var t=i.clearRefinements(n);return e.isRefined||(void 0!==e.from&&(t=t.addNumericRefinement(n,">=",Math.floor(e.from))),void 0!==e.to&&(t=t.addNumericRefinement(n,"<=",Math.ceil(e.to)))),e.url=o(t),e}),c.default.render(s.default.createElement(E,{collapsible:d,cssClasses:k,currency:O,facetValues:a,labels:F,refine:this._refine,shouldAutoHideContainer:0===a.length,templateProps:this._templateProps}),S)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(377),p=r(f),d=n(378),h=r(d),m=n(331),v=r(m),g=n(332),y=r(g),b=n(330),_=r(b),w=n(379),x=r(w),R=(0,l.bemHelper)("ais-price-ranges"),j="Usage:\npriceRanges({\n container,\n attributeName,\n [ currency=$ ],\n [ cssClasses.{root,header,body,list,item,active,link,form,label,input,currency,separator,button,footer} ],\n [ templates.{header,item,footer} ],\n [ labels.{currency,separator,button} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";function n(e,t){var n=Math.round(e/t)*t;return n<1&&(n=1),n}function r(e){var t=void 0;t=e.avg<100?1:e.avg<1e3?10:100;for(var r=n(Math.round(e.avg),t),i=Math.ceil(e.min),o=n(Math.floor(e.max),t);o>e.max;)o-=t;var a=void 0,s=void 0,u=[];if(i!==o){for(a=i,u.push({to:a});a<r;)s=u[u.length-1].to,a=n(s+(r-i)/3,t),a<=s&&(a=s+1),u.push({from:s,to:a});for(;a<o;)s=u[u.length-1].to,a=n(s+(o-r)/3,t),a<=s&&(a=s+1),u.push({from:s,to:a});1===u.length&&a!==r&&(u.push({from:a,to:r}),a=r),1===u.length?(u[0].from=e.min,u[0].to=e.max):delete u[u.length-1].to}return u}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:"\n {{#from}}\n {{^to}}\n &ge;\n {{/to}}\n {{currency}}{{from}}\n {{/from}}\n {{#to}}\n {{#from}}\n -\n {{/from}}\n {{^from}}\n &le;\n {{/from}}\n {{to}}\n {{/to}}\n ",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(333),d=r(p),h=n(380),m=r(h),v=n(330),g=r(v),y=n(192),b=r(y),_=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),c(t,[{key:"componentWillMount",value:function(){this.refine=this.refine.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,b.default)(this.props.facetValues,e.facetValues)}},{key:"getForm",value:function(){var e=u({currency:this.props.currency},this.props.labels),t=void 0;return t=1===this.props.facetValues.length?{from:void 0!==this.props.facetValues[0].from?this.props.facetValues[0].from:"",to:void 0!==this.props.facetValues[0].to?this.props.facetValues[0].to:""}:{from:"",to:""},f.default.createElement(m.default,{cssClasses:this.props.cssClasses,currentRefinement:t,labels:e,refine:this.refine})}},{key:"getItemFromFacetValue",value:function(e){var t=(0,g.default)(this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),n=e.from+"_"+e.to,r=this.refine.bind(this,e.from,e.to),o=u({currency:this.props.currency},e);return f.default.createElement("div",{className:t,key:n},f.default.createElement("a",{className:this.props.cssClasses.link,href:e.url,onClick:r},f.default.createElement(d.default,u({data:o,templateKey:"item"},this.props.templateProps))))}},{key:"refine",value:function(e,t,n){n.preventDefault(),this.props.refine(e,t)}},{key:"render",value:function(){var e=this;return f.default.createElement("div",null,f.default.createElement("div",{className:this.props.cssClasses.list},this.props.facetValues.map(function(t){return e.getItemFromFacetValue(t)})),this.getForm())}}]),t}(f.default.Component);_.defaultProps={cssClasses:{}},t.default=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={from:e.currentRefinement.from,to:e.currentRefinement.to},n}return s(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleSubmit=this.handleSubmit.bind(this)}},{key:"componentWillReceiveProps",value:function(e){this.setState({from:e.currentRefinement.from,to:e.currentRefinement.to})}},{key:"getInput",value:function(e){var t=this;return l.default.createElement("label",{className:this.props.cssClasses.label},l.default.createElement("span",{className:this.props.cssClasses.currency},this.props.labels.currency," "),l.default.createElement("input",{className:this.props.cssClasses.input,onChange:function(n){return t.setState(i({},e,n.target.value))},ref:e,type:"number",value:this.state[e]}))}},{key:"handleSubmit",value:function(e){var t=""!==this.refs.from.value?parseInt(this.refs.from.value,10):void 0,n=""!==this.refs.to.value?parseInt(this.refs.to.value,10):void 0;this.props.refine(t,n,e)}},{key:"render",value:function(){var e=this.getInput("from"),t=this.getInput("to"),n=this.handleSubmit;return l.default.createElement("form",{className:this.props.cssClasses.form,onSubmit:n,ref:"form"},e,l.default.createElement("span",{className:this.props.cssClasses.separator}," ",this.props.labels.separator," "),t,l.default.createElement("button",{className:this.props.cssClasses.button,type:"submit"},this.props.labels.button))}}]),t}(l.default.Component);f.defaultProps={cssClasses:{},labels:{}},t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.placeholder,r=void 0===n?"":n,i=e.cssClasses,a=void 0===i?{}:i,f=e.poweredBy,d=void 0!==f&&f,m=e.wrapInput,g=void 0===m||m,b=e.autofocus,w=void 0===b?"auto":b,O=e.searchOnEnterKeyPressOnly,S=void 0!==O&&O,E=e.queryHook,F=window.addEventListener?"input":"propertychange";if(!t)throw new Error(C);return t=(0,l.getContainerNode)(t),"boolean"!=typeof w&&(w="auto"),d===!0&&(d={}),{getInput:function(){return"INPUT"===t.tagName?t:document.createElement("input")},wrapInput:function(e){var t=document.createElement("div"),n=(0,y.default)(R(null),a.root).split(" ");return n.forEach(function(e){return t.classList.add(e)}),t.appendChild(e),t},addDefaultAttributesToInput:function(e,t){var n={autocapitalize:"off",autocomplete:"off",autocorrect:"off",placeholder:r,role:"textbox",spellcheck:"false",type:"text",value:t};(0,p.default)(n,function(t,n){e.hasAttribute(n)||e.setAttribute(n,t)});var i=(0,y.default)(R("input"),a.input).split(" ");i.forEach(function(t){return e.classList.add(t)})},addPoweredBy:function(e){d=c({cssClasses:{},template:x.default.poweredBy},d);var t={root:(0,y.default)(R("powered-by"),d.cssClasses.root),link:(0,y.default)(R("powered-by-link"),d.cssClasses.link)},n="https://www.algolia.com/?utm_source=instantsearch.js&utm_medium=website&"+("utm_content="+location.hostname+"&")+"utm_campaign=poweredby",r={cssClasses:t,url:n},i=d.template,o=void 0;(0,h.default)(i)&&(o=_.default.compile(i).render(r)),(0,v.default)(i)&&(o=i(r));var a=document.createElement("div");a.innerHTML="<span>"+o.trim()+"</span>";var s=a.firstChild;e.parentNode.insertBefore(s,e.nextSibling)},init:function(e){function n(e){return E?void E(e,a):void i(e)}function r(e){e!==l.state.query&&(m=l.state.query,l.setQuery(e))}function i(e){void 0!==m&&m!==e&&l.search()}function a(e){r(e),i(e)}var c=e.state,l=e.helper,f=e.onHistoryChange,p="INPUT"===t.tagName,h=this._input=this.getInput(),m=void 0;if(this.addDefaultAttributesToInput(h,c.query),E||o(h,F,u(r)),S?o(h,"keyup",s(j,u(n))):(o(h,F,u(n)),("propertychange"===F||window.attachEvent)&&(o(h,"keyup",s(P,u(r))),o(h,"keyup",s(P,u(n))))),p){var v=document.createElement("div");h.parentNode.insertBefore(v,h);var y=h.parentNode,b=g?this.wrapInput(h):h;y.replaceChild(b,v)}else{var _=g?this.wrapInput(h):h;t.appendChild(_)}d&&this.addPoweredBy(h),f(function(e){h.value=e.query||""}),window.addEventListener("pageshow",function(){h.value=l.state.query}),(w===!0||"auto"===w&&""===l.state.query)&&(h.focus(),h.setSelectionRange(l.state.query.length,l.state.query.length))},render:function(e){var t=e.helper;document.activeElement!==this._input&&t.state.query!==this._input.value&&(this._input.value=t.state.query)}}}function o(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}function a(e){return(e.currentTarget?e.currentTarget:e.srcElement).value}function s(e,t){return function(n){return n.keyCode===e&&t(n)}}function u(e){return function(t){return e(a(t))}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(328),f=n(155),p=r(f),d=n(194),h=r(d),m=n(43),v=r(m),g=n(330),y=r(g),b=n(336),_=r(b),w=n(382),x=r(w),R=(0,l.bemHelper)("ais-search-box"),j=13,P=8,C="Usage:\nsearchBox({\n container,\n [ placeholder ],\n [ cssClasses.{input,poweredBy} ],\n [ poweredBy=false || poweredBy.{template, cssClasses.{root,link}} ],\n [ wrapInput ],\n [ autofocus ],\n [ searchOnEnterKeyPressOnly ],\n [ queryHook ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={poweredBy:'\n<div class="{{cssClasses.root}}">\n Search by\n <a class="{{cssClasses.link}}" href="{{url}}" target="_blank">Algolia</a>\n</div>'}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.tooltips,o=void 0===r||r,a=e.templates,u=void 0===a?j:a,f=e.collapsible,d=void 0!==f&&f,m=e.cssClasses,g=void 0===m?{}:m,b=e.step,w=void 0===b?1:b,C=e.pips,O=void 0===C||C,S=e.autoHideContainer,E=void 0===S||S,F=e.min,k=e.max;if(!t||!n)throw new Error(P);var N=(0,l.getContainerNode)(t),T=(0,v.default)(_.default);E===!0&&(T=(0,h.default)(T));var A={root:(0,y.default)(R(null),g.root),header:(0,y.default)(R("header"),g.header),body:(0,y.default)(R("body"),g.body),footer:(0,y.default)(R("footer"),g.footer)};return{getConfiguration:function(e){var t={disjunctiveFacets:[n]};return void 0===F&&void 0===k||e&&(!e.numericRefinements||void 0!==e.numericRefinements[n])||(t.numericRefinements=i({},n,{}),void 0!==F&&(t.numericRefinements[n][">="]=[F]),void 0!==k&&(t.numericRefinements[n]["<="]=[k])),t},_getCurrentRefinement:function(e){var t=e.state.getNumericRefinement(n,">="),r=e.state.getNumericRefinement(n,"<=");return t=t&&t.length?t[0]:-(1/0),r=r&&r.length?r[0]:1/0,{min:t,max:r}},_refine:function(e,t,r){e.clearRefinements(n),r[0]>t.min&&e.addNumericRefinement(n,">=",r[0]),r[1]<t.max&&e.addNumericRefinement(n,"<=",r[1]),e.search()},init:function(e){var t=e.templatesConfig;this._templateProps=(0,l.prepareTemplateProps)({defaultTemplates:j,templatesConfig:t,templates:u})},render:function(e){var t=e.results,r=e.helper,i=(0,p.default)(t.disjunctiveFacets,{name:n}),a=void 0!==i&&void 0!==i.stats?i.stats:{min:null,max:null},u=(0,x.default)(w)?function(e){return Math.round(Number(e)).toLocaleString()}:function(e){return Number(e).toLocaleString()};void 0!==F&&(a.min=F),void 0!==k&&(a.max=k);var l=this._getCurrentRefinement(r);void 0!==o.format&&(o=[{to:o.format},{to:o.format}]),c.default.render(s.default.createElement(T,{collapsible:d,cssClasses:A,onChange:this._refine.bind(this,r,a),pips:O,range:{min:Math.floor(a.min),max:Math.ceil(a.max)},shouldAutoHideContainer:a.min===a.max,start:[l.min,l.max],step:w,templateProps:this._templateProps,tooltips:o,pipsFormatter:u}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(195),p=r(f),d=n(331),h=r(d),m=n(332),v=r(m),g=n(330),y=r(g),b=n(384),_=r(b),w=n(387),x=r(w),R=(0,l.bemHelper)("ais-range-slider"),j={header:"",footer:""},P="Usage:\nrangeSlider({\n container,\n attributeName,\n [ tooltips=true ],\n [ templates.{header, footer} ],\n [ cssClasses.{root, header, body, footer} ],\n [ step=1 ],\n [ pips=true ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ min ],\n [ max ]\n});\n";t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(167),p=r(f),d=n(385),h=r(d),m=n(192),v=r(m),g="ais-range-slider--",y=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,v.default)(this.props.range,e.range)||!(0,v.default)(this.props.start,e.start)}},{key:"handleChange",value:function(e,t,n){this.props.onChange(n)}},{key:"render",value:function(){if(this.props.range.min===this.props.range.max)return null;var e=void 0;return e=this.props.pips===!1?void 0:this.props.pips===!0||"undefined"==typeof this.props.pips?{mode:"positions",density:3,values:[0,50,100],stepped:!0,format:{to:this.props.pipsFormatter}}:this.props.pips,l.default.createElement(h.default,s({},(0,p.default)(this.props,["cssClasses","pipsFormatter"]),{animate:!1,behaviour:"snap",connect:!0,cssPrefix:g,onChange:this.handleChange,pips:e}))}}]),t}(l.default.Component);t.default=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(a)}var c=Object.getPrototypeOf(i);if(null===c)return;e=c,t=o,n=a,r=!0,s=c=void 0}},c=n(325),l=r(c),f=n(386),p=r(f),d=function(e){function t(){i(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return o(t,e),s(t,[{key:"componentDidMount",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.createSlider()}},{key:"componentDidUpdate",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.slider.destroy(),this.createSlider()}},{key:"componentWillUnmount",value:function(){this.slider.destroy()}},{key:"createSlider",value:function(){var e=this.slider=p.default.create(this.sliderContainer,a({},this.props));this.props.onUpdate&&e.on("update",this.props.onUpdate),this.props.onChange&&e.on("change",this.props.onChange),this.props.onSlide&&e.on("slide",this.props.onSlide),this.props.onStart&&e.on("start",this.props.onStart),this.props.onEnd&&e.on("end",this.props.onEnd)}},{key:"render",value:function(){var e=this;return l.default.createElement("div",{ref:function(t){e.sliderContainer=t}})}}]),t}(l.default.Component);d.propTypes={animate:l.default.PropTypes.bool,behaviour:l.default.PropTypes.string,connect:l.default.PropTypes.oneOfType([l.default.PropTypes.oneOf(["lower","upper"]),l.default.PropTypes.bool]),cssPrefix:l.default.PropTypes.string,direction:l.default.PropTypes.oneOf(["ltr","rtl"]),disabled:l.default.PropTypes.bool,limit:l.default.PropTypes.number,margin:l.default.PropTypes.number,onChange:l.default.PropTypes.func,onEnd:l.default.PropTypes.func,onSlide:l.default.PropTypes.func,onStart:l.default.PropTypes.func,onUpdate:l.default.PropTypes.func,orientation:l.default.PropTypes.oneOf(["horizontal","vertical"]),pips:l.default.PropTypes.object,range:l.default.PropTypes.object.isRequired,start:l.default.PropTypes.arrayOf(l.default.PropTypes.number).isRequired, step:l.default.PropTypes.number,tooltips:l.default.PropTypes.oneOfType([l.default.PropTypes.bool,l.default.PropTypes.arrayOf(l.default.PropTypes.shape({to:l.default.PropTypes.func}))])},e.exports=d},function(e,t,n){var r,i,o;!function(n){i=[],r=n,o="function"==typeof r?r.apply(t,i):r,!(void 0!==o&&(e.exports=o))}(function(){"use strict";function e(e){return e.filter(function(e){return!this[e]&&(this[e]=!0)},{})}function t(e,t){return Math.round(e/t)*t}function n(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.documentElement,i=f();return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0),{top:t.top+i.y-r.clientTop,left:t.left+i.x-r.clientLeft}}function r(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function i(e,t,n){u(e,t),setTimeout(function(){c(e,t)},n)}function o(e){return Math.max(Math.min(e,100),0)}function a(e){return Array.isArray(e)?e:[e]}function s(e){var t=e.split(".");return t.length>1?t[1].length:0}function u(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function c(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function l(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function f(){var e=void 0!==window.pageXOffset,t="CSS1Compat"===(document.compatMode||""),n=e?window.pageXOffset:t?document.documentElement.scrollLeft:document.body.scrollLeft,r=e?window.pageYOffset:t?document.documentElement.scrollTop:document.body.scrollTop;return{x:n,y:r}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function d(e,t){return 100/(t-e)}function h(e,t){return 100*t/(e[1]-e[0])}function m(e,t){return h(e,e[0]<0?t+Math.abs(e[0]):t-e[0])}function v(e,t){return t*(e[1]-e[0])/100+e[0]}function g(e,t){for(var n=1;e>=t[n];)n+=1;return n}function y(e,t,n){if(n>=e.slice(-1)[0])return 100;var r,i,o,a,s=g(n,e);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],o+m([r,i],n)/d(o,a)}function b(e,t,n){if(n>=100)return e.slice(-1)[0];var r,i,o,a,s=g(n,t);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],v([r,i],(n-o)*d(o,a))}function _(e,n,r,i){if(100===i)return i;var o,a,s=g(i,e);return r?(o=e[s-1],a=e[s],i-o>(a-o)/2?a:o):n[s-1]?e[s-1]+t(i-e[s-1],n[s-1]):i}function w(e,t,n){var i;if("number"==typeof t&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(t))throw new Error("noUiSlider: 'range' contains invalid value.");if(i="min"===e?0:"max"===e?100:parseFloat(e),!r(i)||!r(t[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");n.xPct.push(i),n.xVal.push(t[0]),i?n.xSteps.push(!isNaN(t[1])&&t[1]):isNaN(t[1])||(n.xSteps[0]=t[1])}function x(e,t,n){return!t||void(n.xSteps[e]=h([n.xVal[e],n.xVal[e+1]],t)/d(n.xPct[e],n.xPct[e+1]))}function R(e,t,n,r){this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.snap=t,this.direction=n;var i,o=[];for(i in e)e.hasOwnProperty(i)&&o.push([e[i],i]);for(o.length&&"object"==typeof o[0][0]?o.sort(function(e,t){return e[0][0]-t[0][0]}):o.sort(function(e,t){return e[0]-t[0]}),i=0;i<o.length;i++)w(o[i][1],o[i][0],this);for(this.xNumSteps=this.xSteps.slice(0),i=0;i<this.xNumSteps.length;i++)x(i,this.xNumSteps[i],this)}function j(e,t){if(!r(t))throw new Error("noUiSlider: 'step' is not numeric.");e.singleStep=t}function P(e,t){if("object"!=typeof t||Array.isArray(t))throw new Error("noUiSlider: 'range' is not an object.");if(void 0===t.min||void 0===t.max)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");if(t.min===t.max)throw new Error("noUiSlider: 'range' 'min' and 'max' cannot be equal.");e.spectrum=new R(t,e.snap,e.dir,e.singleStep)}function C(e,t){if(t=a(t),!Array.isArray(t)||!t.length||t.length>2)throw new Error("noUiSlider: 'start' option is incorrect.");e.handles=t.length,e.start=t}function O(e,t){if(e.snap=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function S(e,t){if(e.animate=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function E(e,t){if(e.animationDuration=t,"number"!=typeof t)throw new Error("noUiSlider: 'animationDuration' option must be a number.")}function F(e,t){if("lower"===t&&1===e.handles)e.connect=1;else if("upper"===t&&1===e.handles)e.connect=2;else if(t===!0&&2===e.handles)e.connect=3;else{if(t!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");e.connect=0}}function k(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function N(e,t){if(!r(t))throw new Error("noUiSlider: 'margin' option must be numeric.");if(0!==t&&(e.margin=e.spectrum.getMargin(t),!e.margin))throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function T(e,t){if(!r(t))throw new Error("noUiSlider: 'limit' option must be numeric.");if(e.limit=e.spectrum.getMargin(t),!e.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function A(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1,e.connect=[0,2,1,3][e.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function M(e,t){if("string"!=typeof t)throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,i=t.indexOf("fixed")>=0,o=t.indexOf("snap")>=0,a=t.indexOf("hover")>=0;if(r&&!e.connect)throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");e.events={tap:n||o,drag:r,fixed:i,snap:o,hover:a}}function H(e,t){var n;if(t!==!1)if(t===!0)for(e.tooltips=[],n=0;n<e.handles;n++)e.tooltips.push(!0);else{if(e.tooltips=a(t),e.tooltips.length!==e.handles)throw new Error("noUiSlider: must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!=typeof e||"function"!=typeof e.to))throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")})}}function L(e,t){if(e.format=t,"function"==typeof t.to&&"function"==typeof t.from)return!0;throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.")}function U(e,t){if(void 0!==t&&"string"!=typeof t&&t!==!1)throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");e.cssPrefix=t}function D(e,t){if(void 0!==t&&"object"!=typeof t)throw new Error("noUiSlider: 'cssClasses' must be an object.");if("string"==typeof e.cssPrefix){e.cssClasses={};for(var n in t)t.hasOwnProperty(n)&&(e.cssClasses[n]=e.cssPrefix+t[n])}else e.cssClasses=t}function I(e){var t,n={margin:0,limit:0,animate:!0,animationDuration:300,format:B};t={step:{r:!1,t:j},start:{r:!0,t:C},connect:{r:!0,t:F},direction:{r:!0,t:A},snap:{r:!1,t:O},animate:{r:!1,t:S},animationDuration:{r:!1,t:E},range:{r:!0,t:P},orientation:{r:!1,t:k},margin:{r:!1,t:N},limit:{r:!1,t:T},behaviour:{r:!0,t:M},format:{r:!1,t:L},tooltips:{r:!1,t:H},cssPrefix:{r:!1,t:U},cssClasses:{r:!1,t:D}};var r={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",stacking:"stacking",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"}};return Object.keys(t).forEach(function(i){if(void 0===e[i]&&void 0===r[i]){if(t[i].r)throw new Error("noUiSlider: '"+i+"' is required.");return!0}t[i].t(n,void 0===e[i]?r[i]:e[i])}),n.pips=e.pips,n.style=n.ort?"top":"left",n}function V(t,r,d){function h(e,t,n){var r=e+t[0],i=e+t[1];return n?(r<0&&(i+=Math.abs(r)),i>100&&(r-=i-100),[o(r),o(i)]):[r,i]}function m(e,t){e.preventDefault();var n,r,i=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),a=0===e.type.indexOf("pointer"),s=e;return 0===e.type.indexOf("MSPointer")&&(a=!0),i&&(n=e.changedTouches[0].pageX,r=e.changedTouches[0].pageY),t=t||f(),(o||a)&&(n=e.clientX+t.x,r=e.clientY+t.y),s.pageOffset=t,s.points=[n,r],s.cursor=o||a,s}function v(e,t){var n=document.createElement("div"),i=document.createElement("div"),o=[r.cssClasses.handleLower,r.cssClasses.handleUpper];return e&&o.reverse(),u(i,r.cssClasses.handle),u(i,o[t]),u(n,r.cssClasses.origin),n.appendChild(i),n}function g(e,t,n){switch(e){case 1:u(t,r.cssClasses.connect),u(n[0],r.cssClasses.background);break;case 3:u(n[1],r.cssClasses.background);case 2:u(n[0],r.cssClasses.connect);case 0:u(t,r.cssClasses.background)}}function y(e,t,n){var r,i=[];for(r=0;r<e;r+=1)i.push(n.appendChild(v(t,r)));return i}function b(e,t,n){u(n,r.cssClasses.target),0===e?u(n,r.cssClasses.ltr):u(n,r.cssClasses.rtl),0===t?u(n,r.cssClasses.horizontal):u(n,r.cssClasses.vertical);var i=document.createElement("div");return u(i,r.cssClasses.base),n.appendChild(i),i}function _(e,t){if(!r.tooltips[t])return!1;var n=document.createElement("div");return n.className=r.cssClasses.tooltip,e.firstChild.appendChild(n)}function w(){r.dir&&r.tooltips.reverse();var e=$.map(_);r.dir&&(e.reverse(),r.tooltips.reverse()),Q("update",function(t,n,i){e[n]&&(e[n].innerHTML=r.tooltips[n]===!0?t[n]:r.tooltips[n].to(i[n]))})}function x(e,t,n){if("range"===e||"steps"===e)return Z.xVal;if("count"===e){var r,i=100/(t-1),o=0;for(t=[];(r=o++*i)<=100;)t.push(r);e="positions"}return"positions"===e?t.map(function(e){return Z.fromStepping(n?Z.getStep(e):e)}):"values"===e?n?t.map(function(e){return Z.fromStepping(Z.getStep(Z.toStepping(e)))}):t:void 0}function R(t,n,r){function i(e,t){return(e+t).toFixed(7)/1}var o=Z.direction,a={},s=Z.xVal[0],u=Z.xVal[Z.xVal.length-1],c=!1,l=!1,f=0;return Z.direction=0,r=e(r.slice().sort(function(e,t){return e-t})),r[0]!==s&&(r.unshift(s),c=!0),r[r.length-1]!==u&&(r.push(u),l=!0),r.forEach(function(e,o){var s,u,p,d,h,m,v,g,y,b,_=e,w=r[o+1];if("steps"===n&&(s=Z.xNumSteps[o]),s||(s=w-_),_!==!1&&void 0!==w)for(u=_;u<=w;u=i(u,s)){for(d=Z.toStepping(u),h=d-f,g=h/t,y=Math.round(g),b=h/y,p=1;p<=y;p+=1)m=f+p*b,a[m.toFixed(5)]=["x",0];v=r.indexOf(u)>-1?1:"steps"===n?2:0,!o&&c&&(v=0),u===w&&l||(a[d.toFixed(5)]=[u,v]),f=d}}),Z.direction=o,a}function j(e,t,n){function i(e,t){var n=t===r.cssClasses.value,i=n?p:d,o=n?l:f;return t+" "+i[r.ort]+" "+o[e]}function o(e,t,n){return'class="'+i(n[1],t)+'" style="'+r.style+": "+e+'%"'}function a(e,i){Z.direction&&(e=100-e),i[1]=i[1]&&t?t(i[0],i[1]):i[1],c+="<div "+o(e,r.cssClasses.marker,i)+"></div>",i[1]&&(c+="<div "+o(e,r.cssClasses.value,i)+">"+n.to(i[0])+"</div>")}var s=document.createElement("div"),c="",l=[r.cssClasses.valueNormal,r.cssClasses.valueLarge,r.cssClasses.valueSub],f=[r.cssClasses.markerNormal,r.cssClasses.markerLarge,r.cssClasses.markerSub],p=[r.cssClasses.valueHorizontal,r.cssClasses.valueVertical],d=[r.cssClasses.markerHorizontal,r.cssClasses.markerVertical];return u(s,r.cssClasses.pips),u(s,0===r.ort?r.cssClasses.pipsHorizontal:r.cssClasses.pipsVertical),Object.keys(e).forEach(function(t){a(t,e[t])}),s.innerHTML=c,s}function P(e){var t=e.mode,n=e.density||1,r=e.filter||!1,i=e.values||!1,o=e.stepped||!1,a=x(t,i,o),s=R(n,t,a),u=e.format||{to:Math.round};return X.appendChild(j(s,r,u))}function C(){var e=K.getBoundingClientRect(),t="offset"+["Width","Height"][r.ort];return 0===r.ort?e.width||K[t]:e.height||K[t]}function O(e,t,n){var i;for(i=0;i<r.handles;i++)if(Y[i]===-1)return;void 0!==t&&1!==r.handles&&(t=Math.abs(t-r.dir)),Object.keys(te).forEach(function(r){var i=r.split(".")[0];e===i&&te[r].forEach(function(e){e.call(J,a(V()),t,a(S(Array.prototype.slice.call(ee))),n||!1,Y)})})}function S(e){return 1===e.length?e[0]:r.dir?e.reverse():e}function E(e,t,n,i){var o=function(t){return!X.hasAttribute("disabled")&&(!l(X,r.cssClasses.tap)&&(t=m(t,i.pageOffset),!(e===G.start&&void 0!==t.buttons&&t.buttons>1)&&((!i.hover||!t.buttons)&&(t.calcPoint=t.points[r.ort],void n(t,i)))))},a=[];return e.split(" ").forEach(function(e){t.addEventListener(e,o,!1),a.push([e,o])}),a}function F(e,t){if(navigator.appVersion.indexOf("MSIE 9")===-1&&0===e.buttons&&0!==t.buttonsProperty)return k(e,t);var n,r,i=t.handles||$,o=!1,a=100*(e.calcPoint-t.start)/t.baseSize,s=i[0]===$[0]?0:1;if(n=h(a,t.positions,i.length>1),o=L(i[0],n[s],1===i.length),i.length>1){if(o=L(i[1],n[s?0:1],!1)||o)for(r=0;r<t.handles.length;r++)O("slide",r)}else o&&O("slide",s)}function k(e,t){var n=K.querySelector("."+r.cssClasses.active),i=t.handles[0]===$[0]?0:1;null!==n&&c(n,r.cssClasses.active),e.cursor&&(document.body.style.cursor="",document.body.removeEventListener("selectstart",document.body.noUiListener));var o=document.documentElement;o.noUiListeners.forEach(function(e){o.removeEventListener(e[0],e[1])}),c(X,r.cssClasses.drag),O("set",i),O("change",i),void 0!==t.handleNumber&&O("end",t.handleNumber)}function N(e,t){"mouseout"===e.type&&"HTML"===e.target.nodeName&&null===e.relatedTarget&&k(e,t)}function T(e,t){var n=document.documentElement;if(1===t.handles.length){if(t.handles[0].hasAttribute("disabled"))return!1;u(t.handles[0].children[0],r.cssClasses.active)}e.preventDefault(),e.stopPropagation();var i=E(G.move,n,F,{start:e.calcPoint,baseSize:C(),pageOffset:e.pageOffset,handles:t.handles,handleNumber:t.handleNumber,buttonsProperty:e.buttons,positions:[Y[0],Y[$.length-1]]}),o=E(G.end,n,k,{handles:t.handles,handleNumber:t.handleNumber}),a=E("mouseout",n,N,{handles:t.handles,handleNumber:t.handleNumber});if(n.noUiListeners=i.concat(o,a),e.cursor){document.body.style.cursor=getComputedStyle(e.target).cursor,$.length>1&&u(X,r.cssClasses.drag);var s=function(){return!1};document.body.noUiListener=s,document.body.addEventListener("selectstart",s,!1)}void 0!==t.handleNumber&&O("start",t.handleNumber)}function A(e){var t,o,a=e.calcPoint,s=0;return e.stopPropagation(),$.forEach(function(e){s+=n(e)[r.style]}),t=a<s/2||1===$.length?0:1,$[t].hasAttribute("disabled")&&(t=t?0:1),a-=n(K)[r.style],o=100*a/C(),r.events.snap||i(X,r.cssClasses.tap,r.animationDuration),!$[t].hasAttribute("disabled")&&(L($[t],o),O("slide",t,!0),O("set",t,!0),O("change",t,!0),void(r.events.snap&&T(e,{handles:[$[t]]})))}function M(e){var t=e.calcPoint-n(K)[r.style],i=Z.getStep(100*t/C()),o=Z.fromStepping(i);Object.keys(te).forEach(function(e){"hover"===e.split(".")[0]&&te[e].forEach(function(e){e.call(J,o)})})}function H(e){if(e.fixed||$.forEach(function(e,t){E(G.start,e.children[0],T,{handles:[e],handleNumber:t})}),e.tap&&E(G.start,K,A,{handles:$}),e.hover&&E(G.move,K,M,{hover:!0}),e.drag){var t=[K.querySelector("."+r.cssClasses.connect)];u(t[0],r.cssClasses.draggable),e.fixed&&t.push($[t[0]===$[0]?1:0].children[0]),t.forEach(function(e){E(G.start,e,T,{handles:$})})}}function L(e,t,n){var i=e!==$[0]?1:0,a=Y[0]+r.margin,s=Y[1]-r.margin,l=Y[0]+r.limit,f=Y[1]-r.limit;return $.length>1&&(t=i?Math.max(t,a):Math.min(t,s)),n!==!1&&r.limit&&$.length>1&&(t=i?Math.min(t,l):Math.max(t,f)),t=Z.getStep(t),t=o(t),t!==Y[i]&&(window.requestAnimationFrame?window.requestAnimationFrame(function(){e.style[r.style]=t+"%"}):e.style[r.style]=t+"%",e.previousSibling||(c(e,r.cssClasses.stacking),t>50&&u(e,r.cssClasses.stacking)),Y[i]=t,ee[i]=Z.fromStepping(t),O("update",i),!0)}function U(e,t){var n,i,o;for(r.limit&&(e+=1),n=0;n<e;n+=1)i=n%2,o=t[i],null!==o&&o!==!1&&("number"==typeof o&&(o=String(o)),o=r.format.from(o),(o===!1||isNaN(o)||L($[i],Z.toStepping(o),n===3-r.dir)===!1)&&O("update",i))}function D(e,t){var n,o,s=a(e);for(t=void 0===t||!!t,r.dir&&r.handles>1&&s.reverse(),r.animate&&Y[0]!==-1&&i(X,r.cssClasses.tap,r.animationDuration),n=$.length>1?3:1,1===s.length&&(n=1),U(n,s),o=0;o<$.length;o++)null!==s[o]&&t&&O("set",o)}function V(){var e,t=[];for(e=0;e<r.handles;e+=1)t[e]=r.format.to(ee[e]);return S(t)}function q(){for(var e in r.cssClasses)r.cssClasses.hasOwnProperty(e)&&c(X,r.cssClasses[e]);for(;X.firstChild;)X.removeChild(X.firstChild);delete X.noUiSlider}function B(){var e=Y.map(function(e,t){var n=Z.getApplicableStep(e),r=s(String(n[2])),i=ee[t],o=100===e?null:n[2],a=Number((i-n[2]).toFixed(r)),u=0===e?null:a>=n[1]?n[2]:n[0]||!1;return[u,o]});return S(e)}function Q(e,t){te[e]=te[e]||[],te[e].push(t),"update"===e.split(".")[0]&&$.forEach(function(e,t){O("update",t)})}function z(e){var t=e&&e.split(".")[0],n=t&&e.substring(t.length);Object.keys(te).forEach(function(e){var r=e.split(".")[0],i=e.substring(r.length);t&&t!==r||n&&n!==i||delete te[e]})}function W(e,t){var n=V(),i=I({start:[0,0],margin:e.margin,limit:e.limit,step:void 0===e.step?r.singleStep:e.step,range:e.range,animate:e.animate,snap:void 0===e.snap?r.snap:e.snap});["margin","limit","range","animate"].forEach(function(t){void 0!==e[t]&&(r[t]=e[t])}),i.spectrum.direction=Z.direction,Z=i.spectrum,Y=[-1,-1],D(e.start||n,t)}var K,$,J,G=p(),X=t,Y=[-1,-1],Z=r.spectrum,ee=[],te={};if(X.noUiSlider)throw new Error("Slider was already initialized.");return K=b(r.dir,r.ort,X),$=y(r.handles,r.dir,K),g(r.connect,X,$),r.pips&&P(r.pips),r.tooltips&&w(),J={destroy:q,steps:B,on:Q,off:z,get:V,set:D,updateOptions:W,options:d,target:X,pips:P},H(r.events),J}function q(e,t){if(!e.nodeName)throw new Error("noUiSlider.create requires a single element.");var n=I(t,e),r=V(e,n,t);return r.set(n.start),e.noUiSlider=r,r}R.prototype.getMargin=function(e){return 2===this.xPct.length&&h(this.xVal,e)},R.prototype.toStepping=function(e){return e=y(this.xVal,this.xPct,e),this.direction&&(e=100-e),e},R.prototype.fromStepping=function(e){return this.direction&&(e=100-e),b(this.xVal,this.xPct,e)},R.prototype.getStep=function(e){return this.direction&&(e=100-e),e=_(this.xPct,this.xSteps,this.snap,e),this.direction&&(e=100-e),e},R.prototype.getApplicableStep=function(e){var t=g(e,this.xPct),n=100===e?2:1;return[this.xNumSteps[t-2],this.xVal[t-n],this.xNumSteps[t-n]]},R.prototype.convert=function(e){return this.getStep(this.toStepping(e))};var B={to:function(e){return void 0!==e&&e.toFixed(2)},from:Number};return{create:q}})},function(e,t,n){var r=n(388);e.exports=Number.isInteger||function(e){return"number"==typeof e&&r(e)&&Math.floor(e)===e}},function(e,t,n){"use strict";var r=n(389);e.exports=Number.isFinite||function(e){return!("number"!=typeof e||r(e)||e===1/0||e===-(1/0))}},function(e,t){"use strict";e.exports=Number.isNaN||function(e){return e!==e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.indices,r=e.cssClasses,i=void 0===r?{}:r,o=e.autoHideContainer,s=void 0!==o&&o;if(!t||!n)throw new Error(w);var c=(0,d.getContainerNode)(t),f=b.default;s===!0&&(f=(0,g.default)(f));var h=(0,p.default)(n,function(e){return{label:e.label,value:e.name}}),v={root:(0,m.default)(_(null),i.root),item:(0,m.default)(_("item"),i.item)};return{init:function(e){var t=e.helper,r=t.getIndex(),i=(0,l.default)(n,{name:r})!==-1;if(!i)throw new Error("[sortBySelector]: Index "+r+" not present in `indices`");this.setIndex=function(e){return t.setIndex(e).search()}},render:function(e){var t=e.helper,n=e.results;u.default.render(a.default.createElement(f,{cssClasses:v,currentValue:t.getIndex(),options:h,setValue:this.setIndex,shouldAutoHideContainer:0===n.nbHits}),c)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(197),l=r(c),f=n(162),p=r(f),d=n(328),h=n(330),m=r(h),v=n(331),g=r(v),y=n(357),b=r(y),_=(0,d.bemHelper)("ais-sort-by-selector"),w="Usage:\nsortBySelector({\n container,\n indices,\n [cssClasses.{root,item}={}],\n [autoHideContainer=false]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributeName,r=e.max,i=void 0===r?5:r,o=e.cssClasses,s=void 0===o?{}:o,l=e.labels,p=void 0===l?b.default:l,h=e.templates,v=void 0===h?g.default:h,y=e.collapsible,_=void 0!==y&&y,j=e.transformData,P=e.autoHideContainer,C=void 0===P||P,O=(0,c.getContainerNode)(t),S=(0,m.default)(w.default);if(C===!0&&(S=(0,d.default)(S)),!t||!n)throw new Error(R);var E={root:(0,f.default)(x(null),s.root),header:(0,f.default)(x("header"),s.header),body:(0,f.default)(x("body"),s.body),footer:(0,f.default)(x("footer"),s.footer),list:(0,f.default)(x("list"),s.list),item:(0,f.default)(x("item"),s.item),link:(0,f.default)(x("link"),s.link),disabledLink:(0,f.default)(x("link","disabled"),s.disabledLink),count:(0,f.default)(x("count"),s.count),star:(0,f.default)(x("star"),s.star),emptyStar:(0,f.default)(x("star","empty"),s.emptyStar),active:(0,f.default)(x("item","active"),s.active)};return{getConfiguration:function(){return{disjunctiveFacets:[n]}},init:function(e){var t=e.templatesConfig,n=e.helper;this._templateProps=(0,c.prepareTemplateProps)({transformData:j,defaultTemplates:g.default,templatesConfig:t,templates:v}),this._toggleRefinement=this._toggleRefinement.bind(this,n)},render:function(e){function t(e){return c(s.toggleRefinement(n,e))}for(var r=e.helper,o=e.results,s=e.state,c=e.createURL,l=[],f={},d=i-1;d>=0;--d)f[d]=0;o.getFacetValues(n).forEach(function(e){var t=Math.round(e.name);if(t&&!(t>i-1))for(var n=t;n>=1;--n)f[n]+=e.count});for(var h=this._getRefinedStar(r),m=i-1;m>=1;--m){var v=f[m];if(!h||m===h||0!==v){for(var g=[],y=1;y<=i;++y)g.push(y<=m);l.push({stars:g,name:String(m),count:v,isRefined:h===m,labels:p})}}u.default.render(a.default.createElement(S,{collapsible:_,createURL:t,cssClasses:E,facetValues:l,shouldAutoHideContainer:0===o.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),O)},_toggleRefinement:function(e,t){var r=this._getRefinedStar(e)===Number(t);if(e.clearRefinements(n),!r)for(var o=Number(t);o<=i;++o)e.addDisjunctiveFacetRefinement(n,o);e.search()},_getRefinedStar:function(e){var t=void 0,r=e.getRefinements(n);return r.forEach(function(e){(!t||Number(e.value)<t)&&(t=Number(e.value))}),t}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(392),g=r(v),y=n(393),b=r(y),_=n(347),w=r(_),x=(0,c.bemHelper)("ais-star-rating"),R="Usage:\nstarRating({\n container,\n attributeName,\n [ max=5 ],\n [ cssClasses.{root,header,body,footer,list,item,active,link,disabledLink,star,emptyStar,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ labels.{andUp} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}{{^count}} {{cssClasses.disabledLink}}{{/count}}" {{#count}}href="{{href}}"{{/count}}>\n {{#stars}}<span class="{{#.}}{{cssClasses.star}}{{/.}}{{^.}}{{cssClasses.emptyStar}}{{/.}}"></span>{{/stars}}\n {{labels.andUp}}\n {{#count}}<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>{{/count}}\n</a>',footer:""}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={andUp:"& Up"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.autoHideContainer,o=void 0===i||i,s=e.templates,l=void 0===s?b.default:s,p=e.collapsible,h=void 0!==p&&p,v=e.transformData;if(!t)throw new Error(w);var y=(0,c.getContainerNode)(t),x=(0,d.default)(m.default);if(o===!0&&(x=(0,f.default)(x)),!y)throw new Error(w);var R={body:(0,g.default)(_("body"),r.body),footer:(0,g.default)(_("footer"),r.footer),header:(0,g.default)(_("header"),r.header),root:(0,g.default)(_(null),r.root),time:(0,g.default)(_("time"),r.time)};return{init:function(e){var t=e.templatesConfig;this._templateProps=(0,c.prepareTemplateProps)({transformData:v,defaultTemplates:b.default,templatesConfig:t,templates:l})},render:function(e){var t=e.results;u.default.render(a.default.createElement(x,{collapsible:h,cssClasses:R,hitsPerPage:t.hitsPerPage,nbHits:t.nbHits,nbPages:t.nbPages,page:t.page,processingTimeMS:t.processingTimeMS,query:t.query,shouldAutoHideContainer:0===t.nbHits,templateProps:this._templateProps}),y)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(331),f=r(l),p=n(332),d=r(p),h=n(395),m=r(h),v=n(330),g=r(v),y=n(396),b=r(y),_=(0,c.bemHelper)("ais-stats"),w="Usage:\nstats({\n container,\n [ templates.{header,body,footer} ],\n [ transformData.{body} ],\n [ autoHideContainer]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.nbHits!==e.hits||this.props.processingTimeMS!==e.processingTimeMS}},{key:"render",value:function(){var e={hasManyResults:this.props.nbHits>1,hasNoResults:0===this.props.nbHits,hasOneResult:1===this.props.nbHits,hitsPerPage:this.props.hitsPerPage,nbHits:this.props.nbHits,nbPages:this.props.nbPages,page:this.props.page,processingTimeMS:this.props.processingTimeMS,query:this.props.query,cssClasses:this.props.cssClasses};return l.default.createElement(p.default,s({data:e,templateKey:"body"},this.props.templateProps))}}]),t}(l.default.Component);t.default=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",body:'{{#hasNoResults}}No results{{/hasNoResults}}\n {{#hasOneResult}}1 result{{/hasOneResult}}\n {{#hasManyResults}}{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} results{{/hasManyResults}}\n <span class="{{cssClasses.time}}">found in {{processingTimeMS}}ms</span>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.label,i=e.values,a=void 0===i?{on:!0,off:void 0}:i,u=e.templates,l=void 0===u?s.default:u,p=e.collapsible,h=void 0!==p&&p,v=e.cssClasses,y=void 0===v?{}:v,R=e.transformData,j=e.autoHideContainer,P=void 0===j||j,C=(0,o.getContainerNode)(t);if(!t||!n||!r)throw new Error(x);var O=(0,d.default)(m.default);P===!0&&(O=(0,f.default)(O));var S=void 0!==a.off,E={root:(0,c.default)(_(null),y.root),header:(0,c.default)(_("header"),y.header),body:(0,c.default)(_("body"),y.body),footer:(0,c.default)(_("footer"),y.footer),list:(0,c.default)(_("list"),y.list),item:(0,c.default)(_("item"),y.item),active:(0,c.default)(_("item","active"),y.active),label:(0,c.default)(_("label"),y.label),checkbox:(0,c.default)(_("checkbox"),y.checkbox),count:(0,c.default)(_("count"),y.count)},F={attributeName:n,label:r,userValues:a,templates:l,collapsible:h,transformData:R,hasAnOffValue:S,containerNode:C,RefinementList:O,cssClasses:E};return{getConfiguration:function(e,t){var r=w(n,e)||w(n,t),i=r?(0,b.default)(F):(0,g.default)(F);return this.init=i.init.bind(i),this.render=i.render.bind(i),i.getConfiguration(e,t)},init:function(){},render:function(){}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(328),a=n(398),s=r(a),u=n(330),c=r(u),l=n(331),f=r(l),p=n(332),d=r(p),h=n(347),m=r(h),v=n(399),g=r(v),y=n(400),b=r(y),_=(0,o.bemHelper)("ais-toggle"),w=function(e,t){return t&&t.facetsRefinements&&void 0!==t.facetsRefinements[e]},x="Usage:\ntoggle({\n container,\n attributeName,\n label,\n [ values={on: true, off: undefined} ],\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(195),o=r(i),a=n(325),s=r(a),u=n(325),c=r(u),l=n(398),f=r(l),p=n(328),d=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.attributeName,n=e.label,r=e.userValues,i=e.templates,a=e.collapsible,u=e.transformData,l=e.hasAnOffValue,d=e.containerNode,h=e.RefinementList,m=e.cssClasses;return{getConfiguration:function(){return{disjunctiveFacets:[t]}},toggleRefinement:function(e,n,i){var o=r.on,a=r.off;i?(e.removeDisjunctiveFacetRefinement(t,o),l&&e.addDisjunctiveFacetRefinement(t,a)):(l&&e.removeDisjunctiveFacetRefinement(t,a),e.addDisjunctiveFacetRefinement(t,o)),e.search()},init:function(e){var n=e.state,o=e.helper,a=e.templatesConfig;if(this._templateProps=(0,p.prepareTemplateProps)({transformData:u,defaultTemplates:f.default,templatesConfig:a,templates:i}),this.toggleRefinement=this.toggleRefinement.bind(this,o),l){var s=n.isDisjunctiveFacetRefined(t,r.on);s||o.addDisjunctiveFacetRefinement(t,r.off)}},render:function(e){function i(){return v(p.removeDisjunctiveFacetRefinement(t,g?y:r.off).addDisjunctiveFacetRefinement(t,g?r.off:y))}var u=e.helper,f=e.results,p=e.state,v=e.createURL,g=u.state.isDisjunctiveFacetRefined(t,r.on),y=r.on,b=void 0!==r.off&&r.off,_=f.getFacetValues(t),w=(0,o.default)(_,{name:y.toString()}),x={name:n,isRefined:void 0!==w&&w.isRefined,count:void 0===w?null:w.count},R=l?(0,o.default)(_,{name:b.toString()}):void 0,j={name:n,isRefined:void 0!==R&&R.isRefined,count:void 0===R?f.nbHits:R.count},P=g?j:x,C={name:n,isRefined:g,count:void 0===P?null:P.count,onFacetValue:x,offFacetValue:j};c.default.render(s.default.createElement(h,{collapsible:a,createURL:i,cssClasses:m,facetValues:[C],shouldAutoHideContainer:0===C.count||null===C.count,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),d)}}};t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.attributeName,n=e.label,r=e.userValues,i=e.templates,o=e.collapsible,s=e.transformData,c=e.hasAnOffValue,f=e.containerNode,h=e.RefinementList,m=e.cssClasses;return{getConfiguration:function(){return{facets:[t]}},toggleRefinement:function(e,n,i){var o=r.on,a=r.off; i?(e.removeFacetRefinement(t,o),c&&e.addFacetRefinement(t,a)):(c&&e.removeFacetRefinement(t,a),e.addFacetRefinement(t,o)),e.search()},init:function(e){var n=e.state,o=e.helper,a=e.templatesConfig;if(this._templateProps=(0,d.prepareTemplateProps)({transformData:s,defaultTemplates:p.default,templatesConfig:a,templates:i}),this.toggleRefinement=this.toggleRefinement.bind(this,o),c){var u=n.isFacetRefined(t,r.on);u||o.addFacetRefinement(t,r.off)}},render:function(e){function i(){return d(p.toggleRefinement(t,v))}var s=e.helper,c=e.results,p=e.state,d=e.createURL,v=s.state.isFacetRefined(t,r.on),g=v?r.on:r.off,y=void 0;if("number"==typeof g)y=c.getFacetStats(t).sum;else{var b=(0,a.default)(c.getFacetValues(t),{name:v.toString()});y=void 0!==b?b.count:null}var _={name:n,isRefined:v,count:y};l.default.render(u.default.createElement(h,{collapsible:o,createURL:i,cssClasses:m,facetValues:[_],shouldAutoHideContainer:0===c.nbHits,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),f)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=n(195),a=r(o),s=n(325),u=r(s),c=n(325),l=r(c),f=n(398),p=r(f),d=n(328)}])}); //# sourceMappingURL=instantsearch-preact.min.js.map
public/app/components/app.js
threepears/react_todo
import React from 'react'; import ToDoHeader from './header'; import EntryForm from './entryform'; import Notes from './notes'; export default class App extends React.Component { constructor(props) { super(props); this.state = {todos: []}; } componentDidMount() { console.log("MOUNTING"); this.fetchTasks(); } // Get initial tasks from database fetchTasks() { fetch('/tasks', {method: 'GET'}) .then((response) => response.json()) .then((responseData) => { console.log("FETCHING", responseData); this.setState({todos: responseData}); }) .catch((err) => { throw new Error(err); }); } // Add task to database addTask(task) { fetch('/tasks/' + task, {method: 'POST'}) .then((response) => response.json()) .then((responseData) => { console.log("ADDING", responseData); this.fetchTasks(); }) .catch((err) => { throw new Error(err); }); } // Toggle task's completed status and save to database completeToggle(currentTask, currentState) { fetch('/tasks/complete/' + currentTask + '/' + currentState, {method: 'PUT'}) .then((response) => response.json()) .then((responseData) => { console.log("UPDATE COMPLETION", responseData); this.fetchTasks(); }) .catch((err) => { throw new Error(err); }); } // Delete task from database deleteTask(task) { fetch('/tasks/' + task, {method: 'DELETE'}) .then((response) => response.json()) .then((responseData) => { console.log("DELETING", responseData); this.fetchTasks(); }) .catch((err) => { throw new Error(err); }); } // Save an edited task name to database saveTask(oldTask, newTask) { fetch('/tasks/edit/' + oldTask + '/' + newTask, {method: 'PUT'}) .then((response) => response.json()) .then((responseData) => { console.log("UPDATE COMPLETION", responseData); this.fetchTasks(); }) .catch((err) => { throw new Error(err); }); } render() { return ( <div className='content'> <div className='content-left'> <ToDoHeader /> <EntryForm addTask={this.addTask.bind(this)} todos={this.state.todos} /> </div> <div className='content-right'> <Notes url="/tasks" todos={this.state.todos} deleteTask={this.deleteTask.bind(this)} saveTask={this.saveTask.bind(this)} completeToggle={this.completeToggle.bind(this)} /> </div> </div> ) } }
source/containers/DevTools.js
mpalmer685/DebtPayoffCalculator
import React from 'react' import { createDevTools } from 'redux-devtools' import LogMonitor from 'redux-devtools-log-monitor' import DockMonitor from 'redux-devtools-dock-monitor' export default createDevTools( <DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-w"> <LogMonitor /> </DockMonitor> )
src/components/Navigation/Navigation.js
louisukiri/react-starter-kit
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import cx from 'classnames'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './Navigation.css'; import Link from '../Link'; class Navigation extends React.Component { render() { return ( <div className={s.root} role="navigation"> <Link className={s.link} to="/about"> About </Link> <Link className={s.link} to="/contact"> Contact </Link> <span className={s.spacer}> | </span> <Link className={s.link} to="/login"> Log in </Link> <span className={s.spacer}>or</span> <Link className={cx(s.link, s.highlight)} to="/register"> Sign up </Link> </div> ); } } export default withStyles(s)(Navigation);
src/icons/ClosedCaptioning.js
fbfeix/react-icons
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class ClosedCaptioning extends React.Component { render() { if(this.props.bare) { return <g> <g> <g> <path d="M0,64v384h512V64H0z M464,255.825c0.045,26.724-1.547,47.143-3.797,80.223S441,392.5,401.097,396.168 C361.201,399.835,305.369,400.12,256,400c-49,0.12-105.198-0.165-145.094-3.832c-39.903-3.668-56.855-27.04-59.105-60.12 s-3.841-53.499-3.796-80.223c-0.045-26.725,0.095-44.124,3.798-80.224s23.01-56.267,59.106-59.934S201.842,112,248.704,112 c2.431,0,5.296,0,7.296,0c2.437,0,4.871,0,7.302,0c46.862,0,101.698,0,137.795,3.667s55.403,23.833,59.106,59.934 S464.045,229.1,464,255.825z"></path> </g> <g> <path d="M372,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566 c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566 c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746 c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291 c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488 c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748 c28.604,0,49.089-7.258,61.443-21.318C418.486,327.537,424.666,307,424.666,280H372C372,280,372,282.876,372,283.846z"></path> <path d="M195,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566 c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566 c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746 c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291 c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488 c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748 c28.604,0,49.089-7.258,61.443-21.318C241.486,327.537,247.666,307,247.666,280H195C195,280,195,282.876,195,283.846z"></path> </g> </g> </g>; } return <IconBase> <g> <g> <path d="M0,64v384h512V64H0z M464,255.825c0.045,26.724-1.547,47.143-3.797,80.223S441,392.5,401.097,396.168 C361.201,399.835,305.369,400.12,256,400c-49,0.12-105.198-0.165-145.094-3.832c-39.903-3.668-56.855-27.04-59.105-60.12 s-3.841-53.499-3.796-80.223c-0.045-26.725,0.095-44.124,3.798-80.224s23.01-56.267,59.106-59.934S201.842,112,248.704,112 c2.431,0,5.296,0,7.296,0c2.437,0,4.871,0,7.302,0c46.862,0,101.698,0,137.795,3.667s55.403,23.833,59.106,59.934 S464.045,229.1,464,255.825z"></path> </g> <g> <path d="M372,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566 c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566 c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746 c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291 c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488 c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748 c28.604,0,49.089-7.258,61.443-21.318C418.486,327.537,424.666,307,424.666,280H372C372,280,372,282.876,372,283.846z"></path> <path d="M195,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566 c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566 c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746 c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291 c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488 c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748 c28.604,0,49.089-7.258,61.443-21.318C241.486,327.537,247.666,307,247.666,280H195C195,280,195,282.876,195,283.846z"></path> </g> </g> </IconBase>; } };ClosedCaptioning.defaultProps = {bare: false}
app/app.js
rjzheng/REWBoilerplate
/* Node Modules */ import React from 'react'; import ReactDOM from 'react-dom'; import { Route, Router, IndexRoute, hashHistory } from 'react-router'; import { Provider } from 'react-redux'; /* Routes */ import routes from './routes'; /* Store */ import * as conf from 'configureStore'; // Init custom store configuration var store = conf.configure(); // Subscribe to state changes store.subscribe(() => { console.log('Store changed', store.getState()); }); // Render provider and routes to DOM ReactDOM.render( <Provider store={store}> <Router history={hashHistory} routes={routes} /> </Provider>, document.getElementById('app') );
examples/todos/src/Todo.js
FourSS/refar
import React from 'react' import { PureComponent } from 'react-pure-render' import { createContainer } from '../../../lib' class Todo extends PureComponent { // a little worker render() { const { id, text, completed } = this.props if (id === 456) { console.log(completed) } return ( <div> <div> <input type="checkbox" defaultChecked={completed} // https://github.com/facebook/react/issues/3005 onChange={e => e.stopPropagation() || this.props.toggleCompleted$.next({ completed: !completed, id })} /> <input value={text} onChange={e => e.preventDefault() || this.props.changeText$.next({ text: e.target.value, id })} /> <button onClick={e => this.props.deleteTodo$.next(this.props.index)}> Delete </button> </div> </div> ) } } export default createContainer(Todo, { root: false, fragments() { return { id: null, text: null, completed: null } }, interactions(model, intents) { const toggleCompleted$ = intents.get('toggleCompleted') toggleCompleted$. subscribe(({ completed, id }) => model.local.set({ todosById: { [id]: { completed } } })) const changeText$ = intents.get('changeText') changeText$. subscribe(({ text, id }) => model.local.set({ todosById: { [id]: { text } } })) const deleteTodo$ = intents.get('deleteTodo') deleteTodo$. subscribe(index => model.local.delete(['todos', index])) // subscribe(index => model.local.delete({ // todos: { // [index]: null // } // })) return { toggleCompleted$, changeText$, deleteTodo$ } } })
src/server.js
kswang2400/WOMO
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import 'babel/polyfill'; import _ from 'lodash'; import fs from 'fs'; import path from 'path'; import express from 'express'; import React from 'react'; import './core/Dispatcher'; import './stores/AppStore'; import db from './core/Database'; import App from './components/App'; const server = express(); server.set('port', (process.env.PORT || 5000)); server.use(express.static(path.join(__dirname, 'public'))); // // Register API middleware // ----------------------------------------------------------------------------- server.use('/api/query', require('./api/query')); // // Register server-side rendering middleware // ----------------------------------------------------------------------------- // The top-level React component + HTML template for it const templateFile = path.join(__dirname, 'templates/index.html'); const template = _.template(fs.readFileSync(templateFile, 'utf8')); server.get('*', async (req, res, next) => { try { let uri = req.path; let notFound = false; let css = []; let data = {description: ''}; let app = (<App path={req.path} context={{ onInsertCss: value => css.push(value), onSetTitle: value => data.title = value, onSetMeta: (key, value) => data[key] = value, onPageNotFound: () => notFound = true }} />); await db.getPage(uri); data.body = React.renderToString(app); data.css = css.join(''); let html = template(data); if (notFound) { res.status(404); } res.send(html); } catch (err) { next(err); } }); // // Launch the server // ----------------------------------------------------------------------------- server.listen(server.get('port'), () => { if (process.send) { process.send('online'); } else { console.log('The server is running at http://localhost:' + server.get('port')); } });
libs/react/0.5.2/react.js
xuminready/baiducdnstatic
/** * React v0.5.2 */ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.React=e():"undefined"!=typeof global?global.React=e():"undefined"!=typeof self&&(self.React=e())}(function(){var define,module,exports; return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule $ * @typechecks */ var ge = require("./ge"); var ex = require("./ex"); /** * Find a node by ID. * * If your application code depends on the existence of the element, use $, * which will throw if the element doesn't exist. * * If you're not sure whether or not the element exists, use ge instead, and * manually check for the element's existence in your application code. * * @param {string|DOMDocument|DOMElement|DOMTextNode|Comment} id * @return {DOMDocument|DOMElement|DOMTextNode|Comment} */ function $(id) { var element = ge(id); if (!element) { throw new Error(ex( 'Tried to get element with id of "%s" but it is not present on the page.', id )); } return element; } module.exports = $; },{"./ex":83,"./ge":87}],2:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule CSSProperty */ "use strict"; /** * CSS properties which accept numbers but are not in units of "px". */ var isUnitlessNumber = { fillOpacity: true, fontWeight: true, lineHeight: true, opacity: true, orphans: true, zIndex: true, zoom: true }; /** * Most style properties can be unset by doing .style[prop] = '' but IE8 * doesn't like doing that with shorthand properties so for the properties that * IE8 breaks on, which are listed here, we instead unset each of the * individual properties. See http://bugs.jquery.com/ticket/12385. * The 4-value 'clock' properties like margin, padding, border-width seem to * behave without any problems. Curiously, list-style works too without any * special prodding. */ var shorthandPropertyExpansions = { background: { backgroundImage: true, backgroundPosition: true, backgroundRepeat: true, backgroundColor: true }, border: { borderWidth: true, borderStyle: true, borderColor: true }, borderBottom: { borderBottomWidth: true, borderBottomStyle: true, borderBottomColor: true }, borderLeft: { borderLeftWidth: true, borderLeftStyle: true, borderLeftColor: true }, borderRight: { borderRightWidth: true, borderRightStyle: true, borderRightColor: true }, borderTop: { borderTopWidth: true, borderTopStyle: true, borderTopColor: true }, font: { fontStyle: true, fontVariant: true, fontWeight: true, fontSize: true, lineHeight: true, fontFamily: true } }; var CSSProperty = { isUnitlessNumber: isUnitlessNumber, shorthandPropertyExpansions: shorthandPropertyExpansions }; module.exports = CSSProperty; },{}],3:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule CSSPropertyOperations * @typechecks static-only */ "use strict"; var CSSProperty = require("./CSSProperty"); var dangerousStyleValue = require("./dangerousStyleValue"); var escapeTextForBrowser = require("./escapeTextForBrowser"); var hyphenate = require("./hyphenate"); var memoizeStringOnly = require("./memoizeStringOnly"); var processStyleName = memoizeStringOnly(function(styleName) { return escapeTextForBrowser(hyphenate(styleName)); }); /** * Operations for dealing with CSS properties. */ var CSSPropertyOperations = { /** * Serializes a mapping of style properties for use as inline styles: * * > createMarkupForStyles({width: '200px', height: 0}) * "width:200px;height:0;" * * Undefined values are ignored so that declarative programming is easier. * * @param {object} styles * @return {?string} */ createMarkupForStyles: function(styles) { var serialized = ''; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var styleValue = styles[styleName]; if (styleValue != null) { serialized += processStyleName(styleName) + ':'; serialized += dangerousStyleValue(styleName, styleValue) + ';'; } } return serialized || null; }, /** * Sets the value for multiple styles on a node. If a value is specified as * '' (empty string), the corresponding style property will be unset. * * @param {DOMElement} node * @param {object} styles */ setValueForStyles: function(node, styles) { var style = node.style; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var styleValue = dangerousStyleValue(styleName, styles[styleName]); if (styleValue) { style[styleName] = styleValue; } else { var expansion = CSSProperty.shorthandPropertyExpansions[styleName]; if (expansion) { // Shorthand property that IE8 won't like unsetting, so unset each // component to placate it for (var individualStyleName in expansion) { style[individualStyleName] = ''; } } else { style[styleName] = ''; } } } } }; module.exports = CSSPropertyOperations; },{"./CSSProperty":2,"./dangerousStyleValue":80,"./escapeTextForBrowser":82,"./hyphenate":94,"./memoizeStringOnly":103}],4:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule CallbackRegistry * @typechecks static-only */ "use strict"; var listenerBank = {}; /** * Stores "listeners" by `registrationName`/`id`. There should be at most one * "listener" per `registrationName`/`id` in the `listenerBank`. * * Access listeners via `listenerBank[registrationName][id]`. * * @class CallbackRegistry * @internal */ var CallbackRegistry = { /** * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. * * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). * @param {?function} listener The callback to store. */ putListener: function(id, registrationName, listener) { var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); bankForRegistrationName[id] = listener; }, /** * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). * @return {?function} The stored callback. */ getListener: function(id, registrationName) { var bankForRegistrationName = listenerBank[registrationName]; return bankForRegistrationName && bankForRegistrationName[id]; }, /** * Deletes a listener from the registration bank. * * @param {string} id ID of the DOM element. * @param {string} registrationName Name of listener (e.g. `onClick`). */ deleteListener: function(id, registrationName) { var bankForRegistrationName = listenerBank[registrationName]; if (bankForRegistrationName) { delete bankForRegistrationName[id]; } }, /** * Deletes all listeners for the DOM element with the supplied ID. * * @param {string} id ID of the DOM element. */ deleteAllListeners: function(id) { for (var registrationName in listenerBank) { delete listenerBank[registrationName][id]; } }, /** * This is needed for tests only. Do not use! */ __purge: function() { listenerBank = {}; } }; module.exports = CallbackRegistry; },{}],5:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ChangeEventPlugin */ "use strict"; var EventConstants = require("./EventConstants"); var EventPluginHub = require("./EventPluginHub"); var EventPropagators = require("./EventPropagators"); var ExecutionEnvironment = require("./ExecutionEnvironment"); var SyntheticEvent = require("./SyntheticEvent"); var isEventSupported = require("./isEventSupported"); var isTextInputElement = require("./isTextInputElement"); var keyOf = require("./keyOf"); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { change: { phasedRegistrationNames: { bubbled: keyOf({onChange: null}), captured: keyOf({onChangeCapture: null}) } } }; /** * For IE shims */ var activeElement = null; var activeElementID = null; var activeElementValue = null; var activeElementValueProp = null; /** * SECTION: handle `change` event */ function shouldUseChangeEvent(elem) { return ( elem.nodeName === 'SELECT' || (elem.nodeName === 'INPUT' && elem.type === 'file') ); } var doesChangeEventBubble = false; if (ExecutionEnvironment.canUseDOM) { // See `handleChange` comment below doesChangeEventBubble = isEventSupported('change') && ( !('documentMode' in document) || document.documentMode > 8 ); } function manualDispatchChangeEvent(nativeEvent) { var event = SyntheticEvent.getPooled( eventTypes.change, activeElementID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); // If change bubbled, we'd just bind to it like all the other events // and have it go through ReactEventTopLevelCallback. Since it doesn't, we // manually listen for the change event and so we have to enqueue and // process the abstract event manually. EventPluginHub.enqueueEvents(event); EventPluginHub.processEventQueue(); } function startWatchingForChangeEventIE8(target, targetID) { activeElement = target; activeElementID = targetID; activeElement.attachEvent('onchange', manualDispatchChangeEvent); } function stopWatchingForChangeEventIE8() { if (!activeElement) { return; } activeElement.detachEvent('onchange', manualDispatchChangeEvent); activeElement = null; activeElementID = null; } function getTargetIDForChangeEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topChange) { return topLevelTargetID; } } function handleEventsForChangeEventIE8( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topFocus) { // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForChangeEventIE8(); startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); } else if (topLevelType === topLevelTypes.topBlur) { stopWatchingForChangeEventIE8(); } } /** * SECTION: handle `input` event */ var isInputEventSupported = false; if (ExecutionEnvironment.canUseDOM) { // IE9 claims to support the input event but fails to trigger it when // deleting text, so we ignore its input events isInputEventSupported = isEventSupported('input') && ( !('documentMode' in document) || document.documentMode > 9 ); } /** * (For old IE.) Replacement getter/setter for the `value` property that gets * set on the active element. */ var newValueProp = { get: function() { return activeElementValueProp.get.call(this); }, set: function(val) { // Cast to a string so we can do equality checks. activeElementValue = '' + val; activeElementValueProp.set.call(this, val); } }; /** * (For old IE.) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from * value changes in JS. */ function startWatchingForValueChange(target, targetID) { activeElement = target; activeElementID = targetID; activeElementValue = target.value; activeElementValueProp = Object.getOwnPropertyDescriptor( target.constructor.prototype, 'value' ); Object.defineProperty(activeElement, 'value', newValueProp); activeElement.attachEvent('onpropertychange', handlePropertyChange); } /** * (For old IE.) Removes the event listeners from the currently-tracked element, * if any exists. */ function stopWatchingForValueChange() { if (!activeElement) { return; } // delete restores the original property definition delete activeElement.value; activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementID = null; activeElementValue = null; activeElementValueProp = null; } /** * (For old IE.) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. */ function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } var value = nativeEvent.srcElement.value; if (value === activeElementValue) { return; } activeElementValue = value; manualDispatchChangeEvent(nativeEvent); } /** * If a `change` event should be fired, returns the target's ID. */ function getTargetIDForInputEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topInput) { // In modern browsers (i.e., not IE8 or IE9), the input event is exactly // what we want so fall through here and trigger an abstract event return topLevelTargetID; } } // For IE8 and IE9. function handleEventsForInputEventIE( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topFocus) { // In IE8, we can capture almost all .value changes by adding a // propertychange handler and looking for events with propertyName // equal to 'value' // In IE9, propertychange fires for most input events but is buggy and // doesn't fire when text is deleted, but conveniently, selectionchange // appears to fire in all of the remaining cases so we catch those and // forward the event if the value has changed // In either case, we don't want to call the event handler if the value // is changed from JS so we redefine a setter for `.value` that updates // our activeElementValue variable, allowing us to ignore those changes // // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForValueChange(); startWatchingForValueChange(topLevelTarget, topLevelTargetID); } else if (topLevelType === topLevelTypes.topBlur) { stopWatchingForValueChange(); } } // For IE8 and IE9. function getTargetIDForInputEventIE( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire // propertychange on the first input event after setting `value` from a // script and fires only keydown, keypress, keyup. Catching keyup usually // gets it and catching keydown lets us fire an event for the first // keystroke if user does a key repeat (it'll be a little delayed: right // before the second keystroke). Other input methods (e.g., paste) seem to // fire selectionchange normally. if (activeElement && activeElement.value !== activeElementValue) { activeElementValue = activeElement.value; return activeElementID; } } } /** * SECTION: handle `click` event */ function shouldUseClickEvent(elem) { // Use the `click` event to detect changes to checkbox and radio inputs. // This approach works across all browsers, whereas `change` does not fire // until `blur` in IE8. return ( elem.nodeName === 'INPUT' && (elem.type === 'checkbox' || elem.type === 'radio') ); } function getTargetIDForClickEvent( topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topClick) { return topLevelTargetID; } } /** * This plugin creates an `onChange` event that normalizes change events * across form elements. This event fires at a time when it's possible to * change the element's value without seeing a flicker. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - select */ var ChangeEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var getTargetIDFunc, handleEventFunc; if (shouldUseChangeEvent(topLevelTarget)) { if (doesChangeEventBubble) { getTargetIDFunc = getTargetIDForChangeEvent; } else { handleEventFunc = handleEventsForChangeEventIE8; } } else if (isTextInputElement(topLevelTarget)) { if (isInputEventSupported) { getTargetIDFunc = getTargetIDForInputEvent; } else { getTargetIDFunc = getTargetIDForInputEventIE; handleEventFunc = handleEventsForInputEventIE; } } else if (shouldUseClickEvent(topLevelTarget)) { getTargetIDFunc = getTargetIDForClickEvent; } if (getTargetIDFunc) { var targetID = getTargetIDFunc( topLevelType, topLevelTarget, topLevelTargetID ); if (targetID) { var event = SyntheticEvent.getPooled( eventTypes.change, targetID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); return event; } } if (handleEventFunc) { handleEventFunc( topLevelType, topLevelTarget, topLevelTargetID ); } } }; module.exports = ChangeEventPlugin; },{"./EventConstants":14,"./EventPluginHub":16,"./EventPropagators":19,"./ExecutionEnvironment":20,"./SyntheticEvent":65,"./isEventSupported":96,"./isTextInputElement":98,"./keyOf":102}],6:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule CompositionEventPlugin * @typechecks static-only */ "use strict"; var EventConstants = require("./EventConstants"); var EventPropagators = require("./EventPropagators"); var ExecutionEnvironment = require("./ExecutionEnvironment"); var ReactInputSelection = require("./ReactInputSelection"); var SyntheticCompositionEvent = require("./SyntheticCompositionEvent"); var getTextContentAccessor = require("./getTextContentAccessor"); var keyOf = require("./keyOf"); var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space var START_KEYCODE = 229; var useCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; var topLevelTypes = EventConstants.topLevelTypes; var currentComposition = null; // Events and their corresponding property names. var eventTypes = { compositionEnd: { phasedRegistrationNames: { bubbled: keyOf({onCompositionEnd: null}), captured: keyOf({onCompositionEndCapture: null}) } }, compositionStart: { phasedRegistrationNames: { bubbled: keyOf({onCompositionStart: null}), captured: keyOf({onCompositionStartCapture: null}) } }, compositionUpdate: { phasedRegistrationNames: { bubbled: keyOf({onCompositionUpdate: null}), captured: keyOf({onCompositionUpdateCapture: null}) } } }; /** * Translate native top level events into event types. * * @param {string} topLevelType * @return {object} */ function getCompositionEventType(topLevelType) { switch (topLevelType) { case topLevelTypes.topCompositionStart: return eventTypes.compositionStart; case topLevelTypes.topCompositionEnd: return eventTypes.compositionEnd; case topLevelTypes.topCompositionUpdate: return eventTypes.compositionUpdate; } } /** * Does our fallback best-guess model think this event signifies that * composition has begun? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackStart(topLevelType, nativeEvent) { return ( topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE ); } /** * Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackEnd(topLevelType, nativeEvent) { switch (topLevelType) { case topLevelTypes.topKeyUp: // Command keys insert or clear IME input. return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1); case topLevelTypes.topKeyDown: // Expect IME keyCode on each keydown. If we get any other // code we must have exited earlier. return (nativeEvent.keyCode !== START_KEYCODE); case topLevelTypes.topKeyPress: case topLevelTypes.topMouseDown: case topLevelTypes.topBlur: // Events are not possible without cancelling IME. return true; default: return false; } } /** * Helper class stores information about selection and document state * so we can figure out what changed at a later date. * * @param {DOMEventTarget} root */ function FallbackCompositionState(root) { this.root = root; this.startSelection = ReactInputSelection.getSelection(root); this.startValue = this.getText(); } /** * Get current text of input. * * @return {string} */ FallbackCompositionState.prototype.getText = function() { return this.root.value || this.root[getTextContentAccessor()]; }; /** * Text that has changed since the start of composition. * * @return {string} */ FallbackCompositionState.prototype.getData = function() { var endValue = this.getText(); var prefixLength = this.startSelection.start; var suffixLength = this.startValue.length - this.startSelection.end; return endValue.substr( prefixLength, endValue.length - suffixLength - prefixLength ); }; /** * This plugin creates `onCompositionStart`, `onCompositionUpdate` and * `onCompositionEnd` events on inputs, textareas and contentEditable * nodes. */ var CompositionEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var eventType; var data; if (useCompositionEvent) { eventType = getCompositionEventType(topLevelType); } else if (!currentComposition) { if (isFallbackStart(topLevelType, nativeEvent)) { eventType = eventTypes.start; currentComposition = new FallbackCompositionState(topLevelTarget); } } else if (isFallbackEnd(topLevelType, nativeEvent)) { eventType = eventTypes.compositionEnd; data = currentComposition.getData(); currentComposition = null; } if (eventType) { var event = SyntheticCompositionEvent.getPooled( eventType, topLevelTargetID, nativeEvent ); if (data) { // Inject data generated from fallback path into the synthetic event. // This matches the property of native CompositionEventInterface. event.data = data; } EventPropagators.accumulateTwoPhaseDispatches(event); return event; } } }; module.exports = CompositionEventPlugin; },{"./EventConstants":14,"./EventPropagators":19,"./ExecutionEnvironment":20,"./ReactInputSelection":46,"./SyntheticCompositionEvent":64,"./getTextContentAccessor":93,"./keyOf":102}],7:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule DOMChildrenOperations * @typechecks static-only */ "use strict"; var Danger = require("./Danger"); var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes"); var getTextContentAccessor = require("./getTextContentAccessor"); /** * The DOM property to use when setting text content. * * @type {string} * @private */ var textContentAccessor = getTextContentAccessor() || 'NA'; /** * Inserts `childNode` as a child of `parentNode` at the `index`. * * @param {DOMElement} parentNode Parent node in which to insert. * @param {DOMElement} childNode Child node to insert. * @param {number} index Index at which to insert the child. * @internal */ function insertChildAt(parentNode, childNode, index) { var childNodes = parentNode.childNodes; if (childNodes[index] === childNode) { return; } // If `childNode` is already a child of `parentNode`, remove it so that // computing `childNodes[index]` takes into account the removal. if (childNode.parentNode === parentNode) { parentNode.removeChild(childNode); } if (index >= childNodes.length) { parentNode.appendChild(childNode); } else { parentNode.insertBefore(childNode, childNodes[index]); } } /** * Operations for updating with DOM children. */ var DOMChildrenOperations = { dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, /** * Updates a component's children by processing a series of updates. The * update configurations are each expected to have a `parentNode` property. * * @param {array<object>} updates List of update configurations. * @param {array<string>} markupList List of markup strings. * @internal */ processUpdates: function(updates, markupList) { var update; // Mapping from parent IDs to initial child orderings. var initialChildren = null; // List of children that will be moved or removed. var updatedChildren = null; for (var i = 0; update = updates[i]; i++) { if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { var updatedIndex = update.fromIndex; var updatedChild = update.parentNode.childNodes[updatedIndex]; var parentID = update.parentID; initialChildren = initialChildren || {}; initialChildren[parentID] = initialChildren[parentID] || []; initialChildren[parentID][updatedIndex] = updatedChild; updatedChildren = updatedChildren || []; updatedChildren.push(updatedChild); } } var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); // Remove updated children first so that `toIndex` is consistent. if (updatedChildren) { for (var j = 0; j < updatedChildren.length; j++) { updatedChildren[j].parentNode.removeChild(updatedChildren[j]); } } for (var k = 0; update = updates[k]; k++) { switch (update.type) { case ReactMultiChildUpdateTypes.INSERT_MARKUP: insertChildAt( update.parentNode, renderedMarkup[update.markupIndex], update.toIndex ); break; case ReactMultiChildUpdateTypes.MOVE_EXISTING: insertChildAt( update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex ); break; case ReactMultiChildUpdateTypes.TEXT_CONTENT: update.parentNode[textContentAccessor] = update.textContent; break; case ReactMultiChildUpdateTypes.REMOVE_NODE: // Already removed by the for-loop above. break; } } } }; module.exports = DOMChildrenOperations; },{"./Danger":10,"./ReactMultiChildUpdateTypes":52,"./getTextContentAccessor":93}],8:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule DOMProperty * @typechecks static-only */ /*jslint bitwise: true */ "use strict"; var invariant = require("./invariant"); var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that * specifies how the associated DOM property should be accessed or rendered. */ MUST_USE_ATTRIBUTE: 0x1, MUST_USE_PROPERTY: 0x2, HAS_BOOLEAN_VALUE: 0x4, HAS_SIDE_EFFECTS: 0x8, /** * Inject some specialized knowledge about the DOM. This takes a config object * with the following properties: * * isCustomAttribute: function that given an attribute name will return true * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* * attributes where it's impossible to enumerate all of the possible * attribute names, * * Properties: object mapping DOM property name to one of the * DOMPropertyInjection constants or null. If your attribute isn't in here, * it won't get written to the DOM. * * DOMAttributeNames: object mapping React attribute name to the DOM * attribute name. Attribute names not specified use the **lowercase** * normalized name. * * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. * Property names not specified use the normalized name. * * DOMMutationMethods: Properties that require special mutation methods. If * `value` is undefined, the mutation method should unset the property. * * @param {object} domPropertyConfig the config as described above. */ injectDOMPropertyConfig: function(domPropertyConfig) { var Properties = domPropertyConfig.Properties || {}; var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; if (domPropertyConfig.isCustomAttribute) { DOMProperty._isCustomAttributeFunctions.push( domPropertyConfig.isCustomAttribute ); } for (var propName in Properties) { invariant( !DOMProperty.isStandardName[propName], 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName ); DOMProperty.isStandardName[propName] = true; var lowerCased = propName.toLowerCase(); DOMProperty.getPossibleStandardName[lowerCased] = propName; var attributeName = DOMAttributeNames[propName]; if (attributeName) { DOMProperty.getPossibleStandardName[attributeName] = propName; } DOMProperty.getAttributeName[propName] = attributeName || lowerCased; DOMProperty.getPropertyName[propName] = DOMPropertyNames[propName] || propName; var mutationMethod = DOMMutationMethods[propName]; if (mutationMethod) { DOMProperty.getMutationMethod[propName] = mutationMethod; } var propConfig = Properties[propName]; DOMProperty.mustUseAttribute[propName] = propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE; DOMProperty.mustUseProperty[propName] = propConfig & DOMPropertyInjection.MUST_USE_PROPERTY; DOMProperty.hasBooleanValue[propName] = propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE; DOMProperty.hasSideEffects[propName] = propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS; invariant( !DOMProperty.mustUseAttribute[propName] || !DOMProperty.mustUseProperty[propName], 'DOMProperty: Cannot use require using both attribute and property: %s', propName ); invariant( DOMProperty.mustUseProperty[propName] || !DOMProperty.hasSideEffects[propName], 'DOMProperty: Properties that have side effects must use property: %s', propName ); } } }; var defaultValueCache = {}; /** * DOMProperty exports lookup objects that can be used like functions: * * > DOMProperty.isValid['id'] * true * > DOMProperty.isValid['foobar'] * undefined * * Although this may be confusing, it performs better in general. * * @see http://jsperf.com/key-exists * @see http://jsperf.com/key-missing */ var DOMProperty = { /** * Checks whether a property name is a standard property. * @type {Object} */ isStandardName: {}, /** * Mapping from lowercase property names to the properly cased version, used * to warn in the case of missing properties. * @type {Object} */ getPossibleStandardName: {}, /** * Mapping from normalized names to attribute names that differ. Attribute * names are used when rendering markup or with `*Attribute()`. * @type {Object} */ getAttributeName: {}, /** * Mapping from normalized names to properties on DOM node instances. * (This includes properties that mutate due to external factors.) * @type {Object} */ getPropertyName: {}, /** * Mapping from normalized names to mutation methods. This will only exist if * mutation cannot be set simply by the property or `setAttribute()`. * @type {Object} */ getMutationMethod: {}, /** * Whether the property must be accessed and mutated as an object property. * @type {Object} */ mustUseAttribute: {}, /** * Whether the property must be accessed and mutated using `*Attribute()`. * (This includes anything that fails `<propName> in <element>`.) * @type {Object} */ mustUseProperty: {}, /** * Whether the property should be removed when set to a falsey value. * @type {Object} */ hasBooleanValue: {}, /** * Whether or not setting a value causes side effects such as triggering * resources to be loaded or text selection changes. We must ensure that * the value is only set if it has changed. * @type {Object} */ hasSideEffects: {}, /** * All of the isCustomAttribute() functions that have been injected. */ _isCustomAttributeFunctions: [], /** * Checks whether a property name is a custom attribute. * @method */ isCustomAttribute: function(attributeName) { return DOMProperty._isCustomAttributeFunctions.some( function(isCustomAttributeFn) { return isCustomAttributeFn.call(null, attributeName); } ); }, /** * Returns the default property value for a DOM property (i.e., not an * attribute). Most default values are '' or false, but not all. Worse yet, * some (in particular, `type`) vary depending on the type of element. * * TODO: Is it better to grab all the possible properties when creating an * element to avoid having to create the same element twice? */ getDefaultValueForProperty: function(nodeName, prop) { var nodeDefaults = defaultValueCache[nodeName]; var testElement; if (!nodeDefaults) { defaultValueCache[nodeName] = nodeDefaults = {}; } if (!(prop in nodeDefaults)) { testElement = document.createElement(nodeName); nodeDefaults[prop] = testElement[prop]; } return nodeDefaults[prop]; }, injection: DOMPropertyInjection }; module.exports = DOMProperty; },{"./invariant":95}],9:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule DOMPropertyOperations * @typechecks static-only */ "use strict"; var DOMProperty = require("./DOMProperty"); var escapeTextForBrowser = require("./escapeTextForBrowser"); var memoizeStringOnly = require("./memoizeStringOnly"); var processAttributeNameAndPrefix = memoizeStringOnly(function(name) { return escapeTextForBrowser(name) + '="'; }); if (true) { var reactProps = { __owner__: true, children: true, dangerouslySetInnerHTML: true, key: true, ref: true }; var warnedProperties = {}; var warnUnknownProperty = function(name) { if (reactProps[name] || warnedProperties[name]) { return; } warnedProperties[name] = true; var lowerCasedName = name.toLowerCase(); // data-* attributes should be lowercase; suggest the lowercase version var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName[lowerCasedName]; // For now, only warn when we have a suggested correction. This prevents // logging too much when using transferPropsTo. if (standardName != null) { console.warn( 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' ); } }; } /** * Operations for dealing with DOM properties. */ var DOMPropertyOperations = { /** * Creates markup for a property. * * @param {string} name * @param {*} value * @return {?string} Markup string, or null if the property was invalid. */ createMarkupForProperty: function(name, value) { if (DOMProperty.isStandardName[name]) { if (value == null || DOMProperty.hasBooleanValue[name] && !value) { return ''; } var attributeName = DOMProperty.getAttributeName[name]; return processAttributeNameAndPrefix(attributeName) + escapeTextForBrowser(value) + '"'; } else if (DOMProperty.isCustomAttribute(name)) { if (value == null) { return ''; } return processAttributeNameAndPrefix(name) + escapeTextForBrowser(value) + '"'; } else if (true) { warnUnknownProperty(name); } return null; }, /** * Sets the value for a property on a node. * * @param {DOMElement} node * @param {string} name * @param {*} value */ setValueForProperty: function(node, name, value) { if (DOMProperty.isStandardName[name]) { var mutationMethod = DOMProperty.getMutationMethod[name]; if (mutationMethod) { mutationMethod(node, value); } else if (DOMProperty.mustUseAttribute[name]) { if (DOMProperty.hasBooleanValue[name] && !value) { node.removeAttribute(DOMProperty.getAttributeName[name]); } else { node.setAttribute(DOMProperty.getAttributeName[name], '' + value); } } else { var propName = DOMProperty.getPropertyName[name]; if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) { node[propName] = value; } } } else if (DOMProperty.isCustomAttribute(name)) { node.setAttribute(name, '' + value); } else if (true) { warnUnknownProperty(name); } }, /** * Deletes the value for a property on a node. * * @param {DOMElement} node * @param {string} name */ deleteValueForProperty: function(node, name) { if (DOMProperty.isStandardName[name]) { var mutationMethod = DOMProperty.getMutationMethod[name]; if (mutationMethod) { mutationMethod(node, undefined); } else if (DOMProperty.mustUseAttribute[name]) { node.removeAttribute(DOMProperty.getAttributeName[name]); } else { var propName = DOMProperty.getPropertyName[name]; node[propName] = DOMProperty.getDefaultValueForProperty( node.nodeName, name ); } } else if (DOMProperty.isCustomAttribute(name)) { node.removeAttribute(name); } else if (true) { warnUnknownProperty(name); } } }; module.exports = DOMPropertyOperations; },{"./DOMProperty":8,"./escapeTextForBrowser":82,"./memoizeStringOnly":103}],10:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule Danger * @typechecks static-only */ /*jslint evil: true, sub: true */ "use strict"; var ExecutionEnvironment = require("./ExecutionEnvironment"); var createNodesFromMarkup = require("./createNodesFromMarkup"); var emptyFunction = require("./emptyFunction"); var getMarkupWrap = require("./getMarkupWrap"); var invariant = require("./invariant"); var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup"); var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; var RESULT_INDEX_ATTR = 'data-danger-index'; /** * Extracts the `nodeName` from a string of markup. * * NOTE: Extracting the `nodeName` does not require a regular expression match * because we make assumptions about React-generated markup (i.e. there are no * spaces surrounding the opening tag and there is at least one attribute). * * @param {string} markup String of markup. * @return {string} Node name of the supplied markup. * @see http://jsperf.com/extract-nodename */ function getNodeName(markup) { return markup.substring(1, markup.indexOf(' ')); } var Danger = { /** * Renders markup into an array of nodes. The markup is expected to render * into a list of root nodes. Also, the length of `resultList` and * `markupList` should be the same. * * @param {array<string>} markupList List of markup strings to render. * @return {array<DOMElement>} List of rendered nodes. * @internal */ dangerouslyRenderMarkup: function(markupList) { invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' + 'thread. This is likely a bug in the framework. Please report ' + 'immediately.' ); var nodeName; var markupByNodeName = {}; // Group markup by `nodeName` if a wrap is necessary, else by '*'. for (var i = 0; i < markupList.length; i++) { invariant( markupList[i], 'dangerouslyRenderMarkup(...): Missing markup.' ); nodeName = getNodeName(markupList[i]); nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; markupByNodeName[nodeName][i] = markupList[i]; } var resultList = []; var resultListAssignmentCount = 0; for (nodeName in markupByNodeName) { if (!markupByNodeName.hasOwnProperty(nodeName)) { continue; } var markupListByNodeName = markupByNodeName[nodeName]; // This for-in loop skips the holes of the sparse array. The order of // iteration should follow the order of assignment, which happens to match // numerical index order, but we don't rely on that. for (var resultIndex in markupListByNodeName) { if (markupListByNodeName.hasOwnProperty(resultIndex)) { var markup = markupListByNodeName[resultIndex]; // Push the requested markup with an additional RESULT_INDEX_ATTR // attribute. If the markup does not start with a < character, it // will be discarded below (with an appropriate console.error). markupListByNodeName[resultIndex] = markup.replace( OPEN_TAG_NAME_EXP, // This index will be parsed back out below. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ' ); } } // Render each group of markup with similar wrapping `nodeName`. var renderNodes = createNodesFromMarkup( markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags. ); for (i = 0; i < renderNodes.length; ++i) { var renderNode = renderNodes[i]; if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) { resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR); renderNode.removeAttribute(RESULT_INDEX_ATTR); invariant( !resultList.hasOwnProperty(resultIndex), 'Danger: Assigning to an already-occupied result index.' ); resultList[resultIndex] = renderNode; // This should match resultList.length and markupList.length when // we're done. resultListAssignmentCount += 1; } else if (true) { console.error( "Danger: Discarding unexpected node:", renderNode ); } } } // Although resultList was populated out of order, it should now be a dense // array. invariant( resultListAssignmentCount === resultList.length, 'Danger: Did not assign to every index of resultList.' ); invariant( resultList.length === markupList.length, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length ); return resultList; }, /** * Replaces a node with a string of markup at its current position within its * parent. The markup must render into a single root node. * * @param {DOMElement} oldChild Child node to replace. * @param {string} markup Markup to render in place of the child node. * @internal */ dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) { invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. This is likely a bug in the framework. Please report ' + 'immediately.' ); invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.'); // createNodesFromMarkup() won't work if the markup is rooted by <html> // since it has special semantic meaning. So we use an alternatie strategy. if (oldChild.tagName.toLowerCase() === 'html') { mutateHTMLNodeWithMarkup(oldChild, markup); return; } var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; oldChild.parentNode.replaceChild(newChild, oldChild); } }; module.exports = Danger; },{"./ExecutionEnvironment":20,"./createNodesFromMarkup":78,"./emptyFunction":81,"./getMarkupWrap":90,"./invariant":95,"./mutateHTMLNodeWithMarkup":108}],11:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule DefaultDOMPropertyConfig */ /*jslint bitwise: true*/ "use strict"; var DOMProperty = require("./DOMProperty"); var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; var DefaultDOMPropertyConfig = { isCustomAttribute: RegExp.prototype.test.bind( /^(data|aria)-[a-z_][a-z\d_.\-]*$/ ), Properties: { /** * Standard Properties */ accept: null, accessKey: null, action: null, allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, allowTransparency: MUST_USE_ATTRIBUTE, alt: null, autoComplete: null, autoFocus: HAS_BOOLEAN_VALUE, autoPlay: HAS_BOOLEAN_VALUE, cellPadding: null, cellSpacing: null, charSet: MUST_USE_ATTRIBUTE, checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, className: MUST_USE_PROPERTY, colSpan: null, content: null, contentEditable: null, contextMenu: MUST_USE_ATTRIBUTE, controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, data: null, // For `<object />` acts as `src`. dateTime: MUST_USE_ATTRIBUTE, dir: null, disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, draggable: null, encType: null, form: MUST_USE_ATTRIBUTE, frameBorder: MUST_USE_ATTRIBUTE, height: MUST_USE_ATTRIBUTE, hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, href: null, htmlFor: null, httpEquiv: null, icon: null, id: MUST_USE_PROPERTY, label: null, lang: null, list: null, max: null, maxLength: MUST_USE_ATTRIBUTE, method: null, min: null, multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, name: null, pattern: null, placeholder: null, poster: null, preload: null, radioGroup: null, readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, rel: null, required: HAS_BOOLEAN_VALUE, role: MUST_USE_ATTRIBUTE, rowSpan: null, scrollLeft: MUST_USE_PROPERTY, scrollTop: MUST_USE_PROPERTY, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, size: null, spellCheck: null, src: null, step: null, style: null, tabIndex: null, target: null, title: null, type: null, value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, width: MUST_USE_ATTRIBUTE, wmode: MUST_USE_ATTRIBUTE, /** * Non-standard Properties */ autoCapitalize: null, // Supported in Mobile Safari for keyboard hints /** * SVG Properties */ cx: MUST_USE_ATTRIBUTE, cy: MUST_USE_ATTRIBUTE, d: MUST_USE_ATTRIBUTE, fill: MUST_USE_ATTRIBUTE, fx: MUST_USE_ATTRIBUTE, fy: MUST_USE_ATTRIBUTE, gradientTransform: MUST_USE_ATTRIBUTE, gradientUnits: MUST_USE_ATTRIBUTE, offset: MUST_USE_ATTRIBUTE, points: MUST_USE_ATTRIBUTE, r: MUST_USE_ATTRIBUTE, rx: MUST_USE_ATTRIBUTE, ry: MUST_USE_ATTRIBUTE, spreadMethod: MUST_USE_ATTRIBUTE, stopColor: MUST_USE_ATTRIBUTE, stopOpacity: MUST_USE_ATTRIBUTE, stroke: MUST_USE_ATTRIBUTE, strokeLinecap: MUST_USE_ATTRIBUTE, strokeWidth: MUST_USE_ATTRIBUTE, transform: MUST_USE_ATTRIBUTE, version: MUST_USE_ATTRIBUTE, viewBox: MUST_USE_ATTRIBUTE, x1: MUST_USE_ATTRIBUTE, x2: MUST_USE_ATTRIBUTE, x: MUST_USE_ATTRIBUTE, y1: MUST_USE_ATTRIBUTE, y2: MUST_USE_ATTRIBUTE, y: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { className: 'class', gradientTransform: 'gradientTransform', gradientUnits: 'gradientUnits', htmlFor: 'for', spreadMethod: 'spreadMethod', stopColor: 'stop-color', stopOpacity: 'stop-opacity', strokeLinecap: 'stroke-linecap', strokeWidth: 'stroke-width', viewBox: 'viewBox' }, DOMPropertyNames: { autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', autoFocus: 'autofocus', autoPlay: 'autoplay', encType: 'enctype', radioGroup: 'radiogroup', spellCheck: 'spellcheck' }, DOMMutationMethods: { /** * Setting `className` to null may cause it to be set to the string "null". * * @param {DOMElement} node * @param {*} value */ className: function(node, value) { node.className = value || ''; } } }; module.exports = DefaultDOMPropertyConfig; },{"./DOMProperty":8}],12:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule DefaultEventPluginOrder */ "use strict"; var keyOf = require("./keyOf"); /** * Module that is injectable into `EventPluginHub`, that specifies a * deterministic ordering of `EventPlugin`s. A convenient way to reason about * plugins, without having to package every one of them. This is better than * having plugins be ordered in the same order that they are injected because * that ordering would be influenced by the packaging order. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that * preventing default on events is convenient in `SimpleEventPlugin` handlers. */ var DefaultEventPluginOrder = [ keyOf({ResponderEventPlugin: null}), keyOf({SimpleEventPlugin: null}), keyOf({TapEventPlugin: null}), keyOf({EnterLeaveEventPlugin: null}), keyOf({ChangeEventPlugin: null}), keyOf({SelectEventPlugin: null}), keyOf({CompositionEventPlugin: null}), keyOf({AnalyticsEventPlugin: null}), keyOf({MobileSafariClickEventPlugin: null}) ]; module.exports = DefaultEventPluginOrder; },{"./keyOf":102}],13:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EnterLeaveEventPlugin * @typechecks static-only */ "use strict"; var EventConstants = require("./EventConstants"); var EventPropagators = require("./EventPropagators"); var SyntheticMouseEvent = require("./SyntheticMouseEvent"); var ReactMount = require("./ReactMount"); var keyOf = require("./keyOf"); var topLevelTypes = EventConstants.topLevelTypes; var getFirstReactDOM = ReactMount.getFirstReactDOM; var eventTypes = { mouseEnter: {registrationName: keyOf({onMouseEnter: null})}, mouseLeave: {registrationName: keyOf({onMouseLeave: null})} }; var extractedEvents = [null, null]; var EnterLeaveEventPlugin = { eventTypes: eventTypes, /** * For almost every interaction we care about, there will be both a top-level * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that * we do not extract duplicate events. However, moving the mouse into the * browser from outside will not fire a `mouseout` event. In this case, we use * the `mouseover` top-level event. * * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { return null; } if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { // Must not be a mouse in or mouse out - ignoring. return null; } var from, to; if (topLevelType === topLevelTypes.topMouseOut) { from = topLevelTarget; to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || window; } else { from = window; to = topLevelTarget; } if (from === to) { // Nothing pertains to our managed components. return null; } var fromID = from ? ReactMount.getID(from) : ''; var toID = to ? ReactMount.getID(to) : ''; var leave = SyntheticMouseEvent.getPooled( eventTypes.mouseLeave, fromID, nativeEvent ); var enter = SyntheticMouseEvent.getPooled( eventTypes.mouseEnter, toID, nativeEvent ); EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID); extractedEvents[0] = leave; extractedEvents[1] = enter; return extractedEvents; } }; module.exports = EnterLeaveEventPlugin; },{"./EventConstants":14,"./EventPropagators":19,"./ReactMount":49,"./SyntheticMouseEvent":68,"./keyOf":102}],14:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventConstants */ "use strict"; var keyMirror = require("./keyMirror"); var PropagationPhases = keyMirror({bubbled: null, captured: null}); /** * Types of raw signals from the browser caught at the top level. */ var topLevelTypes = keyMirror({ topBlur: null, topChange: null, topClick: null, topCompositionEnd: null, topCompositionStart: null, topCompositionUpdate: null, topCopy: null, topCut: null, topDoubleClick: null, topDrag: null, topDragEnd: null, topDragEnter: null, topDragExit: null, topDragLeave: null, topDragOver: null, topDragStart: null, topDrop: null, topFocus: null, topInput: null, topKeyDown: null, topKeyPress: null, topKeyUp: null, topMouseDown: null, topMouseMove: null, topMouseOut: null, topMouseOver: null, topMouseUp: null, topPaste: null, topScroll: null, topSelectionChange: null, topSubmit: null, topTouchCancel: null, topTouchEnd: null, topTouchMove: null, topTouchStart: null, topWheel: null }); var EventConstants = { topLevelTypes: topLevelTypes, PropagationPhases: PropagationPhases }; module.exports = EventConstants; },{"./keyMirror":101}],15:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventListener */ /** * Upstream version of event listener. Does not take into account specific * nature of platform. */ var EventListener = { /** * Listens to bubbled events on a DOM node. * * @param {Element} el DOM element to register listener on. * @param {string} handlerBaseName 'click'/'mouseover' * @param {Function!} cb Callback function */ listen: function(el, handlerBaseName, cb) { if (el.addEventListener) { el.addEventListener(handlerBaseName, cb, false); } else if (el.attachEvent) { el.attachEvent('on' + handlerBaseName, cb); } }, /** * Listens to captured events on a DOM node. * * @see `EventListener.listen` for params. * @throws Exception if addEventListener is not supported. */ capture: function(el, handlerBaseName, cb) { if (!el.addEventListener) { if (true) { console.error( 'You are attempting to use addEventlistener ' + 'in a browser that does not support it support it.' + 'This likely means that you will not receive events that ' + 'your application relies on (such as scroll).'); } return; } else { el.addEventListener(handlerBaseName, cb, true); } } }; module.exports = EventListener; },{}],16:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventPluginHub */ "use strict"; var CallbackRegistry = require("./CallbackRegistry"); var EventPluginRegistry = require("./EventPluginRegistry"); var EventPluginUtils = require("./EventPluginUtils"); var EventPropagators = require("./EventPropagators"); var ExecutionEnvironment = require("./ExecutionEnvironment"); var accumulate = require("./accumulate"); var forEachAccumulated = require("./forEachAccumulated"); var invariant = require("./invariant"); /** * Internal queue of events that have accumulated their dispatches and are * waiting to have their dispatches executed. */ var eventQueue = null; /** * Dispatches an event and releases it back into the pool, unless persistent. * * @param {?object} event Synthetic event to be dispatched. * @private */ var executeDispatchesAndRelease = function(event) { if (event) { var executeDispatch = EventPluginUtils.executeDispatch; // Plugins can provide custom behavior when dispatching events. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event); if (PluginModule && PluginModule.executeDispatch) { executeDispatch = PluginModule.executeDispatch; } EventPluginUtils.executeDispatchesInOrder(event, executeDispatch); if (!event.isPersistent()) { event.constructor.release(event); } } }; /** * This is a unified interface for event plugins to be installed and configured. * * Event plugins can implement the following properties: * * `extractEvents` {function(string, DOMEventTarget, string, object): *} * Required. When a top-level event is fired, this method is expected to * extract synthetic events that will in turn be queued and dispatched. * * `eventTypes` {object} * Optional, plugins that fire events must publish a mapping of registration * names that are used to register listeners. Values of this mapping must * be objects that contain `registrationName` or `phasedRegistrationNames`. * * `executeDispatch` {function(object, function, string)} * Optional, allows plugins to override how an event gets dispatched. By * default, the listener is simply invoked. * * Each plugin that is injected into `EventsPluginHub` is immediately operable. * * @public */ var EventPluginHub = { /** * Methods for injecting dependencies. */ injection: { /** * @param {object} InjectedInstanceHandle * @public */ injectInstanceHandle: EventPropagators.injection.injectInstanceHandle, /** * @param {array} InjectedEventPluginOrder * @public */ injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, /** * @param {object} injectedNamesToPlugins Map from names to plugin modules. */ injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName }, registrationNames: EventPluginRegistry.registrationNames, putListener: CallbackRegistry.putListener, getListener: CallbackRegistry.getListener, deleteListener: CallbackRegistry.deleteListener, deleteAllListeners: CallbackRegistry.deleteAllListeners, /** * Allows registered plugins an opportunity to extract events from top-level * native browser events. * * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @internal */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var events; var plugins = EventPluginRegistry.plugins; for (var i = 0, l = plugins.length; i < l; i++) { // Not every plugin in the ordering may be loaded at runtime. var possiblePlugin = plugins[i]; if (possiblePlugin) { var extractedEvents = possiblePlugin.extractEvents( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ); if (extractedEvents) { events = accumulate(events, extractedEvents); } } } return events; }, /** * Enqueues a synthetic event that should be dispatched when * `processEventQueue` is invoked. * * @param {*} events An accumulation of synthetic events. * @internal */ enqueueEvents: function(events) { if (events) { eventQueue = accumulate(eventQueue, events); } }, /** * Dispatches all synthetic events on the event queue. * * @internal */ processEventQueue: function() { // Set `eventQueue` to null before processing it so that we can tell if more // events get enqueued while processing. var processingEventQueue = eventQueue; eventQueue = null; forEachAccumulated(processingEventQueue, executeDispatchesAndRelease); invariant( !eventQueue, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.' ); } }; if (ExecutionEnvironment.canUseDOM) { window.EventPluginHub = EventPluginHub; } module.exports = EventPluginHub; },{"./CallbackRegistry":4,"./EventPluginRegistry":17,"./EventPluginUtils":18,"./EventPropagators":19,"./ExecutionEnvironment":20,"./accumulate":74,"./forEachAccumulated":86,"./invariant":95}],17:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventPluginRegistry * @typechecks static-only */ "use strict"; var invariant = require("./invariant"); /** * Injectable ordering of event plugins. */ var EventPluginOrder = null; /** * Injectable mapping from names to event plugin modules. */ var namesToPlugins = {}; /** * Recomputes the plugin list using the injected plugins and plugin ordering. * * @private */ function recomputePluginOrdering() { if (!EventPluginOrder) { // Wait until an `EventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var PluginModule = namesToPlugins[pluginName]; var pluginIndex = EventPluginOrder.indexOf(pluginName); invariant( pluginIndex > -1, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName ); if (EventPluginRegistry.plugins[pluginIndex]) { continue; } invariant( PluginModule.extractEvents, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName ); EventPluginRegistry.plugins[pluginIndex] = PluginModule; var publishedEvents = PluginModule.eventTypes; for (var eventName in publishedEvents) { invariant( publishEventForPlugin(publishedEvents[eventName], PluginModule), 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName ); } } } /** * Publishes an event so that it can be dispatched by the supplied plugin. * * @param {object} dispatchConfig Dispatch configuration for the event. * @param {object} PluginModule Plugin publishing the event. * @return {boolean} True if the event was successfully published. * @private */ function publishEventForPlugin(dispatchConfig, PluginModule) { var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) { if (phasedRegistrationNames.hasOwnProperty(phaseName)) { var phasedRegistrationName = phasedRegistrationNames[phaseName]; publishRegistrationName(phasedRegistrationName, PluginModule); } } return true; } else if (dispatchConfig.registrationName) { publishRegistrationName(dispatchConfig.registrationName, PluginModule); return true; } return false; } /** * Publishes a registration name that is used to identify dispatched events and * can be used with `EventPluginHub.putListener` to register listeners. * * @param {string} registrationName Registration name to add. * @param {object} PluginModule Plugin publishing the event. * @private */ function publishRegistrationName(registrationName, PluginModule) { invariant( !EventPluginRegistry.registrationNames[registrationName], 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName ); EventPluginRegistry.registrationNames[registrationName] = PluginModule; EventPluginRegistry.registrationNamesKeys.push(registrationName); } /** * Registers plugins so that they can extract and dispatch events. * * @see {EventPluginHub} */ var EventPluginRegistry = { /** * Ordered list of injected plugins. */ plugins: [], /** * Mapping from registration names to plugin modules. */ registrationNames: {}, /** * The keys of `registrationNames`. */ registrationNamesKeys: [], /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is * always deterministic regardless of packaging, on-the-fly injection, etc. * * @param {array} InjectedEventPluginOrder * @internal * @see {EventPluginHub.injection.injectEventPluginOrder} */ injectEventPluginOrder: function(InjectedEventPluginOrder) { invariant( !EventPluginOrder, 'EventPluginRegistry: Cannot inject event plugin ordering more than once.' ); // Clone the ordering so it cannot be dynamically mutated. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); recomputePluginOrdering(); }, /** * Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. * * Plugins can be injected as part of page initialization or on-the-fly. * * @param {object} injectedNamesToPlugins Map from names to plugin modules. * @internal * @see {EventPluginHub.injection.injectEventPluginsByName} */ injectEventPluginsByName: function(injectedNamesToPlugins) { var isOrderingDirty = false; for (var pluginName in injectedNamesToPlugins) { if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { continue; } var PluginModule = injectedNamesToPlugins[pluginName]; if (namesToPlugins[pluginName] !== PluginModule) { invariant( !namesToPlugins[pluginName], 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName ); namesToPlugins[pluginName] = PluginModule; isOrderingDirty = true; } } if (isOrderingDirty) { recomputePluginOrdering(); } }, /** * Looks up the plugin for the supplied event. * * @param {object} event A synthetic event. * @return {?object} The plugin that created the supplied event. * @internal */ getPluginModuleForEvent: function(event) { var dispatchConfig = event.dispatchConfig; if (dispatchConfig.registrationName) { return EventPluginRegistry.registrationNames[ dispatchConfig.registrationName ] || null; } for (var phase in dispatchConfig.phasedRegistrationNames) { if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) { continue; } var PluginModule = EventPluginRegistry.registrationNames[ dispatchConfig.phasedRegistrationNames[phase] ]; if (PluginModule) { return PluginModule; } } return null; }, /** * Exposed for unit testing. * @private */ _resetEventPlugins: function() { EventPluginOrder = null; for (var pluginName in namesToPlugins) { if (namesToPlugins.hasOwnProperty(pluginName)) { delete namesToPlugins[pluginName]; } } EventPluginRegistry.plugins.length = 0; var registrationNames = EventPluginRegistry.registrationNames; for (var registrationName in registrationNames) { if (registrationNames.hasOwnProperty(registrationName)) { delete registrationNames[registrationName]; } } EventPluginRegistry.registrationNamesKeys.length = 0; } }; module.exports = EventPluginRegistry; },{"./invariant":95}],18:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventPluginUtils */ "use strict"; var EventConstants = require("./EventConstants"); var invariant = require("./invariant"); var topLevelTypes = EventConstants.topLevelTypes; function isEndish(topLevelType) { return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; } function isMoveish(topLevelType) { return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; } function isStartish(topLevelType) { return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; } var validateEventDispatches; if (true) { validateEventDispatches = function(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; var listenersIsArr = Array.isArray(dispatchListeners); var idsIsArr = Array.isArray(dispatchIDs); var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0; var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; invariant( idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.' ); }; } /** * Invokes `cb(event, listener, id)`. Avoids using call if no scope is * provided. The `(listener,id)` pair effectively forms the "dispatch" but are * kept separate to conserve memory. */ function forEachEventDispatch(event, cb) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if (true) { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. cb(event, dispatchListeners[i], dispatchIDs[i]); } } else if (dispatchListeners) { cb(event, dispatchListeners, dispatchIDs); } } /** * Default implementation of PluginModule.executeDispatch(). * @param {SyntheticEvent} SyntheticEvent to handle * @param {function} Application-level callback * @param {string} domID DOM id to pass to the callback. */ function executeDispatch(event, listener, domID) { listener(event, domID); } /** * Standard/simple iteration through an event's collected dispatches. */ function executeDispatchesInOrder(event, executeDispatch) { forEachEventDispatch(event, executeDispatch); event._dispatchListeners = null; event._dispatchIDs = null; } /** * Standard/simple iteration through an event's collected dispatches, but stops * at the first dispatch execution returning true, and returns that id. * * @return id of the first dispatch execution who's listener returns true, or * null if no listener returned true. */ function executeDispatchesInOrderStopAtTrue(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if (true) { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. if (dispatchListeners[i](event, dispatchIDs[i])) { return dispatchIDs[i]; } } } else if (dispatchListeners) { if (dispatchListeners(event, dispatchIDs)) { return dispatchIDs; } } return null; } /** * Execution of a "direct" dispatch - there must be at most one dispatch * accumulated on the event or it is considered an error. It doesn't really make * sense for an event with multiple dispatches (bubbled) to keep track of the * return values at each dispatch execution, but it does tend to make sense when * dealing with "direct" dispatches. * * @return The return value of executing the single dispatch. */ function executeDirectDispatch(event) { if (true) { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchID = event._dispatchIDs; invariant( !Array.isArray(dispatchListener), 'executeDirectDispatch(...): Invalid `event`.' ); var res = dispatchListener ? dispatchListener(event, dispatchID) : null; event._dispatchListeners = null; event._dispatchIDs = null; return res; } /** * @param {SyntheticEvent} event * @return {bool} True iff number of dispatches accumulated is greater than 0. */ function hasDispatches(event) { return !!event._dispatchListeners; } /** * General utilities that are useful in creating custom Event Plugins. */ var EventPluginUtils = { isEndish: isEndish, isMoveish: isMoveish, isStartish: isStartish, executeDispatchesInOrder: executeDispatchesInOrder, executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, executeDirectDispatch: executeDirectDispatch, hasDispatches: hasDispatches, executeDispatch: executeDispatch }; module.exports = EventPluginUtils; },{"./EventConstants":14,"./invariant":95}],19:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventPropagators */ "use strict"; var CallbackRegistry = require("./CallbackRegistry"); var EventConstants = require("./EventConstants"); var accumulate = require("./accumulate"); var forEachAccumulated = require("./forEachAccumulated"); var getListener = CallbackRegistry.getListener; var PropagationPhases = EventConstants.PropagationPhases; /** * Injected dependencies: */ /** * - `InstanceHandle`: [required] Module that performs logical traversals of DOM * hierarchy given ids of the logical DOM elements involved. */ var injection = { InstanceHandle: null, injectInstanceHandle: function(InjectedInstanceHandle) { injection.InstanceHandle = InjectedInstanceHandle; if (true) { injection.validate(); } }, validate: function() { var invalid = !injection.InstanceHandle|| !injection.InstanceHandle.traverseTwoPhase || !injection.InstanceHandle.traverseEnterLeave; if (invalid) { throw new Error('InstanceHandle not injected before use!'); } } }; /** * Some event types have a notion of different registration names for different * "phases" of propagation. This finds listeners by a given phase. */ function listenerAtPhase(id, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(id, registrationName); } /** * Tags a `SyntheticEvent` with dispatched listeners. Creating this function * here, allows us to not have to bind or create functions for each event. * Mutating the event's members allows us to not have to create a wrapping * "dispatch" object that pairs the event with the listener. */ function accumulateDirectionalDispatches(domID, upwards, event) { if (true) { if (!domID) { throw new Error('Dispatching id must not be null'); } injection.validate(); } var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPhase(domID, event, phase); if (listener) { event._dispatchListeners = accumulate(event._dispatchListeners, listener); event._dispatchIDs = accumulate(event._dispatchIDs, domID); } } /** * Collect dispatches (must be entirely collected before dispatching - see unit * tests). Lazily allocate the array to conserve memory. We must loop through * each event and perform the traversal for each one. We can not perform a * single traversal for the entire collection of events because each event may * have a different target. */ function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { injection.InstanceHandle.traverseTwoPhase( event.dispatchMarker, accumulateDirectionalDispatches, event ); } } /** * Accumulates without regard to direction, does not look for phased * registration names. Same as `accumulateDirectDispatchesSingle` but without * requiring that the `dispatchMarker` be the same as the dispatched ID. */ function accumulateDispatches(id, ignoredDirection, event) { if (event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { event._dispatchListeners = accumulate(event._dispatchListeners, listener); event._dispatchIDs = accumulate(event._dispatchIDs, id); } } } /** * Accumulates dispatches on an `SyntheticEvent`, but only for the * `dispatchMarker`. * @param {SyntheticEvent} event */ function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event.dispatchMarker, null, event); } } function accumulateTwoPhaseDispatches(events) { if (true) { injection.validate(); } forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { if (true) { injection.validate(); } injection.InstanceHandle.traverseEnterLeave( fromID, toID, accumulateDispatches, leave, enter ); } function accumulateDirectDispatches(events) { if (true) { injection.validate(); } forEachAccumulated(events, accumulateDirectDispatchesSingle); } /** * A small set of propagation patterns, each of which will accept a small amount * of information, and generate a set of "dispatch ready event objects" - which * are sets of events that have already been annotated with a set of dispatched * listener functions/ids. The API is designed this way to discourage these * propagation strategies from actually executing the dispatches, since we * always want to collect the entire set of dispatches before executing event a * single one. * * @constructor EventPropagators */ var EventPropagators = { accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, accumulateDirectDispatches: accumulateDirectDispatches, accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches, injection: injection }; module.exports = EventPropagators; },{"./CallbackRegistry":4,"./EventConstants":14,"./accumulate":74,"./forEachAccumulated":86}],20:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ExecutionEnvironment */ /*jslint evil: true */ "use strict"; var canUseDOM = typeof window !== 'undefined'; /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; },{}],21:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule LinkedValueMixin * @typechecks static-only */ "use strict"; var invariant = require("./invariant"); /** * Provide a linked `value` attribute for controlled forms. You should not use * this outside of the ReactDOM controlled form components. */ var LinkedValueMixin = { _assertLink: function() { invariant( this.props.value == null && this.props.onChange == null, 'Cannot provide a valueLink and a value or onChange event. If you ' + 'want to use value or onChange, you probably don\'t want to use ' + 'valueLink' ); }, /** * @return {*} current value of the input either from value prop or link. */ getValue: function() { if (this.props.valueLink) { this._assertLink(); return this.props.valueLink.value; } return this.props.value; }, /** * @return {function} change callback either from onChange prop or link. */ getOnChange: function() { if (this.props.valueLink) { this._assertLink(); return this._handleLinkedValueChange; } return this.props.onChange; }, /** * @param {SyntheticEvent} e change event to handle */ _handleLinkedValueChange: function(e) { this.props.valueLink.requestChange(e.target.value); } }; module.exports = LinkedValueMixin; },{"./invariant":95}],22:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule MobileSafariClickEventPlugin * @typechecks static-only */ "use strict"; var EventConstants = require("./EventConstants"); var emptyFunction = require("./emptyFunction"); var topLevelTypes = EventConstants.topLevelTypes; /** * Mobile Safari does not fire properly bubble click events on non-interactive * elements, which means delegated click listeners do not fire. The workaround * for this bug involves attaching an empty click listener on the target node. * * This particular plugin works around the bug by attaching an empty click * listener on `touchstart` (which does fire on every element). */ var MobileSafariClickEventPlugin = { eventTypes: null, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { if (topLevelType === topLevelTypes.topTouchStart) { var target = nativeEvent.target; if (target && !target.onclick) { target.onclick = emptyFunction; } } } }; module.exports = MobileSafariClickEventPlugin; },{"./EventConstants":14,"./emptyFunction":81}],23:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule PooledClass */ "use strict"; /** * Static poolers. Several custom versions for each potential number of * arguments. A completely generic pooler is easy to implement, but would * require accessing the `arguments` object. In each of these, `this` refers to * the Class itself, not an instance. If any others are needed, simply add them * here, or in their own files. */ var oneArgumentPooler = function(copyFieldsFrom) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, copyFieldsFrom); return instance; } else { return new Klass(copyFieldsFrom); } }; var twoArgumentPooler = function(a1, a2) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2); return instance; } else { return new Klass(a1, a2); } }; var threeArgumentPooler = function(a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3); return instance; } else { return new Klass(a1, a2, a3); } }; var fiveArgumentPooler = function(a1, a2, a3, a4, a5) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3, a4, a5); return instance; } else { return new Klass(a1, a2, a3, a4, a5); } }; var standardReleaser = function(instance) { var Klass = this; if (instance.destructor) { instance.destructor(); } if (Klass.instancePool.length < Klass.poolSize) { Klass.instancePool.push(instance); } }; var DEFAULT_POOL_SIZE = 10; var DEFAULT_POOLER = oneArgumentPooler; /** * Augments `CopyConstructor` to be a poolable class, augmenting only the class * itself (statically) not adding any prototypical fields. Any CopyConstructor * you give this may have a `poolSize` property, and will look for a * prototypical `destructor` on instances (optional). * * @param {Function} CopyConstructor Constructor that can be used to reset. * @param {Function} pooler Customizable pooler. */ var addPoolingTo = function(CopyConstructor, pooler) { var NewKlass = CopyConstructor; NewKlass.instancePool = []; NewKlass.getPooled = pooler || DEFAULT_POOLER; if (!NewKlass.poolSize) { NewKlass.poolSize = DEFAULT_POOL_SIZE; } NewKlass.release = standardReleaser; return NewKlass; }; var PooledClass = { addPoolingTo: addPoolingTo, oneArgumentPooler: oneArgumentPooler, twoArgumentPooler: twoArgumentPooler, threeArgumentPooler: threeArgumentPooler, fiveArgumentPooler: fiveArgumentPooler }; module.exports = PooledClass; },{}],24:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule React */ "use strict"; var ReactComponent = require("./ReactComponent"); var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactCurrentOwner = require("./ReactCurrentOwner"); var ReactDOM = require("./ReactDOM"); var ReactDOMComponent = require("./ReactDOMComponent"); var ReactDefaultInjection = require("./ReactDefaultInjection"); var ReactInstanceHandles = require("./ReactInstanceHandles"); var ReactMount = require("./ReactMount"); var ReactMultiChild = require("./ReactMultiChild"); var ReactPerf = require("./ReactPerf"); var ReactPropTypes = require("./ReactPropTypes"); var ReactServerRendering = require("./ReactServerRendering"); var ReactTextComponent = require("./ReactTextComponent"); ReactDefaultInjection.inject(); var React = { DOM: ReactDOM, PropTypes: ReactPropTypes, initializeTouchEvents: function(shouldUseTouch) { ReactMount.useTouchEvents = shouldUseTouch; }, createClass: ReactCompositeComponent.createClass, constructAndRenderComponent: ReactMount.constructAndRenderComponent, constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID, renderComponent: ReactPerf.measure( 'React', 'renderComponent', ReactMount.renderComponent ), renderComponentToString: ReactServerRendering.renderComponentToString, unmountComponentAtNode: ReactMount.unmountComponentAtNode, unmountAndReleaseReactRootNode: ReactMount.unmountAndReleaseReactRootNode, isValidClass: ReactCompositeComponent.isValidClass, isValidComponent: ReactComponent.isValidComponent, __internals: { Component: ReactComponent, CurrentOwner: ReactCurrentOwner, DOMComponent: ReactDOMComponent, InstanceHandles: ReactInstanceHandles, Mount: ReactMount, MultiChild: ReactMultiChild, TextComponent: ReactTextComponent } }; // Version exists only in the open-source version of React, not in Facebook's // internal version. React.version = '0.5.2'; module.exports = React; },{"./ReactComponent":25,"./ReactCompositeComponent":28,"./ReactCurrentOwner":29,"./ReactDOM":30,"./ReactDOMComponent":32,"./ReactDefaultInjection":41,"./ReactInstanceHandles":47,"./ReactMount":49,"./ReactMultiChild":51,"./ReactPerf":54,"./ReactPropTypes":56,"./ReactServerRendering":58,"./ReactTextComponent":59}],25:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactComponent */ "use strict"; var ReactComponentEnvironment = require("./ReactComponentEnvironment"); var ReactCurrentOwner = require("./ReactCurrentOwner"); var ReactOwner = require("./ReactOwner"); var ReactUpdates = require("./ReactUpdates"); var invariant = require("./invariant"); var keyMirror = require("./keyMirror"); var merge = require("./merge"); /** * Every React component is in one of these life cycles. */ var ComponentLifeCycle = keyMirror({ /** * Mounted components have a DOM node representation and are capable of * receiving new props. */ MOUNTED: null, /** * Unmounted components are inactive and cannot receive new props. */ UNMOUNTED: null }); /** * Warn if there's no key explicitly set on dynamic arrays of children. * This allows us to keep track of children between updates. */ var ownerHasWarned = {}; /** * Warn if the component doesn't have an explicit key assigned to it. * This component is in an array. The array could grow and shrink or be * reordered. All children, that hasn't already been validated, are required to * have a "key" property assigned to it. * * @internal * @param {ReactComponent} component Component that requires a key. */ function validateExplicitKey(component) { if (component.__keyValidated__ || component.props.key != null) { return; } component.__keyValidated__ = true; // We can't provide friendly warnings for top level components. if (!ReactCurrentOwner.current) { return; } // Name of the component whose render method tried to pass children. var currentName = ReactCurrentOwner.current.constructor.displayName; if (ownerHasWarned.hasOwnProperty(currentName)) { return; } ownerHasWarned[currentName] = true; var message = 'Each child in an array should have a unique "key" prop. ' + 'Check the render method of ' + currentName + '.'; if (!component.isOwnedBy(ReactCurrentOwner.current)) { // Name of the component that originally created this child. var childOwnerName = component.props.__owner__ && component.props.__owner__.constructor.displayName; // Usually the current owner is the offender, but if it accepts // children as a property, it may be the creator of the child that's // responsible for assigning it a key. message += ' It was passed a child from ' + childOwnerName + '.'; } console.warn(message); } /** * Ensure that every component either is passed in a static location or, if * if it's passed in an array, has an explicit key property defined. * * @internal * @param {*} component Statically passed child of any type. * @return {boolean} */ function validateChildKeys(component) { if (Array.isArray(component)) { for (var i = 0; i < component.length; i++) { var child = component[i]; if (ReactComponent.isValidComponent(child)) { validateExplicitKey(child); } } } else if (ReactComponent.isValidComponent(component)) { // This component was passed in a valid location. component.__keyValidated__ = true; } } /** * Components are the basic units of composition in React. * * Every component accepts a set of keyed input parameters known as "props" that * are initialized by the constructor. Once a component is mounted, the props * can be mutated using `setProps` or `replaceProps`. * * Every component is capable of the following operations: * * `mountComponent` * Initializes the component, renders markup, and registers event listeners. * * `receiveProps` * Updates the rendered DOM nodes given a new set of props. * * `unmountComponent` * Releases any resources allocated by this component. * * Components can also be "owned" by other components. Being owned by another * component means being constructed by that component. This is different from * being the child of a component, which means having a DOM representation that * is a child of the DOM representation of that component. * * @class ReactComponent */ var ReactComponent = { /** * @param {?object} object * @return {boolean} True if `object` is a valid component. * @final */ isValidComponent: function(object) { return !!( object && typeof object.mountComponentIntoNode === 'function' && typeof object.receiveProps === 'function' ); }, /** * Generate a key string that identifies a component within a set. * * @param {*} component A component that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string} * @internal */ getKey: function(component, index) { if (component && component.props && component.props.key != null) { // Explicit key return '{' + component.props.key + '}'; } // Implicit key determined by the index in the set return '[' + index + ']'; }, /** * @internal */ LifeCycle: ComponentLifeCycle, /** * Injected module that provides ability to mutate individual properties. * Injected into the base class because many different subclasses need access * to this. * * @internal */ DOMIDOperations: ReactComponentEnvironment.DOMIDOperations, /** * Optionally injectable environment dependent cleanup hook. (server vs. * browser etc). Example: A browser system caches DOM nodes based on component * ID and must remove that cache entry when this instance is unmounted. * * @private */ unmountIDFromEnvironment: ReactComponentEnvironment.unmountIDFromEnvironment, /** * The "image" of a component tree, is the platform specific (typically * serialized) data that represents a tree of lower level UI building blocks. * On the web, this "image" is HTML markup which describes a construction of * low level `div` and `span` nodes. Other platforms may have different * encoding of this "image". This must be injected. * * @private */ mountImageIntoNode: ReactComponentEnvironment.mountImageIntoNode, /** * React references `ReactReconcileTransaction` using this property in order * to allow dependency injection. * * @internal */ ReactReconcileTransaction: ReactComponentEnvironment.ReactReconcileTransaction, /** * Base functionality for every ReactComponent constructor. Mixed into the * `ReactComponent` prototype, but exposed statically for easy access. * * @lends {ReactComponent.prototype} */ Mixin: merge(ReactComponentEnvironment.Mixin, { /** * Checks whether or not this component is mounted. * * @return {boolean} True if mounted, false otherwise. * @final * @protected */ isMounted: function() { return this._lifeCycleState === ComponentLifeCycle.MOUNTED; }, /** * Sets a subset of the props. * * @param {object} partialProps Subset of the next props. * @param {?function} callback Called after props are updated. * @final * @public */ setProps: function(partialProps, callback) { // Merge with `_pendingProps` if it exists, otherwise with existing props. this.replaceProps( merge(this._pendingProps || this.props, partialProps), callback ); }, /** * Replaces all of the props. * * @param {object} props New props. * @param {?function} callback Called after props are updated. * @final * @public */ replaceProps: function(props, callback) { invariant( !this.props.__owner__, 'replaceProps(...): You called `setProps` or `replaceProps` on a ' + 'component with an owner. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.' ); invariant( this.isMounted(), 'replaceProps(...): Can only update a mounted component.' ); this._pendingProps = props; ReactUpdates.enqueueUpdate(this, callback); }, /** * Base constructor for all React component. * * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.construct.call(this, ...)`. * * @param {?object} initialProps * @param {*} children * @internal */ construct: function(initialProps, children) { this.props = initialProps || {}; // Record the component responsible for creating this component. this.props.__owner__ = ReactCurrentOwner.current; // All components start unmounted. this._lifeCycleState = ComponentLifeCycle.UNMOUNTED; this._pendingProps = null; this._pendingCallbacks = null; // Children can be more than one argument var childrenLength = arguments.length - 1; if (childrenLength === 1) { if (true) { validateChildKeys(children); } this.props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { if (true) { validateChildKeys(arguments[i + 1]); } childArray[i] = arguments[i + 1]; } this.props.children = childArray; } }, /** * Initializes the component, renders markup, and registers event listeners. * * NOTE: This does not insert any nodes into the DOM. * * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.mountComponent.call(this, ...)`. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy. * @return {?string} Rendered markup to be inserted into the DOM. * @internal */ mountComponent: function(rootID, transaction, mountDepth) { invariant( !this.isMounted(), 'mountComponent(%s, ...): Can only mount an unmounted component.', rootID ); var props = this.props; if (props.ref != null) { ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__); } this._rootNodeID = rootID; this._lifeCycleState = ComponentLifeCycle.MOUNTED; this._mountDepth = mountDepth; // Effectively: return ''; }, /** * Releases any resources allocated by `mountComponent`. * * NOTE: This does not remove any nodes from the DOM. * * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.unmountComponent.call(this)`. * * @internal */ unmountComponent: function() { invariant( this.isMounted(), 'unmountComponent(): Can only unmount a mounted component.' ); var props = this.props; if (props.ref != null) { ReactOwner.removeComponentAsRefFrom(this, props.ref, props.__owner__); } ReactComponent.unmountIDFromEnvironment(this._rootNodeID); this._rootNodeID = null; this._lifeCycleState = ComponentLifeCycle.UNMOUNTED; }, /** * Updates the rendered DOM nodes given a new set of props. * * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.receiveProps.call(this, ...)`. * * @param {object} nextProps Next set of properties. * @param {ReactReconcileTransaction} transaction * @internal */ receiveProps: function(nextProps, transaction) { invariant( this.isMounted(), 'receiveProps(...): Can only update a mounted component.' ); this._pendingProps = nextProps; this._performUpdateIfNecessary(transaction); }, /** * Call `_performUpdateIfNecessary` within a new transaction. * * @param {ReactReconcileTransaction} transaction * @internal */ performUpdateIfNecessary: function() { var transaction = ReactComponent.ReactReconcileTransaction.getPooled(); transaction.perform(this._performUpdateIfNecessary, this, transaction); ReactComponent.ReactReconcileTransaction.release(transaction); }, /** * If `_pendingProps` is set, update the component. * * @param {ReactReconcileTransaction} transaction * @internal */ _performUpdateIfNecessary: function(transaction) { if (this._pendingProps == null) { return; } var prevProps = this.props; this.props = this._pendingProps; this._pendingProps = null; this.updateComponent(transaction, prevProps); }, /** * Updates the component's currently mounted representation. * * @param {ReactReconcileTransaction} transaction * @param {object} prevProps * @internal */ updateComponent: function(transaction, prevProps) { var props = this.props; // If either the owner or a `ref` has changed, make sure the newest owner // has stored a reference to `this`, and the previous owner (if different) // has forgotten the reference to `this`. if (props.__owner__ !== prevProps.__owner__ || props.ref !== prevProps.ref) { if (prevProps.ref != null) { ReactOwner.removeComponentAsRefFrom( this, prevProps.ref, prevProps.__owner__ ); } // Correct, even if the owner is the same, and only the ref has changed. if (props.ref != null) { ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__); } } }, /** * Mounts this component and inserts it into the DOM. * * @param {string} rootID DOM ID of the root node. * @param {DOMElement} container DOM element to mount into. * @param {boolean} shouldReuseMarkup If true, do not insert markup * @final * @internal * @see {ReactMount.renderComponent} */ mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) { var transaction = ReactComponent.ReactReconcileTransaction.getPooled(); transaction.perform( this._mountComponentIntoNode, this, rootID, container, transaction, shouldReuseMarkup ); ReactComponent.ReactReconcileTransaction.release(transaction); }, /** * @param {string} rootID DOM ID of the root node. * @param {DOMElement} container DOM element to mount into. * @param {ReactReconcileTransaction} transaction * @param {boolean} shouldReuseMarkup If true, do not insert markup * @final * @private */ _mountComponentIntoNode: function( rootID, container, transaction, shouldReuseMarkup) { var markup = this.mountComponent(rootID, transaction, 0); ReactComponent.mountImageIntoNode(markup, container, shouldReuseMarkup); }, /** * Checks if this component is owned by the supplied `owner` component. * * @param {ReactComponent} owner Component to check. * @return {boolean} True if `owners` owns this component. * @final * @internal */ isOwnedBy: function(owner) { return this.props.__owner__ === owner; }, /** * Gets another component, that shares the same owner as this one, by ref. * * @param {string} ref of a sibling Component. * @return {?ReactComponent} the actual sibling Component. * @final * @internal */ getSiblingByRef: function(ref) { var owner = this.props.__owner__; if (!owner || !owner.refs) { return null; } return owner.refs[ref]; } }) }; module.exports = ReactComponent; },{"./ReactComponentEnvironment":27,"./ReactCurrentOwner":29,"./ReactOwner":53,"./ReactUpdates":60,"./invariant":95,"./keyMirror":101,"./merge":104}],26:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactComponentBrowserEnvironment */ /*jslint evil: true */ "use strict"; var ReactDOMIDOperations = require("./ReactDOMIDOperations"); var ReactMarkupChecksum = require("./ReactMarkupChecksum"); var ReactMount = require("./ReactMount"); var ReactReconcileTransaction = require("./ReactReconcileTransaction"); var getReactRootElementInContainer = require("./getReactRootElementInContainer"); var invariant = require("./invariant"); var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup"); var ELEMENT_NODE_TYPE = 1; var DOC_NODE_TYPE = 9; /** * Abstracts away all functionality of `ReactComponent` requires knowledge of * the browser context. */ var ReactComponentBrowserEnvironment = { /** * Mixed into every component instance. */ Mixin: { /** * Returns the DOM node rendered by this component. * * @return {DOMElement} The root node of this component. * @final * @protected */ getDOMNode: function() { invariant( this.isMounted(), 'getDOMNode(): A component must be mounted to have a DOM node.' ); return ReactMount.getNode(this._rootNodeID); } }, ReactReconcileTransaction: ReactReconcileTransaction, DOMIDOperations: ReactDOMIDOperations, /** * If a particular environment requires that some resources be cleaned up, * specify this in the injected Mixin. In the DOM, we would likely want to * purge any cached node ID lookups. * * @private */ unmountIDFromEnvironment: function(rootNodeID) { ReactMount.purgeID(rootNodeID); }, /** * @param {string} markup Markup string to place into the DOM Element. * @param {DOMElement} container DOM Element to insert markup into. * @param {boolean} shouldReuseMarkup Should reuse the existing markup in the * container if possible. */ mountImageIntoNode: function(markup, container, shouldReuseMarkup) { invariant( container && ( container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender ), 'mountComponentIntoNode(...): Target container is not valid.' ); if (shouldReuseMarkup) { if (ReactMarkupChecksum.canReuseMarkup( markup, getReactRootElementInContainer(container))) { return; } else { if (true) { console.warn( 'React attempted to use reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are using ' + 'server rendering and the markup generated on the server was ' + 'not what the client was expecting. React injected new markup ' + 'to compensate which works but you have lost many of the ' + 'benefits of server rendering. Instead, figure out why the ' + 'markup being generated is different on the client or server.' ); } } } // You can't naively set the innerHTML of the entire document. You need // to mutate documentElement which requires doing some crazy tricks. See // mutateHTMLNodeWithMarkup() if (container.nodeType === DOC_NODE_TYPE) { mutateHTMLNodeWithMarkup(container.documentElement, markup); return; } // Asynchronously inject markup by ensuring that the container is not in // the document when settings its `innerHTML`. var parent = container.parentNode; if (parent) { var next = container.nextSibling; parent.removeChild(container); container.innerHTML = markup; if (next) { parent.insertBefore(container, next); } else { parent.appendChild(container); } } else { container.innerHTML = markup; } } }; module.exports = ReactComponentBrowserEnvironment; },{"./ReactDOMIDOperations":34,"./ReactMarkupChecksum":48,"./ReactMount":49,"./ReactReconcileTransaction":57,"./getReactRootElementInContainer":92,"./invariant":95,"./mutateHTMLNodeWithMarkup":108}],27:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactComponentEnvironment */ var ReactComponentBrowserEnvironment = require("./ReactComponentBrowserEnvironment"); var ReactComponentEnvironment = ReactComponentBrowserEnvironment; module.exports = ReactComponentEnvironment; },{"./ReactComponentBrowserEnvironment":26}],28:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactCompositeComponent */ "use strict"; var ReactComponent = require("./ReactComponent"); var ReactCurrentOwner = require("./ReactCurrentOwner"); var ReactOwner = require("./ReactOwner"); var ReactPerf = require("./ReactPerf"); var ReactPropTransferer = require("./ReactPropTransferer"); var ReactUpdates = require("./ReactUpdates"); var invariant = require("./invariant"); var keyMirror = require("./keyMirror"); var merge = require("./merge"); var mixInto = require("./mixInto"); var objMap = require("./objMap"); /** * Policies that describe methods in `ReactCompositeComponentInterface`. */ var SpecPolicy = keyMirror({ /** * These methods may be defined only once by the class specification or mixin. */ DEFINE_ONCE: null, /** * These methods may be defined by both the class specification and mixins. * Subsequent definitions will be chained. These methods must return void. */ DEFINE_MANY: null, /** * These methods are overriding the base ReactCompositeComponent class. */ OVERRIDE_BASE: null, /** * These methods are similar to DEFINE_MANY, except we assume they return * objects. We try to merge the keys of the return values of all the mixed in * functions. If there is a key conflict we throw. */ DEFINE_MANY_MERGED: null }); /** * Composite components are higher-level components that compose other composite * or native components. * * To create a new type of `ReactCompositeComponent`, pass a specification of * your new class to `React.createClass`. The only requirement of your class * specification is that you implement a `render` method. * * var MyComponent = React.createClass({ * render: function() { * return <div>Hello World</div>; * } * }); * * The class specification supports a specific protocol of methods that have * special meaning (e.g. `render`). See `ReactCompositeComponentInterface` for * more the comprehensive protocol. Any other properties and methods in the * class specification will available on the prototype. * * @interface ReactCompositeComponentInterface * @internal */ var ReactCompositeComponentInterface = { /** * An array of Mixin objects to include when defining your component. * * @type {array} * @optional */ mixins: SpecPolicy.DEFINE_MANY, /** * Definition of prop types for this component. * * @type {object} * @optional */ propTypes: SpecPolicy.DEFINE_ONCE, // ==== Definition methods ==== /** * Invoked when the component is mounted. Values in the mapping will be set on * `this.props` if that prop is not specified (i.e. using an `in` check). * * This method is invoked before `getInitialState` and therefore cannot rely * on `this.state` or use `this.setState`. * * @return {object} * @optional */ getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, /** * Invoked once before the component is mounted. The return value will be used * as the initial value of `this.state`. * * getInitialState: function() { * return { * isOn: false, * fooBaz: new BazFoo() * } * } * * @return {object} * @optional */ getInitialState: SpecPolicy.DEFINE_MANY_MERGED, /** * Uses props from `this.props` and state from `this.state` to render the * structure of the component. * * No guarantees are made about when or how often this method is invoked, so * it must not have side effects. * * render: function() { * var name = this.props.name; * return <div>Hello, {name}!</div>; * } * * @return {ReactComponent} * @nosideeffects * @required */ render: SpecPolicy.DEFINE_ONCE, // ==== Delegate methods ==== /** * Invoked when the component is initially created and about to be mounted. * This may have side effects, but any external subscriptions or data created * by this method must be cleaned up in `componentWillUnmount`. * * @optional */ componentWillMount: SpecPolicy.DEFINE_MANY, /** * Invoked when the component has been mounted and has a DOM representation. * However, there is no guarantee that the DOM node is in the document. * * Use this as an opportunity to operate on the DOM when the component has * been mounted (initialized and rendered) for the first time. * * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidMount: SpecPolicy.DEFINE_MANY, /** * Invoked before the component receives new props. * * Use this as an opportunity to react to a prop transition by updating the * state using `this.setState`. Current props are accessed via `this.props`. * * componentWillReceiveProps: function(nextProps) { * this.setState({ * likesIncreasing: nextProps.likeCount > this.props.likeCount * }); * } * * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop * transition may cause a state change, but the opposite is not true. If you * need it, you are probably looking for `componentWillUpdate`. * * @param {object} nextProps * @optional */ componentWillReceiveProps: SpecPolicy.DEFINE_MANY, /** * Invoked while deciding if the component should be updated as a result of * receiving new props and state. * * Use this as an opportunity to `return false` when you're certain that the * transition to the new props and state will not require a component update. * * shouldComponentUpdate: function(nextProps, nextState) { * return !equal(nextProps, this.props) || !equal(nextState, this.state); * } * * @param {object} nextProps * @param {?object} nextState * @return {boolean} True if the component should update. * @optional */ shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, /** * Invoked when the component is about to update due to a transition from * `this.props` and `this.state` to `nextProps` and `nextState`. * * Use this as an opportunity to perform preparation before an update occurs. * * NOTE: You **cannot** use `this.setState()` in this method. * * @param {object} nextProps * @param {?object} nextState * @param {ReactReconcileTransaction} transaction * @optional */ componentWillUpdate: SpecPolicy.DEFINE_MANY, /** * Invoked when the component's DOM representation has been updated. * * Use this as an opportunity to operate on the DOM when the component has * been updated. * * @param {object} prevProps * @param {?object} prevState * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidUpdate: SpecPolicy.DEFINE_MANY, /** * Invoked when the component is about to be removed from its parent and have * its DOM representation destroyed. * * Use this as an opportunity to deallocate any external resources. * * NOTE: There is no `componentDidUnmount` since your component will have been * destroyed by that point. * * @optional */ componentWillUnmount: SpecPolicy.DEFINE_MANY, // ==== Advanced methods ==== /** * Updates the component's currently mounted DOM representation. * * By default, this implements React's rendering and reconciliation algorithm. * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction * @internal * @overridable */ updateComponent: SpecPolicy.OVERRIDE_BASE }; /** * Mapping from class specification keys to special processing functions. * * Although these are declared in the specification when defining classes * using `React.createClass`, they will not be on the component's prototype. */ var RESERVED_SPEC_KEYS = { displayName: function(Constructor, displayName) { Constructor.displayName = displayName; }, mixins: function(Constructor, mixins) { if (mixins) { for (var i = 0; i < mixins.length; i++) { mixSpecIntoComponent(Constructor, mixins[i]); } } }, propTypes: function(Constructor, propTypes) { Constructor.propTypes = propTypes; } }; function validateMethodOverride(proto, name) { var specPolicy = ReactCompositeComponentInterface[name]; // Disallow overriding of base class methods unless explicitly allowed. if (ReactCompositeComponentMixin.hasOwnProperty(name)) { invariant( specPolicy === SpecPolicy.OVERRIDE_BASE, 'ReactCompositeComponentInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name ); } // Disallow defining methods more than once unless explicitly allowed. if (proto.hasOwnProperty(name)) { invariant( specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED, 'ReactCompositeComponentInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name ); } } function validateLifeCycleOnReplaceState(instance) { var compositeLifeCycleState = instance._compositeLifeCycleState; invariant( instance.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING, 'replaceState(...): Can only update a mounted or mounting component.' ); invariant( compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, 'replaceState(...): Cannot update while unmounting component or during ' + 'an existing state transition (such as within `render`).' ); } /** * Custom version of `mixInto` which handles policy validation and reserved * specification keys when building `ReactCompositeComponent` classses. */ function mixSpecIntoComponent(Constructor, spec) { var proto = Constructor.prototype; for (var name in spec) { var property = spec[name]; if (!spec.hasOwnProperty(name) || !property) { continue; } validateMethodOverride(proto, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactCompositeComponent methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isCompositeComponentMethod = name in ReactCompositeComponentInterface; var isInherited = name in proto; var markedDontBind = property.__reactDontBind; var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isCompositeComponentMethod && !isInherited && !markedDontBind; if (shouldAutoBind) { if (!proto.__reactAutoBindMap) { proto.__reactAutoBindMap = {}; } proto.__reactAutoBindMap[name] = property; proto[name] = property; } else { if (isInherited) { // For methods which are defined more than once, call the existing // methods before calling the new property. if (ReactCompositeComponentInterface[name] === SpecPolicy.DEFINE_MANY_MERGED) { proto[name] = createMergedResultFunction(proto[name], property); } else { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; } } } } } /** * Merge two objects, but throw if both contain the same key. * * @param {object} one The first object, which is mutated. * @param {object} two The second object * @return {object} one after it has been mutated to contain everything in two. */ function mergeObjectsWithNoDuplicateKeys(one, two) { invariant( one && two && typeof one === 'object' && typeof two === 'object', 'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects' ); objMap(two, function(value, key) { invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: %s', key ); one[key] = value; }); return one; } /** * Creates a function that invokes two functions and merges their return values. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createMergedResultFunction(one, two) { return function mergedResult() { return mergeObjectsWithNoDuplicateKeys( one.apply(this, arguments), two.apply(this, arguments) ); }; } /** * Creates a function that invokes two functions and ignores their return vales. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createChainedFunction(one, two) { return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; } /** * `ReactCompositeComponent` maintains an auxiliary life cycle state in * `this._compositeLifeCycleState` (which can be null). * * This is different from the life cycle state maintained by `ReactComponent` in * `this._lifeCycleState`. The following diagram shows how the states overlap in * time. There are times when the CompositeLifeCycle is null - at those times it * is only meaningful to look at ComponentLifeCycle alone. * * Top Row: ReactComponent.ComponentLifeCycle * Low Row: ReactComponent.CompositeLifeCycle * * +-------+------------------------------------------------------+--------+ * | UN | MOUNTED | UN | * |MOUNTED| | MOUNTED| * +-------+------------------------------------------------------+--------+ * | ^--------+ +------+ +------+ +------+ +--------^ | * | | | | | | | | | | | | * | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 | * | | | |PROPS | | PROPS| | STATE| |MOUNTING| | * | | | | | | | | | | | | * | | | | | | | | | | | | * | +--------+ +------+ +------+ +------+ +--------+ | * | | | | * +-------+------------------------------------------------------+--------+ */ var CompositeLifeCycle = keyMirror({ /** * Components in the process of being mounted respond to state changes * differently. */ MOUNTING: null, /** * Components in the process of being unmounted are guarded against state * changes. */ UNMOUNTING: null, /** * Components that are mounted and receiving new props respond to state * changes differently. */ RECEIVING_PROPS: null, /** * Components that are mounted and receiving new state are guarded against * additional state changes. */ RECEIVING_STATE: null }); /** * @lends {ReactCompositeComponent.prototype} */ var ReactCompositeComponentMixin = { /** * Base constructor for all composite component. * * @param {?object} initialProps * @param {*} children * @final * @internal */ construct: function(initialProps, children) { // Children can be either an array or more than one argument ReactComponent.Mixin.construct.apply(this, arguments); this.state = null; this._pendingState = null; this._compositeLifeCycleState = null; }, /** * Checks whether or not this composite component is mounted. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function() { return ReactComponent.Mixin.isMounted.call(this) && this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING; }, /** * Initializes the component, renders markup, and registers event listeners. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {?string} Rendered markup to be inserted into the DOM. * @final * @internal */ mountComponent: ReactPerf.measure( 'ReactCompositeComponent', 'mountComponent', function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING; this._defaultProps = this.getDefaultProps ? this.getDefaultProps() : null; this._processProps(this.props); if (this.__reactAutoBindMap) { this._bindAutoBindMethods(); } this.state = this.getInitialState ? this.getInitialState() : null; this._pendingState = null; this._pendingForceUpdate = false; if (this.componentWillMount) { this.componentWillMount(); // When mounting, calls to `setState` by `componentWillMount` will set // `this._pendingState` without triggering a re-render. if (this._pendingState) { this.state = this._pendingState; this._pendingState = null; } } this._renderedComponent = this._renderValidatedComponent(); // Done with mounting, `setState` will now trigger UI changes. this._compositeLifeCycleState = null; var markup = this._renderedComponent.mountComponent( rootID, transaction, mountDepth + 1 ); if (this.componentDidMount) { transaction.getReactMountReady().enqueue(this, this.componentDidMount); } return markup; } ), /** * Releases any resources allocated by `mountComponent`. * * @final * @internal */ unmountComponent: function() { this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING; if (this.componentWillUnmount) { this.componentWillUnmount(); } this._compositeLifeCycleState = null; this._defaultProps = null; ReactComponent.Mixin.unmountComponent.call(this); this._renderedComponent.unmountComponent(); this._renderedComponent = null; if (this.refs) { this.refs = null; } // Some existing components rely on this.props even after they've been // destroyed (in event handlers). // TODO: this.props = null; // TODO: this.state = null; }, /** * Sets a subset of the state. Always use this or `replaceState` to mutate * state. You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * There is no guarantee that calls to `setState` will run synchronously, * as they may eventually be batched together. You can provide an optional * callback that will be executed when the call to setState is actually * completed. * * @param {object} partialState Next partial state to be merged with state. * @param {?function} callback Called after state is updated. * @final * @protected */ setState: function(partialState, callback) { // Merge with `_pendingState` if it exists, otherwise with existing state. this.replaceState( merge(this._pendingState || this.state, partialState), callback ); }, /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * @param {object} completeState Next state. * @param {?function} callback Called after state is updated. * @final * @protected */ replaceState: function(completeState, callback) { validateLifeCycleOnReplaceState(this); this._pendingState = completeState; ReactUpdates.enqueueUpdate(this, callback); }, /** * Processes props by setting default values for unspecified props and * asserting that the props are valid. * * @param {object} props * @private */ _processProps: function(props) { var propName; var defaultProps = this._defaultProps; for (propName in defaultProps) { if (!(propName in props)) { props[propName] = defaultProps[propName]; } } var propTypes = this.constructor.propTypes; if (propTypes) { var componentName = this.constructor.displayName; for (propName in propTypes) { var checkProp = propTypes[propName]; if (checkProp) { checkProp(props, propName, componentName); } } } }, performUpdateIfNecessary: function() { var compositeLifeCycleState = this._compositeLifeCycleState; // Do not trigger a state transition if we are in the middle of mounting or // receiving props because both of those will already be doing this. if (compositeLifeCycleState === CompositeLifeCycle.MOUNTING || compositeLifeCycleState === CompositeLifeCycle.RECEIVING_PROPS) { return; } ReactComponent.Mixin.performUpdateIfNecessary.call(this); }, /** * If any of `_pendingProps`, `_pendingState`, or `_pendingForceUpdate` is * set, update the component. * * @param {ReactReconcileTransaction} transaction * @internal */ _performUpdateIfNecessary: function(transaction) { if (this._pendingProps == null && this._pendingState == null && !this._pendingForceUpdate) { return; } var nextProps = this.props; if (this._pendingProps != null) { nextProps = this._pendingProps; this._processProps(nextProps); this._pendingProps = null; this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS; if (this.componentWillReceiveProps) { this.componentWillReceiveProps(nextProps, transaction); } } this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE; var nextState = this._pendingState || this.state; this._pendingState = null; if (this._pendingForceUpdate || !this.shouldComponentUpdate || this.shouldComponentUpdate(nextProps, nextState)) { this._pendingForceUpdate = false; // Will set `this.props` and `this.state`. this._performComponentUpdate(nextProps, nextState, transaction); } else { // If it's determined that a component should not update, we still want // to set props and state. this.props = nextProps; this.state = nextState; } this._compositeLifeCycleState = null; }, /** * Merges new props and state, notifies delegate methods of update and * performs update. * * @param {object} nextProps Next object to set as properties. * @param {?object} nextState Next object to set as state. * @param {ReactReconcileTransaction} transaction * @private */ _performComponentUpdate: function(nextProps, nextState, transaction) { var prevProps = this.props; var prevState = this.state; if (this.componentWillUpdate) { this.componentWillUpdate(nextProps, nextState, transaction); } this.props = nextProps; this.state = nextState; this.updateComponent(transaction, prevProps, prevState); if (this.componentDidUpdate) { transaction.getReactMountReady().enqueue( this, this.componentDidUpdate.bind(this, prevProps, prevState) ); } }, /** * Updates the component's currently mounted DOM representation. * * By default, this implements React's rendering and reconciliation algorithm. * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction * @param {object} prevProps * @param {?object} prevState * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactCompositeComponent', 'updateComponent', function(transaction, prevProps, prevState) { ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps); var currentComponent = this._renderedComponent; var nextComponent = this._renderValidatedComponent(); if (currentComponent.constructor === nextComponent.constructor) { currentComponent.receiveProps(nextComponent.props, transaction); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var currentComponentID = currentComponent._rootNodeID; currentComponent.unmountComponent(); this._renderedComponent = nextComponent; var nextMarkup = nextComponent.mountComponent( thisID, transaction, this._mountDepth + 1 ); ReactComponent.DOMIDOperations.dangerouslyReplaceNodeWithMarkupByID( currentComponentID, nextMarkup ); } } ), /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldUpdateComponent`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {?function} callback Called after update is complete. * @final * @protected */ forceUpdate: function(callback) { var compositeLifeCycleState = this._compositeLifeCycleState; invariant( this.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING, 'forceUpdate(...): Can only force an update on mounted or mounting ' + 'components.' ); invariant( compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, 'forceUpdate(...): Cannot force an update while unmounting component ' + 'or during an existing state transition (such as within `render`).' ); this._pendingForceUpdate = true; ReactUpdates.enqueueUpdate(this, callback); }, /** * @private */ _renderValidatedComponent: function() { var renderedComponent; ReactCurrentOwner.current = this; try { renderedComponent = this.render(); } catch (error) { // IE8 requires `catch` in order to use `finally`. throw error; } finally { ReactCurrentOwner.current = null; } invariant( ReactComponent.isValidComponent(renderedComponent), '%s.render(): A valid ReactComponent must be returned.', this.constructor.displayName || 'ReactCompositeComponent' ); return renderedComponent; }, /** * @private */ _bindAutoBindMethods: function() { for (var autoBindKey in this.__reactAutoBindMap) { if (!this.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { continue; } var method = this.__reactAutoBindMap[autoBindKey]; this[autoBindKey] = this._bindAutoBindMethod(method); } }, /** * Binds a method to the component. * * @param {function} method Method to be bound. * @private */ _bindAutoBindMethod: function(method) { var component = this; var boundMethod = function() { return method.apply(component, arguments); }; if (true) { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; boundMethod.bind = function(newThis) { // User is trying to bind() an autobound method; we effectively will // ignore the value of "this" that the user is trying to use, so // let's warn. if (newThis !== component && newThis !== null) { console.warn( 'bind(): React component methods may only be bound to the ' + 'component instance. See ' + componentName ); } else if (arguments.length === 1) { console.warn( 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See ' + componentName ); return boundMethod; } var reboundMethod = _bind.apply(boundMethod, arguments); reboundMethod.__reactBoundContext = component; reboundMethod.__reactBoundMethod = method; reboundMethod.__reactBoundArguments = Array.prototype.slice.call(arguments, 1); return reboundMethod; }; } return boundMethod; } }; var ReactCompositeComponentBase = function() {}; mixInto(ReactCompositeComponentBase, ReactComponent.Mixin); mixInto(ReactCompositeComponentBase, ReactOwner.Mixin); mixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin); mixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin); /** * Module for creating composite components. * * @class ReactCompositeComponent * @extends ReactComponent * @extends ReactOwner * @extends ReactPropTransferer */ var ReactCompositeComponent = { LifeCycle: CompositeLifeCycle, Base: ReactCompositeComponentBase, /** * Creates a composite component class given a class specification. * * @param {object} spec Class specification (which must define `render`). * @return {function} Component constructor function. * @public */ createClass: function(spec) { var Constructor = function() {}; Constructor.prototype = new ReactCompositeComponentBase(); Constructor.prototype.constructor = Constructor; mixSpecIntoComponent(Constructor, spec); invariant( Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.' ); if (true) { if (Constructor.prototype.componentShouldUpdate) { console.warn( (spec.displayName || 'A component') + ' has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.' ); } } // Reduce time spent doing lookups by setting these on the prototype. for (var methodName in ReactCompositeComponentInterface) { if (!Constructor.prototype[methodName]) { Constructor.prototype[methodName] = null; } } var ConvenienceConstructor = function(props, children) { var instance = new Constructor(); instance.construct.apply(instance, arguments); return instance; }; ConvenienceConstructor.componentConstructor = Constructor; ConvenienceConstructor.originalSpec = spec; return ConvenienceConstructor; }, /** * Checks if a value is a valid component constructor. * * @param {*} * @return {boolean} * @public */ isValidClass: function(componentClass) { return componentClass instanceof Function && 'componentConstructor' in componentClass && componentClass.componentConstructor instanceof Function; } }; module.exports = ReactCompositeComponent; },{"./ReactComponent":25,"./ReactCurrentOwner":29,"./ReactOwner":53,"./ReactPerf":54,"./ReactPropTransferer":55,"./ReactUpdates":60,"./invariant":95,"./keyMirror":101,"./merge":104,"./mixInto":107,"./objMap":110}],29:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactCurrentOwner */ "use strict"; /** * Keeps track of the current owner. * * The current owner is the component who should own any components that are * currently being constructed. * * The depth indicate how many composite components are above this render level. */ var ReactCurrentOwner = { /** * @internal * @type {ReactComponent} */ current: null }; module.exports = ReactCurrentOwner; },{}],30:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOM * @typechecks static-only */ "use strict"; var ReactDOMComponent = require("./ReactDOMComponent"); var mergeInto = require("./mergeInto"); var objMapKeyVal = require("./objMapKeyVal"); /** * Creates a new React class that is idempotent and capable of containing other * React components. It accepts event listeners and DOM properties that are * valid according to `DOMProperty`. * * - Event listeners: `onClick`, `onMouseDown`, etc. * - DOM properties: `className`, `name`, `title`, etc. * * The `style` property functions differently from the DOM API. It accepts an * object mapping of style properties to values. * * @param {string} tag Tag name (e.g. `div`). * @param {boolean} omitClose True if the close tag should be omitted. * @private */ function createDOMComponentClass(tag, omitClose) { var Constructor = function() {}; Constructor.prototype = new ReactDOMComponent(tag, omitClose); Constructor.prototype.constructor = Constructor; Constructor.displayName = tag; var ConvenienceConstructor = function(props, children) { var instance = new Constructor(); instance.construct.apply(instance, arguments); return instance; }; ConvenienceConstructor.componentConstructor = Constructor; return ConvenienceConstructor; } /** * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. * This is also accessible via `React.DOM`. * * @public */ var ReactDOM = objMapKeyVal({ a: false, abbr: false, address: false, area: false, article: false, aside: false, audio: false, b: false, base: false, bdi: false, bdo: false, big: false, blockquote: false, body: false, br: true, button: false, canvas: false, caption: false, cite: false, code: false, col: true, colgroup: false, data: false, datalist: false, dd: false, del: false, details: false, dfn: false, div: false, dl: false, dt: false, em: false, embed: true, fieldset: false, figcaption: false, figure: false, footer: false, form: false, // NOTE: Injected, see `ReactDOMForm`. h1: false, h2: false, h3: false, h4: false, h5: false, h6: false, head: false, header: false, hr: true, html: false, i: false, iframe: false, img: true, input: true, ins: false, kbd: false, keygen: true, label: false, legend: false, li: false, link: false, main: false, map: false, mark: false, menu: false, menuitem: false, // NOTE: Close tag should be omitted, but causes problems. meta: true, meter: false, nav: false, noscript: false, object: false, ol: false, optgroup: false, option: false, output: false, p: false, param: true, pre: false, progress: false, q: false, rp: false, rt: false, ruby: false, s: false, samp: false, script: false, section: false, select: false, small: false, source: false, span: false, strong: false, style: false, sub: false, summary: false, sup: false, table: false, tbody: false, td: false, textarea: false, // NOTE: Injected, see `ReactDOMTextarea`. tfoot: false, th: false, thead: false, time: false, title: false, tr: false, track: true, u: false, ul: false, 'var': false, video: false, wbr: false, // SVG circle: false, g: false, line: false, path: false, polyline: false, rect: false, svg: false, text: false }, createDOMComponentClass); var injection = { injectComponentClasses: function(componentClasses) { mergeInto(ReactDOM, componentClasses); } }; ReactDOM.injection = injection; module.exports = ReactDOM; },{"./ReactDOMComponent":32,"./mergeInto":106,"./objMapKeyVal":111}],31:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMButton */ "use strict"; var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); var keyMirror = require("./keyMirror"); // Store a reference to the <button> `ReactDOMComponent`. var button = ReactDOM.button; var mouseListenerNames = keyMirror({ onClick: true, onDoubleClick: true, onMouseDown: true, onMouseMove: true, onMouseUp: true, onClickCapture: true, onDoubleClickCapture: true, onMouseDownCapture: true, onMouseMoveCapture: true, onMouseUpCapture: true }); /** * Implements a <button> native component that does not receive mouse events * when `disabled` is set. */ var ReactDOMButton = ReactCompositeComponent.createClass({ render: function() { var props = {}; // Copy the props; except the mouse listeners if we're disabled for (var key in this.props) { if (this.props.hasOwnProperty(key) && (!this.props.disabled || !mouseListenerNames[key])) { props[key] = this.props[key]; } } return button(props, this.props.children); } }); module.exports = ReactDOMButton; },{"./ReactCompositeComponent":28,"./ReactDOM":30,"./keyMirror":101}],32:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMComponent * @typechecks static-only */ "use strict"; var CSSPropertyOperations = require("./CSSPropertyOperations"); var DOMProperty = require("./DOMProperty"); var DOMPropertyOperations = require("./DOMPropertyOperations"); var ReactComponent = require("./ReactComponent"); var ReactEventEmitter = require("./ReactEventEmitter"); var ReactMultiChild = require("./ReactMultiChild"); var ReactMount = require("./ReactMount"); var ReactPerf = require("./ReactPerf"); var escapeTextForBrowser = require("./escapeTextForBrowser"); var invariant = require("./invariant"); var keyOf = require("./keyOf"); var merge = require("./merge"); var mixInto = require("./mixInto"); var putListener = ReactEventEmitter.putListener; var deleteListener = ReactEventEmitter.deleteListener; var registrationNames = ReactEventEmitter.registrationNames; // For quickly matching children type, to test if can be treated as content. var CONTENT_TYPES = {'string': true, 'number': true}; var STYLE = keyOf({style: null}); /** * @param {?object} props */ function assertValidProps(props) { if (!props) { return; } // Note the use of `==` which checks for null or undefined. invariant( props.children == null || props.dangerouslySetInnerHTML == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ); invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + 'not a string.' ); } /** * @constructor ReactDOMComponent * @extends ReactComponent * @extends ReactMultiChild */ function ReactDOMComponent(tag, omitClose) { this._tagOpen = '<' + tag; this._tagClose = omitClose ? '' : '</' + tag + '>'; this.tagName = tag.toUpperCase(); } ReactDOMComponent.Mixin = { /** * Generates root tag markup then recurses. This method has side effects and * is not idempotent. * * @internal * @param {string} rootID The root DOM ID for this node. * @param {ReactReconcileTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {string} The computed markup. */ mountComponent: ReactPerf.measure( 'ReactDOMComponent', 'mountComponent', function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); assertValidProps(this.props); return ( this._createOpenTagMarkup() + this._createContentMarkup(transaction) + this._tagClose ); } ), /** * Creates markup for the open tag and all attributes. * * This method has side effects because events get registered. * * Iterating over object properties is faster than iterating over arrays. * @see http://jsperf.com/obj-vs-arr-iteration * * @private * @return {string} Markup of opening tag. */ _createOpenTagMarkup: function() { var props = this.props; var ret = this._tagOpen; for (var propKey in props) { if (!props.hasOwnProperty(propKey)) { continue; } var propValue = props[propKey]; if (propValue == null) { continue; } if (registrationNames[propKey]) { putListener(this._rootNodeID, propKey, propValue); } else { if (propKey === STYLE) { if (propValue) { propValue = props.style = merge(props.style); } propValue = CSSPropertyOperations.createMarkupForStyles(propValue); } var markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); if (markup) { ret += ' ' + markup; } } } var escapedID = escapeTextForBrowser(this._rootNodeID); return ret + ' ' + ReactMount.ATTR_NAME + '="' + escapedID + '">'; }, /** * Creates markup for the content between the tags. * * @private * @param {ReactReconcileTransaction} transaction * @return {string} Content markup. */ _createContentMarkup: function(transaction) { // Intentional use of != to avoid catching zero/false. var innerHTML = this.props.dangerouslySetInnerHTML; if (innerHTML != null) { if (innerHTML.__html != null) { return innerHTML.__html; } } else { var contentToUse = CONTENT_TYPES[typeof this.props.children] ? this.props.children : null; var childrenToUse = contentToUse != null ? null : this.props.children; if (contentToUse != null) { return escapeTextForBrowser(contentToUse); } else if (childrenToUse != null) { var mountImages = this.mountChildren( childrenToUse, transaction ); return mountImages.join(''); } } return ''; }, receiveProps: function(nextProps, transaction) { assertValidProps(nextProps); ReactComponent.Mixin.receiveProps.call(this, nextProps, transaction); }, /** * Updates a native DOM component after it has already been allocated and * attached to the DOM. Reconciles the root DOM node, then recurses. * * @param {ReactReconcileTransaction} transaction * @param {object} prevProps * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactDOMComponent', 'updateComponent', function(transaction, prevProps) { ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps); this._updateDOMProperties(prevProps); this._updateDOMChildren(prevProps, transaction); } ), /** * Reconciles the properties by detecting differences in property values and * updating the DOM as necessary. This function is probably the single most * critical path for performance optimization. * * TODO: Benchmark whether checking for changed values in memory actually * improves performance (especially statically positioned elements). * TODO: Benchmark the effects of putting this at the top since 99% of props * do not change for a given reconciliation. * TODO: Benchmark areas that can be improved with caching. * * @private * @param {object} lastProps */ _updateDOMProperties: function(lastProps) { var nextProps = this.props; var propKey; var styleName; var styleUpdates; for (propKey in lastProps) { if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) { continue; } if (propKey === STYLE) { var lastStyle = lastProps[propKey]; for (styleName in lastStyle) { if (lastStyle.hasOwnProperty(styleName)) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = ''; } } } else if (registrationNames[propKey]) { deleteListener(this._rootNodeID, propKey); } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { ReactComponent.DOMIDOperations.deletePropertyByID( this._rootNodeID, propKey ); } } for (propKey in nextProps) { var nextProp = nextProps[propKey]; var lastProp = lastProps[propKey]; if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) { continue; } if (propKey === STYLE) { if (nextProp) { nextProp = nextProps.style = merge(nextProp); } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. for (styleName in lastProp) { if (lastProp.hasOwnProperty(styleName) && !nextProp.hasOwnProperty(styleName)) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = ''; } } // Update styles that changed since `lastProp`. for (styleName in nextProp) { if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { styleUpdates = styleUpdates || {}; styleUpdates[styleName] = nextProp[styleName]; } } } else { // Relies on `updateStylesByID` not mutating `styleUpdates`. styleUpdates = nextProp; } } else if (registrationNames[propKey]) { putListener(this._rootNodeID, propKey, nextProp); } else if ( DOMProperty.isStandardName[propKey] || DOMProperty.isCustomAttribute(propKey)) { ReactComponent.DOMIDOperations.updatePropertyByID( this._rootNodeID, propKey, nextProp ); } } if (styleUpdates) { ReactComponent.DOMIDOperations.updateStylesByID( this._rootNodeID, styleUpdates ); } }, /** * Reconciles the children with the various properties that affect the * children content. * * @param {object} lastProps * @param {ReactReconcileTransaction} transaction */ _updateDOMChildren: function(lastProps, transaction) { var nextProps = this.props; var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; // Note the use of `!=` which checks for null or undefined. var lastChildren = lastContent != null ? null : lastProps.children; var nextChildren = nextContent != null ? null : nextProps.children; // If we're switching from children to content/html or vice versa, remove // the old content var lastHasContentOrHtml = lastContent != null || lastHtml != null; var nextHasContentOrHtml = nextContent != null || nextHtml != null; if (lastChildren != null && nextChildren == null) { this.updateChildren(null, transaction); } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { this.updateTextContent(''); } if (nextContent != null) { if (lastContent !== nextContent) { this.updateTextContent('' + nextContent); } } else if (nextHtml != null) { if (lastHtml !== nextHtml) { ReactComponent.DOMIDOperations.updateInnerHTMLByID( this._rootNodeID, nextHtml ); } } else if (nextChildren != null) { this.updateChildren(nextChildren, transaction); } }, /** * Destroys all event registrations for this instance. Does not remove from * the DOM. That must be done by the parent. * * @internal */ unmountComponent: function() { ReactEventEmitter.deleteAllListeners(this._rootNodeID); ReactComponent.Mixin.unmountComponent.call(this); this.unmountChildren(); } }; mixInto(ReactDOMComponent, ReactComponent.Mixin); mixInto(ReactDOMComponent, ReactDOMComponent.Mixin); mixInto(ReactDOMComponent, ReactMultiChild.Mixin); module.exports = ReactDOMComponent; },{"./CSSPropertyOperations":3,"./DOMProperty":8,"./DOMPropertyOperations":9,"./ReactComponent":25,"./ReactEventEmitter":43,"./ReactMount":49,"./ReactMultiChild":51,"./ReactPerf":54,"./escapeTextForBrowser":82,"./invariant":95,"./keyOf":102,"./merge":104,"./mixInto":107}],33:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMForm */ "use strict"; var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); var ReactEventEmitter = require("./ReactEventEmitter"); var EventConstants = require("./EventConstants"); // Store a reference to the <form> `ReactDOMComponent`. var form = ReactDOM.form; /** * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need * to capture it on the <form> element itself. There are lots of hacks we could * do to accomplish this, but the most reliable is to make <form> a * composite component and use `componentDidMount` to attach the event handlers. */ var ReactDOMForm = ReactCompositeComponent.createClass({ render: function() { // TODO: Instead of using `ReactDOM` directly, we should use JSX. However, // `jshint` fails to parse JSX so in order for linting to work in the open // source repo, we need to just use `ReactDOM.form`. return this.transferPropsTo(form(null, this.props.children)); }, componentDidMount: function(node) { ReactEventEmitter.trapBubbledEvent( EventConstants.topLevelTypes.topSubmit, 'submit', node ); } }); module.exports = ReactDOMForm; },{"./EventConstants":14,"./ReactCompositeComponent":28,"./ReactDOM":30,"./ReactEventEmitter":43}],34:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMIDOperations * @typechecks static-only */ /*jslint evil: true */ "use strict"; var CSSPropertyOperations = require("./CSSPropertyOperations"); var DOMChildrenOperations = require("./DOMChildrenOperations"); var DOMPropertyOperations = require("./DOMPropertyOperations"); var ReactMount = require("./ReactMount"); var getTextContentAccessor = require("./getTextContentAccessor"); var invariant = require("./invariant"); /** * Errors for properties that should not be updated with `updatePropertyById()`. * * @type {object} * @private */ var INVALID_PROPERTY_ERRORS = { dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.', style: '`style` must be set using `updateStylesByID()`.' }; /** * The DOM property to use when setting text content. * * @type {string} * @private */ var textContentAccessor = getTextContentAccessor() || 'NA'; var LEADING_SPACE = /^ /; /** * Operations used to process updates to DOM nodes. This is made injectable via * `ReactComponent.DOMIDOperations`. */ var ReactDOMIDOperations = { /** * Updates a DOM node with new property values. This should only be used to * update DOM properties in `DOMProperty`. * * @param {string} id ID of the node to update. * @param {string} name A valid property name, see `DOMProperty`. * @param {*} value New value of the property. * @internal */ updatePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ); // If we're updating to null or undefined, we should remove the property // from the DOM node instead of inadvertantly setting to a string. This // brings us in line with the same behavior we have on initial render. if (value != null) { DOMPropertyOperations.setValueForProperty(node, name, value); } else { DOMPropertyOperations.deleteValueForProperty(node, name); } }, /** * Updates a DOM node to remove a property. This should only be used to remove * DOM properties in `DOMProperty`. * * @param {string} id ID of the node to update. * @param {string} name A property name to remove, see `DOMProperty`. * @internal */ deletePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] ); DOMPropertyOperations.deleteValueForProperty(node, name, value); }, /** * This should almost never be used instead of `updatePropertyByID()` due to * the extra object allocation required by the API. That said, this is useful * for batching up several operations across worker thread boundaries. * * @param {string} id ID of the node to update. * @param {object} properties A mapping of valid property names. * @internal * @see {ReactDOMIDOperations.updatePropertyByID} */ updatePropertiesByID: function(id, properties) { for (var name in properties) { if (!properties.hasOwnProperty(name)) { continue; } ReactDOMIDOperations.updatePropertiesByID(id, name, properties[name]); } }, /** * Updates a DOM node with new style values. If a value is specified as '', * the corresponding style property will be unset. * * @param {string} id ID of the node to update. * @param {object} styles Mapping from styles to values. * @internal */ updateStylesByID: function(id, styles) { var node = ReactMount.getNode(id); CSSPropertyOperations.setValueForStyles(node, styles); }, /** * Updates a DOM node's innerHTML. * * @param {string} id ID of the node to update. * @param {string} html An HTML string. * @internal */ updateInnerHTMLByID: function(id, html) { var node = ReactMount.getNode(id); // HACK: IE8- normalize whitespace in innerHTML, removing leading spaces. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html node.innerHTML = html.replace(LEADING_SPACE, '&nbsp;'); }, /** * Updates a DOM node's text content set by `props.content`. * * @param {string} id ID of the node to update. * @param {string} content Text content. * @internal */ updateTextContentByID: function(id, content) { var node = ReactMount.getNode(id); node[textContentAccessor] = content; }, /** * Replaces a DOM node that exists in the document with markup. * * @param {string} id ID of child to be replaced. * @param {string} markup Dangerous markup to inject in place of child. * @internal * @see {Danger.dangerouslyReplaceNodeWithMarkup} */ dangerouslyReplaceNodeWithMarkupByID: function(id, markup) { var node = ReactMount.getNode(id); DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup); }, /** * Updates a component's children by processing a series of updates. * * @param {array<object>} updates List of update configurations. * @param {array<string>} markup List of markup strings. * @internal */ dangerouslyProcessChildrenUpdates: function(updates, markup) { for (var i = 0; i < updates.length; i++) { updates[i].parentNode = ReactMount.getNode(updates[i].parentID); } DOMChildrenOperations.processUpdates(updates, markup); } }; module.exports = ReactDOMIDOperations; },{"./CSSPropertyOperations":3,"./DOMChildrenOperations":7,"./DOMPropertyOperations":9,"./ReactMount":49,"./getTextContentAccessor":93,"./invariant":95}],35:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMInput */ "use strict"; var DOMPropertyOperations = require("./DOMPropertyOperations"); var LinkedValueMixin = require("./LinkedValueMixin"); var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); var ReactMount = require("./ReactMount"); var invariant = require("./invariant"); var merge = require("./merge"); // Store a reference to the <input> `ReactDOMComponent`. var input = ReactDOM.input; var instancesByReactID = {}; /** * Implements an <input> native component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. * * If `checked` or `value` are not supplied (or null/undefined), user actions * that affect the checked state or value will trigger updates to the element. * * If they are supplied (and not null/undefined), the rendered element will not * trigger updates to the element. Instead, the props must change in order for * the rendered element to be updated. * * The rendered element will be initialized as unchecked (or `defaultChecked`) * with an empty value (or `defaultValue`). * * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html */ var ReactDOMInput = ReactCompositeComponent.createClass({ mixins: [LinkedValueMixin], getInitialState: function() { var defaultValue = this.props.defaultValue; return { checked: this.props.defaultChecked || false, value: defaultValue != null ? defaultValue : '' }; }, shouldComponentUpdate: function() { // Defer any updates to this component during the `onChange` handler. return !this._isChanging; }, render: function() { // Clone `this.props` so we don't mutate the input. var props = merge(this.props); props.defaultChecked = null; props.defaultValue = null; props.checked = this.props.checked != null ? this.props.checked : this.state.checked; var value = this.getValue(); props.value = value != null ? value : this.state.value; props.onChange = this._handleChange; return input(props, this.props.children); }, componentDidMount: function(rootNode) { var id = ReactMount.getID(rootNode); instancesByReactID[id] = this; }, componentWillUnmount: function() { var rootNode = this.getDOMNode(); var id = ReactMount.getID(rootNode); delete instancesByReactID[id]; }, componentDidUpdate: function(prevProps, prevState, rootNode) { if (this.props.checked != null) { DOMPropertyOperations.setValueForProperty( rootNode, 'checked', this.props.checked || false ); } var value = this.getValue(); if (value != null) { // Cast `value` to a string to ensure the value is set correctly. While // browsers typically do this as necessary, jsdom doesn't. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value); } }, _handleChange: function(event) { var returnValue; var onChange = this.getOnChange(); if (onChange) { this._isChanging = true; returnValue = onChange(event); this._isChanging = false; } this.setState({ checked: event.target.checked, value: event.target.value }); var name = this.props.name; if (this.props.type === 'radio' && name != null) { var rootNode = this.getDOMNode(); // If `rootNode.form` was non-null, then we could try `form.elements`, // but that sometimes behaves strangely in IE8. We could also try using // `form.getElementsByName`, but that will only return direct children // and won't include inputs that use the HTML5 `form=` attribute. Since // the input might not even be in a form, let's just use the global // `getElementsByName` to ensure we don't miss anything. var group = document.getElementsByName(name); for (var i = 0, groupLen = group.length; i < groupLen; i++) { var otherNode = group[i]; if (otherNode === rootNode || otherNode.nodeName !== 'INPUT' || otherNode.type !== 'radio' || otherNode.form !== rootNode.form) { continue; } var otherID = ReactMount.getID(otherNode); invariant( otherID, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.' ); var otherInstance = instancesByReactID[otherID]; invariant( otherInstance, 'ReactDOMInput: Unknown radio button ID %s.', otherID ); // In some cases, this will actually change the `checked` state value. // In other cases, there's no change but this forces a reconcile upon // which componentDidUpdate will reset the DOM property to whatever it // should be. otherInstance.setState({ checked: false }); } } return returnValue; } }); module.exports = ReactDOMInput; },{"./DOMPropertyOperations":9,"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./ReactMount":49,"./invariant":95,"./merge":104}],36:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMOption */ "use strict"; var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); // Store a reference to the <option> `ReactDOMComponent`. var option = ReactDOM.option; /** * Implements an <option> native component that warns when `selected` is set. */ var ReactDOMOption = ReactCompositeComponent.createClass({ componentWillMount: function() { // TODO (yungsters): Remove support for `selected` in <option>. if (this.props.selected != null) { if (true) { console.warn( 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.' ); } } }, render: function() { return option(this.props, this.props.children); } }); module.exports = ReactDOMOption; },{"./ReactCompositeComponent":28,"./ReactDOM":30}],37:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMSelect */ "use strict"; var LinkedValueMixin = require("./LinkedValueMixin"); var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); var invariant = require("./invariant"); var merge = require("./merge"); // Store a reference to the <select> `ReactDOMComponent`. var select = ReactDOM.select; /** * Validation function for `value` and `defaultValue`. * @private */ function selectValueType(props, propName, componentName) { if (props[propName] == null) { return; } if (props.multiple) { invariant( Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if `multiple` is ' + 'true.', propName ); } else { invariant( !Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar value if ' + '`multiple` is false.', propName ); } } /** * If `value` is supplied, updates <option> elements on mount and update. * @private */ function updateOptions() { /*jshint validthis:true */ var propValue = this.getValue(); var value = propValue != null ? propValue : this.state.value; var options = this.getDOMNode().options; var selectedValue = '' + value; for (var i = 0, l = options.length; i < l; i++) { var selected = this.props.multiple ? selectedValue.indexOf(options[i].value) >= 0 : selected = options[i].value === selectedValue; if (selected !== options[i].selected) { options[i].selected = selected; } } } /** * Implements a <select> native component that allows optionally setting the * props `value` and `defaultValue`. If `multiple` is false, the prop must be a * string. If `multiple` is true, the prop must be an array of strings. * * If `value` is not supplied (or null/undefined), user actions that change the * selected option will trigger updates to the rendered options. * * If it is supplied (and not null/undefined), the rendered options will not * update in response to user actions. Instead, the `value` prop must change in * order for the rendered options to update. * * If `defaultValue` is provided, any options with the supplied values will be * selected. */ var ReactDOMSelect = ReactCompositeComponent.createClass({ mixins: [LinkedValueMixin], propTypes: { defaultValue: selectValueType, value: selectValueType }, getInitialState: function() { return {value: this.props.defaultValue || (this.props.multiple ? [] : '')}; }, componentWillReceiveProps: function(nextProps) { if (!this.props.multiple && nextProps.multiple) { this.setState({value: [this.state.value]}); } else if (this.props.multiple && !nextProps.multiple) { this.setState({value: this.state.value[0]}); } }, shouldComponentUpdate: function() { // Defer any updates to this component during the `onChange` handler. return !this._isChanging; }, render: function() { // Clone `this.props` so we don't mutate the input. var props = merge(this.props); props.onChange = this._handleChange; props.value = null; return select(props, this.props.children); }, componentDidMount: updateOptions, componentDidUpdate: updateOptions, _handleChange: function(event) { var returnValue; var onChange = this.getOnChange(); if (onChange) { this._isChanging = true; returnValue = onChange(event); this._isChanging = false; } var selectedValue; if (this.props.multiple) { selectedValue = []; var options = event.target.options; for (var i = 0, l = options.length; i < l; i++) { if (options[i].selected) { selectedValue.push(options[i].value); } } } else { selectedValue = event.target.value; } this.setState({value: selectedValue}); return returnValue; } }); module.exports = ReactDOMSelect; },{"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./invariant":95,"./merge":104}],38:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMSelection */ "use strict"; var getNodeForCharacterOffset = require("./getNodeForCharacterOffset"); var getTextContentAccessor = require("./getTextContentAccessor"); /** * Get the appropriate anchor and focus node/offset pairs for IE. * * The catch here is that IE's selection API doesn't provide information * about whether the selection is forward or backward, so we have to * behave as though it's always forward. * * IE text differs from modern selection in that it behaves as though * block elements end with a new line. This means character offsets will * differ between the two APIs. * * @param {DOMElement} node * @return {object} */ function getIEOffsets(node) { var selection = document.selection; var selectedRange = selection.createRange(); var selectedLength = selectedRange.text.length; // Duplicate selection so we can move range without breaking user selection. var fromStart = selectedRange.duplicate(); fromStart.moveToElementText(node); fromStart.setEndPoint('EndToStart', selectedRange); var startOffset = fromStart.text.length; var endOffset = startOffset + selectedLength; return { start: startOffset, end: endOffset }; } /** * @param {DOMElement} node * @return {?object} */ function getModernOffsets(node) { var selection = window.getSelection(); if (selection.rangeCount === 0) { return null; } var anchorNode = selection.anchorNode; var anchorOffset = selection.anchorOffset; var focusNode = selection.focusNode; var focusOffset = selection.focusOffset; var currentRange = selection.getRangeAt(0); var rangeLength = currentRange.toString().length; var tempRange = currentRange.cloneRange(); tempRange.selectNodeContents(node); tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); var start = tempRange.toString().length; var end = start + rangeLength; // Detect whether the selection is backward. var detectionRange = document.createRange(); detectionRange.setStart(anchorNode, anchorOffset); detectionRange.setEnd(focusNode, focusOffset); var isBackward = detectionRange.collapsed; detectionRange.detach(); return { start: isBackward ? end : start, end: isBackward ? start : end }; } /** * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setIEOffsets(node, offsets) { var range = document.selection.createRange().duplicate(); var start, end; if (typeof offsets.end === 'undefined') { start = offsets.start; end = start; } else if (offsets.start > offsets.end) { start = offsets.end; end = offsets.start; } else { start = offsets.start; end = offsets.end; } range.moveToElementText(node); range.moveStart('character', start); range.setEndPoint('EndToStart', range); range.moveEnd('character', end - start); range.select(); } /** * In modern non-IE browsers, we can support both forward and backward * selections. * * Note: IE10+ supports the Selection object, but it does not support * the `extend` method, which means that even in modern IE, it's not possible * to programatically create a backward selection. Thus, for all IE * versions, we use the old IE API to create our selections. * * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setModernOffsets(node, offsets) { var selection = window.getSelection(); var length = node[getTextContentAccessor()].length; var start = Math.min(offsets.start, length); var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); var startMarker = getNodeForCharacterOffset(node, start); var endMarker = getNodeForCharacterOffset(node, end); if (startMarker && endMarker) { var range = document.createRange(); range.setStart(startMarker.node, startMarker.offset); selection.removeAllRanges(); selection.addRange(range); selection.extend(endMarker.node, endMarker.offset); range.detach(); } } var ReactDOMSelection = { /** * @param {DOMElement} node */ getOffsets: function(node) { var getOffsets = document.selection ? getIEOffsets : getModernOffsets; return getOffsets(node); }, /** * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ setOffsets: function(node, offsets) { var setOffsets = document.selection ? setIEOffsets : setModernOffsets; setOffsets(node, offsets); } }; module.exports = ReactDOMSelection; },{"./getNodeForCharacterOffset":91,"./getTextContentAccessor":93}],39:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDOMTextarea */ "use strict"; var DOMPropertyOperations = require("./DOMPropertyOperations"); var LinkedValueMixin = require("./LinkedValueMixin"); var ReactCompositeComponent = require("./ReactCompositeComponent"); var ReactDOM = require("./ReactDOM"); var invariant = require("./invariant"); var merge = require("./merge"); // Store a reference to the <textarea> `ReactDOMComponent`. var textarea = ReactDOM.textarea; /** * Implements a <textarea> native component that allows setting `value`, and * `defaultValue`. This differs from the traditional DOM API because value is * usually set as PCDATA children. * * If `value` is not supplied (or null/undefined), user actions that affect the * value will trigger updates to the element. * * If `value` is supplied (and not null/undefined), the rendered element will * not trigger updates to the element. Instead, the `value` prop must change in * order for the rendered element to be updated. * * The rendered element will be initialized with an empty value, the prop * `defaultValue` if specified, or the children content (deprecated). */ var ReactDOMTextarea = ReactCompositeComponent.createClass({ mixins: [LinkedValueMixin], getInitialState: function() { var defaultValue = this.props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>. var children = this.props.children; if (children != null) { if (true) { console.warn( 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.' ); } invariant( defaultValue == null, 'If you supply `defaultValue` on a <textarea>, do not pass children.' ); if (Array.isArray(children)) { invariant( children.length <= 1, '<textarea> can only have at most one child.' ); children = children[0]; } defaultValue = '' + children; } if (defaultValue == null) { defaultValue = ''; } var value = this.getValue(); return { // We save the initial value so that `ReactDOMComponent` doesn't update // `textContent` (unnecessary since we update value). // The initial value can be a boolean or object so that's why it's // forced to be a string. initialValue: '' + (value != null ? value : defaultValue), value: defaultValue }; }, shouldComponentUpdate: function() { // Defer any updates to this component during the `onChange` handler. return !this._isChanging; }, render: function() { // Clone `this.props` so we don't mutate the input. var props = merge(this.props); var value = this.getValue(); invariant( props.dangerouslySetInnerHTML == null, '`dangerouslySetInnerHTML` does not make sense on <textarea>.' ); props.defaultValue = null; props.value = value != null ? value : this.state.value; props.onChange = this._handleChange; // Always set children to the same thing. In IE9, the selection range will // get reset if `textContent` is mutated. return textarea(props, this.state.initialValue); }, componentDidUpdate: function(prevProps, prevState, rootNode) { var value = this.getValue(); if (value != null) { // Cast `value` to a string to ensure the value is set correctly. While // browsers typically do this as necessary, jsdom doesn't. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value); } }, _handleChange: function(event) { var returnValue; var onChange = this.getOnChange(); if (onChange) { this._isChanging = true; returnValue = onChange(event); this._isChanging = false; } this.setState({value: event.target.value}); return returnValue; } }); module.exports = ReactDOMTextarea; },{"./DOMPropertyOperations":9,"./LinkedValueMixin":21,"./ReactCompositeComponent":28,"./ReactDOM":30,"./invariant":95,"./merge":104}],40:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDefaultBatchingStrategy */ "use strict"; var ReactUpdates = require("./ReactUpdates"); var Transaction = require("./Transaction"); var emptyFunction = require("./emptyFunction"); var mixInto = require("./mixInto"); var RESET_BATCHED_UPDATES = { initialize: emptyFunction, close: function() { ReactDefaultBatchingStrategy.isBatchingUpdates = false; } }; var FLUSH_BATCHED_UPDATES = { initialize: emptyFunction, close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) }; var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; function ReactDefaultBatchingStrategyTransaction() { this.reinitializeTransaction(); } mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin); mixInto(ReactDefaultBatchingStrategyTransaction, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; } }); var transaction = new ReactDefaultBatchingStrategyTransaction(); var ReactDefaultBatchingStrategy = { isBatchingUpdates: false, /** * Call the provided function in a context within which calls to `setState` * and friends are batched such that components aren't updated unnecessarily. */ batchedUpdates: function(callback, param) { var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; ReactDefaultBatchingStrategy.isBatchingUpdates = true; // The code is written this way to avoid extra allocations if (alreadyBatchingUpdates) { callback(param); } else { transaction.perform(callback, null, param); } } }; module.exports = ReactDefaultBatchingStrategy; },{"./ReactUpdates":60,"./Transaction":72,"./emptyFunction":81,"./mixInto":107}],41:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDefaultInjection */ "use strict"; var ReactDOM = require("./ReactDOM"); var ReactDOMButton = require("./ReactDOMButton"); var ReactDOMForm = require("./ReactDOMForm"); var ReactDOMInput = require("./ReactDOMInput"); var ReactDOMOption = require("./ReactDOMOption"); var ReactDOMSelect = require("./ReactDOMSelect"); var ReactDOMTextarea = require("./ReactDOMTextarea"); var ReactEventEmitter = require("./ReactEventEmitter"); var ReactEventTopLevelCallback = require("./ReactEventTopLevelCallback"); var ReactPerf = require("./ReactPerf"); var DefaultDOMPropertyConfig = require("./DefaultDOMPropertyConfig"); var DOMProperty = require("./DOMProperty"); var ChangeEventPlugin = require("./ChangeEventPlugin"); var CompositionEventPlugin = require("./CompositionEventPlugin"); var DefaultEventPluginOrder = require("./DefaultEventPluginOrder"); var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin"); var EventPluginHub = require("./EventPluginHub"); var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin"); var ReactInstanceHandles = require("./ReactInstanceHandles"); var SelectEventPlugin = require("./SelectEventPlugin"); var SimpleEventPlugin = require("./SimpleEventPlugin"); var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy"); var ReactUpdates = require("./ReactUpdates"); function inject() { ReactEventEmitter.TopLevelCallbackCreator = ReactEventTopLevelCallback; /** * Inject module for resolving DOM hierarchy and plugin ordering. */ EventPluginHub.injection.injectEventPluginOrder(DefaultEventPluginOrder); EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles); /** * Some important event plugins included by default (without having to require * them). */ EventPluginHub.injection.injectEventPluginsByName({ SimpleEventPlugin: SimpleEventPlugin, EnterLeaveEventPlugin: EnterLeaveEventPlugin, ChangeEventPlugin: ChangeEventPlugin, CompositionEventPlugin: CompositionEventPlugin, MobileSafariClickEventPlugin: MobileSafariClickEventPlugin, SelectEventPlugin: SelectEventPlugin }); ReactDOM.injection.injectComponentClasses({ button: ReactDOMButton, form: ReactDOMForm, input: ReactDOMInput, option: ReactDOMOption, select: ReactDOMSelect, textarea: ReactDOMTextarea }); DOMProperty.injection.injectDOMPropertyConfig(DefaultDOMPropertyConfig); if (true) { ReactPerf.injection.injectMeasure(require("./ReactDefaultPerf").measure); } ReactUpdates.injection.injectBatchingStrategy( ReactDefaultBatchingStrategy ); } module.exports = { inject: inject }; },{"./ChangeEventPlugin":5,"./CompositionEventPlugin":6,"./DOMProperty":8,"./DefaultDOMPropertyConfig":11,"./DefaultEventPluginOrder":12,"./EnterLeaveEventPlugin":13,"./EventPluginHub":16,"./MobileSafariClickEventPlugin":22,"./ReactDOM":30,"./ReactDOMButton":31,"./ReactDOMForm":33,"./ReactDOMInput":35,"./ReactDOMOption":36,"./ReactDOMSelect":37,"./ReactDOMTextarea":39,"./ReactDefaultBatchingStrategy":40,"./ReactDefaultPerf":42,"./ReactEventEmitter":43,"./ReactEventTopLevelCallback":45,"./ReactInstanceHandles":47,"./ReactPerf":54,"./ReactUpdates":60,"./SelectEventPlugin":61,"./SimpleEventPlugin":62}],42:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactDefaultPerf * @typechecks static-only */ "use strict"; var performanceNow = require("./performanceNow"); var ReactDefaultPerf = {}; if (true) { ReactDefaultPerf = { /** * Gets the stored information for a given object's function. * * @param {string} objName * @param {string} fnName * @return {?object} */ getInfo: function(objName, fnName) { if (!this.info[objName] || !this.info[objName][fnName]) { return null; } return this.info[objName][fnName]; }, /** * Gets the logs pertaining to a given object's function. * * @param {string} objName * @param {string} fnName * @return {?array<object>} */ getLogs: function(objName, fnName) { if (!this.getInfo(objName, fnName)) { return null; } return this.logs.filter(function(log) { return log.objName === objName && log.fnName === fnName; }); }, /** * Runs through the logs and builds an array of arrays, where each array * walks through the mounting/updating of each component underneath. * * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' * @return {array<array>} */ getRawRenderHistory: function(rootID) { var history = []; /** * Since logs are added after the method returns, the logs are in a sense * upside-down: the inner-most elements from mounting/updating are logged * first, and the last addition to the log is the top renderComponent. * Therefore, we flip the logs upside down for ease of processing, and * reverse the history array at the end so the earliest event has index 0. */ var logs = this.logs.filter(function(log) { return log.reactID.indexOf(rootID) === 0; }).reverse(); var subHistory = []; logs.forEach(function(log, i) { if (i && log.reactID === rootID && logs[i - 1].reactID !== rootID) { subHistory.length && history.push(subHistory); subHistory = []; } subHistory.push(log); }); if (subHistory.length) { history.push(subHistory); } return history.reverse(); }, /** * Runs through the logs and builds an array of strings, where each string * is a multiline formatted way of walking through the mounting/updating * underneath. * * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' * @return {array<string>} */ getRenderHistory: function(rootID) { var history = this.getRawRenderHistory(rootID); return history.map(function(subHistory) { var headerString = ( 'log# Component (execution time) [bloat from logging]\n' + '================================================================\n' ); return headerString + subHistory.map(function(log) { // Add two spaces for every layer in the reactID. var indents = '\t' + Array(log.reactID.split('.[').length).join(' '); var delta = _microTime(log.timing.delta); var bloat = _microTime(log.timing.timeToLog); return log.index + indents + log.name + ' (' + delta + 'ms)' + ' [' + bloat + 'ms]'; }).join('\n'); }); }, /** * Print the render history from `getRenderHistory` using console.log. * This is currently the best way to display perf data from * any React component; working on that. * * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' * @param {number} index */ printRenderHistory: function(rootID, index) { var history = this.getRenderHistory(rootID); if (!history[index]) { console.warn( 'Index', index, 'isn\'t available! ' + 'The render history is', history.length, 'long.' ); return; } console.log( 'Loading render history #' + (index + 1) + ' of ' + history.length + ':\n' + history[index] ); }, /** * Prints the heatmap legend to console, showing how the colors correspond * with render times. This relies on console.log styles. */ printHeatmapLegend: function() { if (!this.options.heatmap.enabled) { return; } var max = this.info.React && this.info.React.renderComponent && this.info.React.renderComponent.max; if (max) { var logStr = 'Heatmap: '; for (var ii = 0; ii <= 10 * max; ii += max) { logStr += '%c ' + (Math.round(ii) / 10) + 'ms '; } console.log( logStr, 'background-color: hsla(100, 100%, 50%, 0.6);', 'background-color: hsla( 90, 100%, 50%, 0.6);', 'background-color: hsla( 80, 100%, 50%, 0.6);', 'background-color: hsla( 70, 100%, 50%, 0.6);', 'background-color: hsla( 60, 100%, 50%, 0.6);', 'background-color: hsla( 50, 100%, 50%, 0.6);', 'background-color: hsla( 40, 100%, 50%, 0.6);', 'background-color: hsla( 30, 100%, 50%, 0.6);', 'background-color: hsla( 20, 100%, 50%, 0.6);', 'background-color: hsla( 10, 100%, 50%, 0.6);', 'background-color: hsla( 0, 100%, 50%, 0.6);' ); } }, /** * Measure a given function with logging information, and calls a callback * if there is one. * * @param {string} objName * @param {string} fnName * @param {function} func * @return {function} */ measure: function(objName, fnName, func) { var info = _getNewInfo(objName, fnName); var fnArgs = _getFnArguments(func); return function() { var timeBeforeFn = performanceNow(); var fnReturn = func.apply(this, arguments); var timeAfterFn = performanceNow(); /** * Hold onto arguments in a readable way: args[1] -> args.component. * args is also passed to the callback, so if you want to save an * argument in the log, do so in the callback. */ var args = {}; for (var i = 0; i < arguments.length; i++) { args[fnArgs[i]] = arguments[i]; } var log = { index: ReactDefaultPerf.logs.length, fnName: fnName, objName: objName, timing: { before: timeBeforeFn, after: timeAfterFn, delta: timeAfterFn - timeBeforeFn } }; ReactDefaultPerf.logs.push(log); /** * The callback gets: * - this (the component) * - the original method's arguments * - what the method returned * - the log object, and * - the wrapped method's info object. */ var callback = _getCallback(objName, fnName); callback && callback(this, args, fnReturn, log, info); log.timing.timeToLog = performanceNow() - timeAfterFn; return fnReturn; }; }, /** * Holds information on wrapped objects/methods. * For instance, ReactDefaultPerf.info.React.renderComponent */ info: {}, /** * Holds all of the logs. Filter this to pull desired information. */ logs: [], /** * Toggle settings for ReactDefaultPerf */ options: { /** * The heatmap sets the background color of the React containers * according to how much total time has been spent rendering them. * The most temporally expensive component is set as pure red, * and the others are colored from green to red as a fraction * of that max component time. */ heatmap: { enabled: true } } }; /** * Gets a info area for a given object's function, adding a new one if * necessary. * * @param {string} objName * @param {string} fnName * @return {object} */ var _getNewInfo = function(objName, fnName) { var info = ReactDefaultPerf.getInfo(objName, fnName); if (info) { return info; } ReactDefaultPerf.info[objName] = ReactDefaultPerf.info[objName] || {}; return ReactDefaultPerf.info[objName][fnName] = { getLogs: function() { return ReactDefaultPerf.getLogs(objName, fnName); } }; }; /** * Gets a list of the argument names from a function's definition. * This is useful for storing arguments by their names within wrapFn(). * * @param {function} fn * @return {array<string>} */ var _getFnArguments = function(fn) { var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); fnStr = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')); return fnStr.match(/([^\s,]+)/g); }; /** * Store common callbacks within ReactDefaultPerf. * * @param {string} objName * @param {string} fnName * @return {?function} */ var _getCallback = function(objName, fnName) { switch (objName + '.' + fnName) { case 'React.renderComponent': return _renderComponentCallback; case 'ReactDOMComponent.mountComponent': case 'ReactDOMComponent.updateComponent': return _nativeComponentCallback; case 'ReactCompositeComponent.mountComponent': case 'ReactCompositeComponent.updateComponent': return _compositeComponentCallback; default: return null; } }; /** * Callback function for React.renderComponent * * @param {object} component * @param {object} args * @param {?object} fnReturn * @param {object} log * @param {object} info */ var _renderComponentCallback = function(component, args, fnReturn, log, info) { log.name = args.nextComponent.constructor.displayName || '[unknown]'; log.reactID = fnReturn._rootNodeID || null; if (ReactDefaultPerf.options.heatmap.enabled) { var container = args.container; if (!container.loggedByReactDefaultPerf) { container.loggedByReactDefaultPerf = true; info.components = info.components || []; info.components.push(container); } container.count = container.count || 0; container.count += log.timing.delta; info.max = info.max || 0; if (container.count > info.max) { info.max = container.count; info.components.forEach(function(component) { _setHue(component, 100 - 100 * component.count / info.max); }); } else { _setHue(container, 100 - 100 * container.count / info.max); } } }; /** * Callback function for ReactDOMComponent * * @param {object} component * @param {object} args * @param {?object} fnReturn * @param {object} log * @param {object} info */ var _nativeComponentCallback = function(component, args, fnReturn, log, info) { log.name = component.tagName || '[unknown]'; log.reactID = component._rootNodeID; }; /** * Callback function for ReactCompositeComponent * * @param {object} component * @param {object} args * @param {?object} fnReturn * @param {object} log * @param {object} info */ var _compositeComponentCallback = function(component, args, fnReturn, log, info) { log.name = component.constructor.displayName || '[unknown]'; log.reactID = component._rootNodeID; }; /** * Using the hsl() background-color attribute, colors an element. * * @param {DOMElement} el * @param {number} hue [0 for red, 120 for green, 240 for blue] */ var _setHue = function(el, hue) { el.style.backgroundColor = 'hsla(' + hue + ', 100%, 50%, 0.6)'; }; /** * Round to the thousandth place. * @param {number} time * @return {number} */ var _microTime = function(time) { return Math.round(time * 1000) / 1000; }; } module.exports = ReactDefaultPerf; },{"./performanceNow":112}],43:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactEventEmitter * @typechecks static-only */ "use strict"; var EventConstants = require("./EventConstants"); var EventListener = require("./EventListener"); var EventPluginHub = require("./EventPluginHub"); var ExecutionEnvironment = require("./ExecutionEnvironment"); var ReactEventEmitterMixin = require("./ReactEventEmitterMixin"); var ViewportMetrics = require("./ViewportMetrics"); var invariant = require("./invariant"); var isEventSupported = require("./isEventSupported"); var merge = require("./merge"); /** * Summary of `ReactEventEmitter` event handling: * * - Top-level delegation is used to trap native browser events. We normalize * and de-duplicate events to account for browser quirks. * * - Forward these native events (with the associated top-level type used to * trap it) to `EventPluginHub`, which in turn will ask plugins if they want * to extract any synthetic events. * * - The `EventPluginHub` will then process each event by annotating them with * "dispatches", a sequence of listeners and IDs that care about that event. * * - The `EventPluginHub` then dispatches the events. * * Overview of React and the event system: * * . * +------------+ . * | DOM | . * +------------+ . +-----------+ * + . +--------+|SimpleEvent| * | . | |Plugin | * +-----|------+ . v +-----------+ * | | | . +--------------+ +------------+ * | +-----------.--->|EventPluginHub| | Event | * | | . | | +-----------+ | Propagators| * | ReactEvent | . | | |TapEvent | |------------| * | Emitter | . | |<---+|Plugin | |other plugin| * | | . | | +-----------+ | utilities | * | +-----------.---------+ | +------------+ * | | | . +----|---------+ * +-----|------+ . | ^ +-----------+ * | . | | |Enter/Leave| * + . | +-------+|Plugin | * +-------------+ . v +-----------+ * | application | . +----------+ * |-------------| . | callback | * | | . | registry | * | | . +----------+ * +-------------+ . * . * React Core . General Purpose Event Plugin System */ /** * Traps top-level events by using event bubbling. * * @param {string} topLevelType Record from `EventConstants`. * @param {string} handlerBaseName Event name (e.g. "click"). * @param {DOMEventTarget} element Element on which to attach listener. * @internal */ function trapBubbledEvent(topLevelType, handlerBaseName, element) { EventListener.listen( element, handlerBaseName, ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback( topLevelType ) ); } /** * Traps a top-level event by using event capturing. * * @param {string} topLevelType Record from `EventConstants`. * @param {string} handlerBaseName Event name (e.g. "click"). * @param {DOMEventTarget} element Element on which to attach listener. * @internal */ function trapCapturedEvent(topLevelType, handlerBaseName, element) { EventListener.capture( element, handlerBaseName, ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback( topLevelType ) ); } /** * Listens to window scroll and resize events. We cache scroll values so that * application code can access them without triggering reflows. * * NOTE: Scroll events do not bubble. * * @private * @see http://www.quirksmode.org/dom/events/scroll.html */ function registerScrollValueMonitoring() { var refresh = ViewportMetrics.refreshScrollValues; EventListener.listen(window, 'scroll', refresh); EventListener.listen(window, 'resize', refresh); } /** * `ReactEventEmitter` is used to attach top-level event listeners. For example: * * ReactEventEmitter.putListener('myID', 'onClick', myFunction); * * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. * * @internal */ var ReactEventEmitter = merge(ReactEventEmitterMixin, { /** * React references `ReactEventTopLevelCallback` using this property in order * to allow dependency injection. */ TopLevelCallbackCreator: null, /** * Ensures that top-level event delegation listeners are installed. * * There are issues with listening to both touch events and mouse events on * the top-level, so we make the caller choose which one to listen to. (If * there's a touch top-level listeners, anchors don't receive clicks for some * reason, and only in some cases). * * @param {boolean} touchNotMouse Listen to touch events instead of mouse. * @param {DOMDocument} contentDocument DOM document to listen on */ ensureListening: function(touchNotMouse, contentDocument) { invariant( ExecutionEnvironment.canUseDOM, 'ensureListening(...): Cannot toggle event listening in a Worker ' + 'thread. This is likely a bug in the framework. Please report ' + 'immediately.' ); invariant( ReactEventEmitter.TopLevelCallbackCreator, 'ensureListening(...): Cannot be called without a top level callback ' + 'creator being injected.' ); // Call out to base implementation. ReactEventEmitterMixin.ensureListening.call( ReactEventEmitter, { touchNotMouse: touchNotMouse, contentDocument: contentDocument } ); }, /** * Sets whether or not any created callbacks should be enabled. * * @param {boolean} enabled True if callbacks should be enabled. */ setEnabled: function(enabled) { invariant( ExecutionEnvironment.canUseDOM, 'setEnabled(...): Cannot toggle event listening in a Worker thread. ' + 'This is likely a bug in the framework. Please report immediately.' ); if (ReactEventEmitter.TopLevelCallbackCreator) { ReactEventEmitter.TopLevelCallbackCreator.setEnabled(enabled); } }, /** * @return {boolean} True if callbacks are enabled. */ isEnabled: function() { return !!( ReactEventEmitter.TopLevelCallbackCreator && ReactEventEmitter.TopLevelCallbackCreator.isEnabled() ); }, /** * We listen for bubbled touch events on the document object. * * Firefox v8.01 (and possibly others) exhibited strange behavior when * mounting `onmousemove` events at some node that was not the document * element. The symptoms were that if your mouse is not moving over something * contained within that mount point (for example on the background) the * top-level listeners for `onmousemove` won't be called. However, if you * register the `mousemove` on the document object, then it will of course * catch all `mousemove`s. This along with iOS quirks, justifies restricting * top-level listeners to the document object only, at least for these * movement types of events and possibly all events. * * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html * * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but * they bubble to document. * * @param {boolean} touchNotMouse Listen to touch events instead of mouse. * @param {DOMDocument} contentDocument Document which owns the container * @private * @see http://www.quirksmode.org/dom/events/keys.html. */ listenAtTopLevel: function(touchNotMouse, contentDocument) { invariant( !contentDocument._isListening, 'listenAtTopLevel(...): Cannot setup top-level listener more than once.' ); var topLevelTypes = EventConstants.topLevelTypes; var mountAt = contentDocument; registerScrollValueMonitoring(); trapBubbledEvent(topLevelTypes.topMouseOver, 'mouseover', mountAt); trapBubbledEvent(topLevelTypes.topMouseDown, 'mousedown', mountAt); trapBubbledEvent(topLevelTypes.topMouseUp, 'mouseup', mountAt); trapBubbledEvent(topLevelTypes.topMouseMove, 'mousemove', mountAt); trapBubbledEvent(topLevelTypes.topMouseOut, 'mouseout', mountAt); trapBubbledEvent(topLevelTypes.topClick, 'click', mountAt); trapBubbledEvent(topLevelTypes.topDoubleClick, 'dblclick', mountAt); if (touchNotMouse) { trapBubbledEvent(topLevelTypes.topTouchStart, 'touchstart', mountAt); trapBubbledEvent(topLevelTypes.topTouchEnd, 'touchend', mountAt); trapBubbledEvent(topLevelTypes.topTouchMove, 'touchmove', mountAt); trapBubbledEvent(topLevelTypes.topTouchCancel, 'touchcancel', mountAt); } trapBubbledEvent(topLevelTypes.topKeyUp, 'keyup', mountAt); trapBubbledEvent(topLevelTypes.topKeyPress, 'keypress', mountAt); trapBubbledEvent(topLevelTypes.topKeyDown, 'keydown', mountAt); trapBubbledEvent(topLevelTypes.topInput, 'input', mountAt); trapBubbledEvent(topLevelTypes.topChange, 'change', mountAt); trapBubbledEvent( topLevelTypes.topSelectionChange, 'selectionchange', mountAt ); trapBubbledEvent( topLevelTypes.topCompositionEnd, 'compositionend', mountAt ); trapBubbledEvent( topLevelTypes.topCompositionStart, 'compositionstart', mountAt ); trapBubbledEvent( topLevelTypes.topCompositionUpdate, 'compositionupdate', mountAt ); if (isEventSupported('drag')) { trapBubbledEvent(topLevelTypes.topDrag, 'drag', mountAt); trapBubbledEvent(topLevelTypes.topDragEnd, 'dragend', mountAt); trapBubbledEvent(topLevelTypes.topDragEnter, 'dragenter', mountAt); trapBubbledEvent(topLevelTypes.topDragExit, 'dragexit', mountAt); trapBubbledEvent(topLevelTypes.topDragLeave, 'dragleave', mountAt); trapBubbledEvent(topLevelTypes.topDragOver, 'dragover', mountAt); trapBubbledEvent(topLevelTypes.topDragStart, 'dragstart', mountAt); trapBubbledEvent(topLevelTypes.topDrop, 'drop', mountAt); } if (isEventSupported('wheel')) { trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt); } else if (isEventSupported('mousewheel')) { trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt); } else { // Firefox needs to capture a different mouse scroll event. // @see http://www.quirksmode.org/dom/events/tests/scroll.html trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt); } // IE<9 does not support capturing so just trap the bubbled event there. if (isEventSupported('scroll', true)) { trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt); } else { trapBubbledEvent(topLevelTypes.topScroll, 'scroll', window); } if (isEventSupported('focus', true)) { trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt); trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt); } else if (isEventSupported('focusin')) { // IE has `focusin` and `focusout` events which bubble. // @see // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt); trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt); } if (isEventSupported('copy')) { trapBubbledEvent(topLevelTypes.topCopy, 'copy', mountAt); trapBubbledEvent(topLevelTypes.topCut, 'cut', mountAt); trapBubbledEvent(topLevelTypes.topPaste, 'paste', mountAt); } }, registrationNames: EventPluginHub.registrationNames, putListener: EventPluginHub.putListener, getListener: EventPluginHub.getListener, deleteListener: EventPluginHub.deleteListener, deleteAllListeners: EventPluginHub.deleteAllListeners, trapBubbledEvent: trapBubbledEvent, trapCapturedEvent: trapCapturedEvent }); module.exports = ReactEventEmitter; },{"./EventConstants":14,"./EventListener":15,"./EventPluginHub":16,"./ExecutionEnvironment":20,"./ReactEventEmitterMixin":44,"./ViewportMetrics":73,"./invariant":95,"./isEventSupported":96,"./merge":104}],44:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactEventEmitterMixin */ "use strict"; var EventPluginHub = require("./EventPluginHub"); var ReactUpdates = require("./ReactUpdates"); function runEventQueueInBatch(events) { EventPluginHub.enqueueEvents(events); EventPluginHub.processEventQueue(); } var ReactEventEmitterMixin = { /** * Whether or not `ensureListening` has been invoked. * @type {boolean} * @private */ _isListening: false, /** * Function, must be implemented. Listens to events on the top level of the * application. * * @abstract * * listenAtTopLevel: null, */ /** * Ensures that top-level event delegation listeners are installed. * * There are issues with listening to both touch events and mouse events on * the top-level, so we make the caller choose which one to listen to. (If * there's a touch top-level listeners, anchors don't receive clicks for some * reason, and only in some cases). * * @param {*} config Configuration passed through to `listenAtTopLevel`. */ ensureListening: function(config) { if (!config.contentDocument._reactIsListening) { this.listenAtTopLevel(config.touchNotMouse, config.contentDocument); config.contentDocument._reactIsListening = true; } }, /** * Streams a fired top-level event to `EventPluginHub` where plugins have the * opportunity to create `ReactEvent`s to be dispatched. * * @param {string} topLevelType Record from `EventConstants`. * @param {object} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native environment event. */ handleTopLevel: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var events = EventPluginHub.extractEvents( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ); // Event queue being processed in the same cycle allows `preventDefault`. ReactUpdates.batchedUpdates(runEventQueueInBatch, events); } }; module.exports = ReactEventEmitterMixin; },{"./EventPluginHub":16,"./ReactUpdates":60}],45:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactEventTopLevelCallback * @typechecks static-only */ "use strict"; var ReactEventEmitter = require("./ReactEventEmitter"); var ReactMount = require("./ReactMount"); var getEventTarget = require("./getEventTarget"); /** * @type {boolean} * @private */ var _topLevelListenersEnabled = true; /** * Top-level callback creator used to implement event handling using delegation. * This is used via dependency injection. */ var ReactEventTopLevelCallback = { /** * Sets whether or not any created callbacks should be enabled. * * @param {boolean} enabled True if callbacks should be enabled. */ setEnabled: function(enabled) { _topLevelListenersEnabled = !!enabled; }, /** * @return {boolean} True if callbacks are enabled. */ isEnabled: function() { return _topLevelListenersEnabled; }, /** * Creates a callback for the supplied `topLevelType` that could be added as * a listener to the document. The callback computes a `topLevelTarget` which * should be the root node of a mounted React component where the listener * is attached. * * @param {string} topLevelType Record from `EventConstants`. * @return {function} Callback for handling top-level events. */ createTopLevelCallback: function(topLevelType) { return function(nativeEvent) { if (!_topLevelListenersEnabled) { return; } // TODO: Remove when synthetic events are ready, this is for IE<9. if (nativeEvent.srcElement && nativeEvent.srcElement !== nativeEvent.target) { nativeEvent.target = nativeEvent.srcElement; } var topLevelTarget = ReactMount.getFirstReactDOM( getEventTarget(nativeEvent) ) || window; var topLevelTargetID = ReactMount.getID(topLevelTarget) || ''; ReactEventEmitter.handleTopLevel( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent ); }; } }; module.exports = ReactEventTopLevelCallback; },{"./ReactEventEmitter":43,"./ReactMount":49,"./getEventTarget":89}],46:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactInputSelection */ "use strict"; var ReactDOMSelection = require("./ReactDOMSelection"); var getActiveElement = require("./getActiveElement"); var nodeContains = require("./nodeContains"); function isInDocument(node) { return nodeContains(document.documentElement, node); } /** * @ReactInputSelection: React input selection module. Based on Selection.js, * but modified to be suitable for react and has a couple of bug fixes (doesn't * assume buttons have range selections allowed). * Input selection module for React. */ var ReactInputSelection = { hasSelectionCapabilities: function(elem) { return elem && ( (elem.nodeName === 'INPUT' && elem.type === 'text') || elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true' ); }, getSelectionInformation: function() { var focusedElem = getActiveElement(); return { focusedElem: focusedElem, selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null }; }, /** * @restoreSelection: If any selection information was potentially lost, * restore it. This is useful when performing operations that could remove dom * nodes and place them back in, resulting in focus being lost. */ restoreSelection: function(priorSelectionInformation) { var curFocusedElem = getActiveElement(); var priorFocusedElem = priorSelectionInformation.focusedElem; var priorSelectionRange = priorSelectionInformation.selectionRange; if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { ReactInputSelection.setSelection( priorFocusedElem, priorSelectionRange ); } priorFocusedElem.focus(); } }, /** * @getSelection: Gets the selection bounds of a focused textarea, input or * contentEditable node. * -@input: Look up selection bounds of this input * -@return {start: selectionStart, end: selectionEnd} */ getSelection: function(input) { var selection; if ('selectionStart' in input) { // Modern browser with input or textarea. selection = { start: input.selectionStart, end: input.selectionEnd }; } else if (document.selection && input.nodeName === 'INPUT') { // IE8 input. var range = document.selection.createRange(); // There can only be one selection per document in IE, so it must // be in our element. if (range.parentElement() === input) { selection = { start: -range.moveStart('character', -input.value.length), end: -range.moveEnd('character', -input.value.length) }; } } else { // Content editable or old IE textarea. selection = ReactDOMSelection.getOffsets(input); } return selection || {start: 0, end: 0}; }, /** * @setSelection: Sets the selection bounds of a textarea or input and focuses * the input. * -@input Set selection bounds of this input or textarea * -@offsets Object of same form that is returned from get* */ setSelection: function(input, offsets) { var start = offsets.start; var end = offsets.end; if (typeof end === 'undefined') { end = start; } if ('selectionStart' in input) { input.selectionStart = start; input.selectionEnd = Math.min(end, input.value.length); } else if (document.selection && input.nodeName === 'INPUT') { var range = input.createTextRange(); range.collapse(true); range.moveStart('character', start); range.moveEnd('character', end - start); range.select(); } else { ReactDOMSelection.setOffsets(input, offsets); } } }; module.exports = ReactInputSelection; },{"./ReactDOMSelection":38,"./getActiveElement":88,"./nodeContains":109}],47:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactInstanceHandles * @typechecks static-only */ "use strict"; var invariant = require("./invariant"); var SEPARATOR = '.'; var SEPARATOR_LENGTH = SEPARATOR.length; /** * Maximum depth of traversals before we consider the possibility of a bad ID. */ var MAX_TREE_DEPTH = 100; /** * Size of the reactRoot ID space. We generate random numbers for React root * IDs and if there's a collision the events and DOM update system will * get confused. If we assume 100 React components per page, and a user * loads 1 page per minute 24/7 for 50 years, with a mount point space of * 9,999,999 the likelihood of never having a collision is 99.997%. */ var GLOBAL_MOUNT_POINT_MAX = 9999999; /** * Creates a DOM ID prefix to use when mounting React components. * * @param {number} index A unique integer * @return {string} React root ID. * @internal */ function getReactRootIDString(index) { return SEPARATOR + 'r[' + index.toString(36) + ']'; } /** * Checks if a character in the supplied ID is a separator or the end. * * @param {string} id A React DOM ID. * @param {number} index Index of the character to check. * @return {boolean} True if the character is a separator or end of the ID. * @private */ function isBoundary(id, index) { return id.charAt(index) === SEPARATOR || index === id.length; } /** * Checks if the supplied string is a valid React DOM ID. * * @param {string} id A React DOM ID, maybe. * @return {boolean} True if the string is a valid React DOM ID. * @private */ function isValidID(id) { return id === '' || ( id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR ); } /** * Checks if the first ID is an ancestor of or equal to the second ID. * * @param {string} ancestorID * @param {string} descendantID * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. * @internal */ function isAncestorIDOf(ancestorID, descendantID) { return ( descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length) ); } /** * Gets the parent ID of the supplied React DOM ID, `id`. * * @param {string} id ID of a component. * @return {string} ID of the parent, or an empty string. * @private */ function getParentID(id) { return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; } /** * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the * supplied `destinationID`. If they are equal, the ID is returned. * * @param {string} ancestorID ID of an ancestor node of `destinationID`. * @param {string} destinationID ID of the destination node. * @return {string} Next ID on the path from `ancestorID` to `destinationID`. * @private */ function getNextDescendantID(ancestorID, destinationID) { invariant( isValidID(ancestorID) && isValidID(destinationID), 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID ); invariant( isAncestorIDOf(ancestorID, destinationID), 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID ); if (ancestorID === destinationID) { return ancestorID; } // Skip over the ancestor and the immediate separator. Traverse until we hit // another separator or we reach the end of `destinationID`. var start = ancestorID.length + SEPARATOR_LENGTH; for (var i = start; i < destinationID.length; i++) { if (isBoundary(destinationID, i)) { break; } } return destinationID.substr(0, i); } /** * Gets the nearest common ancestor ID of two IDs. * * Using this ID scheme, the nearest common ancestor ID is the longest common * prefix of the two IDs that immediately preceded a "marker" in both strings. * * @param {string} oneID * @param {string} twoID * @return {string} Nearest common ancestor ID, or the empty string if none. * @private */ function getFirstCommonAncestorID(oneID, twoID) { var minLength = Math.min(oneID.length, twoID.length); if (minLength === 0) { return ''; } var lastCommonMarkerIndex = 0; // Use `<=` to traverse until the "EOL" of the shorter string. for (var i = 0; i <= minLength; i++) { if (isBoundary(oneID, i) && isBoundary(twoID, i)) { lastCommonMarkerIndex = i; } else if (oneID.charAt(i) !== twoID.charAt(i)) { break; } } var longestCommonID = oneID.substr(0, lastCommonMarkerIndex); invariant( isValidID(longestCommonID), 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID ); return longestCommonID; } /** * Traverses the parent path between two IDs (either up or down). The IDs must * not be the same, and there must exist a parent path between them. * * @param {?string} start ID at which to start traversal. * @param {?string} stop ID at which to end traversal. * @param {function} cb Callback to invoke each ID with. * @param {?boolean} skipFirst Whether or not to skip the first node. * @param {?boolean} skipLast Whether or not to skip the last node. * @private */ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { start = start || ''; stop = stop || ''; invariant( start !== stop, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start ); var traverseUp = isAncestorIDOf(stop, start); invariant( traverseUp || isAncestorIDOf(start, stop), 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop ); // Traverse from `start` to `stop` one depth at a time. var depth = 0; var traverse = traverseUp ? getParentID : getNextDescendantID; for (var id = start; /* until break */; id = traverse(id, stop)) { if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) { cb(id, traverseUp, arg); } if (id === stop) { // Only break //after// visiting `stop`. break; } invariant( depth++ < MAX_TREE_DEPTH, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop ); } } /** * Manages the IDs assigned to DOM representations of React components. This * uses a specific scheme in order to traverse the DOM efficiently (e.g. in * order to simulate events). * * @internal */ var ReactInstanceHandles = { createReactRootID: function() { return getReactRootIDString( Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX) ); }, /** * Constructs a React ID by joining a root ID with a name. * * @param {string} rootID Root ID of a parent component. * @param {string} name A component's name (as flattened children). * @return {string} A React ID. * @internal */ createReactID: function(rootID, name) { return rootID + SEPARATOR + name; }, /** * Gets the DOM ID of the React component that is the root of the tree that * contains the React component with the supplied DOM ID. * * @param {string} id DOM ID of a React component. * @return {?string} DOM ID of the React component that is the root. * @internal */ getReactRootIDFromNodeID: function(id) { var regexResult = /\.r\[[^\]]+\]/.exec(id); return regexResult && regexResult[0]; }, /** * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that * should would receive a `mouseEnter` or `mouseLeave` event. * * NOTE: Does not invoke the callback on the nearest common ancestor because * nothing "entered" or "left" that element. * * @param {string} leaveID ID being left. * @param {string} enterID ID being entered. * @param {function} cb Callback to invoke on each entered/left ID. * @param {*} upArg Argument to invoke the callback with on left IDs. * @param {*} downArg Argument to invoke the callback with on entered IDs. * @internal */ traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) { var ancestorID = getFirstCommonAncestorID(leaveID, enterID); if (ancestorID !== leaveID) { traverseParentPath(leaveID, ancestorID, cb, upArg, false, true); } if (ancestorID !== enterID) { traverseParentPath(ancestorID, enterID, cb, downArg, true, false); } }, /** * Simulates the traversal of a two-phase, capture/bubble event dispatch. * * NOTE: This traversal happens on IDs without touching the DOM. * * @param {string} targetID ID of the target node. * @param {function} cb Callback to invoke. * @param {*} arg Argument to invoke the callback with. * @internal */ traverseTwoPhase: function(targetID, cb, arg) { if (targetID) { traverseParentPath('', targetID, cb, arg, true, false); traverseParentPath(targetID, '', cb, arg, false, true); } }, /** * Exposed for unit testing. * @private */ _getFirstCommonAncestorID: getFirstCommonAncestorID, /** * Exposed for unit testing. * @private */ _getNextDescendantID: getNextDescendantID, isAncestorIDOf: isAncestorIDOf, SEPARATOR: SEPARATOR }; module.exports = ReactInstanceHandles; },{"./invariant":95}],48:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactMarkupChecksum */ "use strict"; var adler32 = require("./adler32"); var ReactMarkupChecksum = { CHECKSUM_ATTR_NAME: 'data-react-checksum', /** * @param {string} markup Markup string * @return {string} Markup string with checksum attribute attached */ addChecksumToMarkup: function(markup) { var checksum = adler32(markup); return markup.replace( '>', ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">' ); }, /** * @param {string} markup to use * @param {DOMElement} element root React element * @returns {boolean} whether or not the markup is the same */ canReuseMarkup: function(markup, element) { var existingChecksum = element.getAttribute( ReactMarkupChecksum.CHECKSUM_ATTR_NAME ); existingChecksum = existingChecksum && parseInt(existingChecksum, 10); var markupChecksum = adler32(markup); return markupChecksum === existingChecksum; } }; module.exports = ReactMarkupChecksum; },{"./adler32":75}],49:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactMount */ "use strict"; var ReactEventEmitter = require("./ReactEventEmitter"); var ReactInstanceHandles = require("./ReactInstanceHandles"); var $ = require("./$"); var getReactRootElementInContainer = require("./getReactRootElementInContainer"); var invariant = require("./invariant"); var nodeContains = require("./nodeContains"); var SEPARATOR = ReactInstanceHandles.SEPARATOR; var ATTR_NAME = 'data-reactid'; var nodeCache = {}; var ELEMENT_NODE_TYPE = 1; var DOC_NODE_TYPE = 9; /** Mapping from reactRootID to React component instance. */ var instancesByReactRootID = {}; /** Mapping from reactRootID to `container` nodes. */ var containersByReactRootID = {}; if (true) { /** __DEV__-only mapping from reactRootID to root elements. */ var rootElementsByReactRootID = {}; } /** * @param {DOMElement} container DOM element that may contain a React component. * @return {?string} A "reactRoot" ID, if a React component is rendered. */ function getReactRootID(container) { var rootElement = getReactRootElementInContainer(container); return rootElement && ReactMount.getID(rootElement); } /** * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form * element can return its control whose name or ID equals ATTR_NAME. All * DOM nodes support `getAttributeNode` but this can also get called on * other objects so just return '' if we're given something other than a * DOM node (such as window). * * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node. * @return {string} ID of the supplied `domNode`. */ function getID(node) { var id = internalGetID(node); if (id) { if (nodeCache.hasOwnProperty(id)) { var cached = nodeCache[id]; if (cached !== node) { invariant( !isValid(cached, id), 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id ); nodeCache[id] = node; } } else { nodeCache[id] = node; } } return id; } function internalGetID(node) { // If node is something like a window, document, or text node, none of // which support attributes or a .getAttribute method, gracefully return // the empty string, as if the attribute were missing. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; } /** * Sets the React-specific ID of the given node. * * @param {DOMElement} node The DOM node whose ID will be set. * @param {string} id The value of the ID attribute. */ function setID(node, id) { var oldID = internalGetID(node); if (oldID !== id) { delete nodeCache[oldID]; } node.setAttribute(ATTR_NAME, id); nodeCache[id] = node; } /** * Finds the node with the supplied React-generated DOM ID. * * @param {string} id A React-generated DOM ID. * @return {DOMElement} DOM node with the suppled `id`. * @internal */ function getNode(id) { if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { nodeCache[id] = ReactMount.findReactNodeByID(id); } return nodeCache[id]; } /** * A node is "valid" if it is contained by a currently mounted container. * * This means that the node does not have to be contained by a document in * order to be considered valid. * * @param {?DOMElement} node The candidate DOM node. * @param {string} id The expected ID of the node. * @return {boolean} Whether the node is contained by a mounted container. */ function isValid(node, id) { if (node) { invariant( internalGetID(node) === id, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME ); var container = ReactMount.findReactContainerForID(id); if (container && nodeContains(container, node)) { return true; } } return false; } /** * Causes the cache to forget about one React-specific ID. * * @param {string} id The ID to forget. */ function purgeID(id) { delete nodeCache[id]; } /** * Mounting is the process of initializing a React component by creatings its * representative DOM elements and inserting them into a supplied `container`. * Any prior content inside `container` is destroyed in the process. * * ReactMount.renderComponent(component, $('container')); * * <div id="container"> <-- Supplied `container`. * <div data-reactid=".r[3]"> <-- Rendered reactRoot of React * // ... component. * </div> * </div> * * Inside of `container`, the first element rendered is the "reactRoot". */ var ReactMount = { /** * Safety guard to prevent accidentally rendering over the entire HTML tree. */ allowFullPageRender: false, /** Time spent generating markup. */ totalInstantiationTime: 0, /** Time spent inserting markup into the DOM. */ totalInjectionTime: 0, /** Whether support for touch events should be initialized. */ useTouchEvents: false, /** Exposed for debugging purposes **/ _instancesByReactRootID: instancesByReactRootID, /** * This is a hook provided to support rendering React components while * ensuring that the apparent scroll position of its `container` does not * change. * * @param {DOMElement} container The `container` being rendered into. * @param {function} renderCallback This must be called once to do the render. */ scrollMonitor: function(container, renderCallback) { renderCallback(); }, /** * Ensures that the top-level event delegation listener is set up. This will * be invoked some time before the first time any React component is rendered. * @param {DOMElement} container container we're rendering into * * @private */ prepareEnvironmentForDOM: function(container) { invariant( container && ( container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE ), 'prepareEnvironmentForDOM(...): Target container is not a DOM element.' ); var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container; ReactEventEmitter.ensureListening(ReactMount.useTouchEvents, doc); }, /** * Take a component that's already mounted into the DOM and replace its props * @param {ReactComponent} prevComponent component instance already in the DOM * @param {ReactComponent} nextComponent component instance to render * @param {DOMElement} container container to render into * @param {?function} callback function triggered on completion */ _updateRootComponent: function( prevComponent, nextComponent, container, callback) { var nextProps = nextComponent.props; ReactMount.scrollMonitor(container, function() { prevComponent.replaceProps(nextProps, callback); }); if (true) { // Record the root element in case it later gets transplanted. rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container); } return prevComponent; }, /** * Register a component into the instance map and start the events system. * @param {ReactComponent} nextComponent component instance to render * @param {DOMElement} container container to render into * @return {string} reactRoot ID prefix */ _registerComponent: function(nextComponent, container) { ReactMount.prepareEnvironmentForDOM(container); var reactRootID = ReactMount.registerContainer(container); instancesByReactRootID[reactRootID] = nextComponent; return reactRootID; }, /** * Render a new component into the DOM. * @param {ReactComponent} nextComponent component instance to render * @param {DOMElement} container container to render into * @param {boolean} shouldReuseMarkup if we should skip the markup insertion * @return {ReactComponent} nextComponent */ _renderNewRootComponent: function( nextComponent, container, shouldReuseMarkup) { var reactRootID = ReactMount._registerComponent(nextComponent, container); nextComponent.mountComponentIntoNode( reactRootID, container, shouldReuseMarkup ); if (true) { // Record the root element in case it later gets transplanted. rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container); } return nextComponent; }, /** * Renders a React component into the DOM in the supplied `container`. * * If the React component was previously rendered into `container`, this will * perform an update on it and only mutate the DOM as necessary to reflect the * latest React component. * * @param {ReactComponent} nextComponent Component instance to render. * @param {DOMElement} container DOM element to render into. * @param {?function} callback function triggered on completion * @return {ReactComponent} Component instance rendered in `container`. */ renderComponent: function(nextComponent, container, callback) { var registeredComponent = instancesByReactRootID[getReactRootID(container)]; if (registeredComponent) { if (registeredComponent.constructor === nextComponent.constructor) { return ReactMount._updateRootComponent( registeredComponent, nextComponent, container, callback ); } else { ReactMount.unmountComponentAtNode(container); } } var reactRootElement = getReactRootElementInContainer(container); var containerHasReactMarkup = reactRootElement && ReactMount.isRenderedByReact(reactRootElement); var shouldReuseMarkup = containerHasReactMarkup && !registeredComponent; var component = ReactMount._renderNewRootComponent( nextComponent, container, shouldReuseMarkup ); callback && callback(); return component; }, /** * Constructs a component instance of `constructor` with `initialProps` and * renders it into the supplied `container`. * * @param {function} constructor React component constructor. * @param {?object} props Initial props of the component instance. * @param {DOMElement} container DOM element to render into. * @return {ReactComponent} Component instance rendered in `container`. */ constructAndRenderComponent: function(constructor, props, container) { return ReactMount.renderComponent(constructor(props), container); }, /** * Constructs a component instance of `constructor` with `initialProps` and * renders it into a container node identified by supplied `id`. * * @param {function} componentConstructor React component constructor * @param {?object} props Initial props of the component instance. * @param {string} id ID of the DOM element to render into. * @return {ReactComponent} Component instance rendered in the container node. */ constructAndRenderComponentByID: function(constructor, props, id) { return ReactMount.constructAndRenderComponent(constructor, props, $(id)); }, /** * Registers a container node into which React components will be rendered. * This also creates the "reatRoot" ID that will be assigned to the element * rendered within. * * @param {DOMElement} container DOM element to register as a container. * @return {string} The "reactRoot" ID of elements rendered within. */ registerContainer: function(container) { var reactRootID = getReactRootID(container); if (reactRootID) { // If one exists, make sure it is a valid "reactRoot" ID. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID); } if (!reactRootID) { // No valid "reactRoot" ID found, create one. reactRootID = ReactInstanceHandles.createReactRootID(); } containersByReactRootID[reactRootID] = container; return reactRootID; }, /** * Unmounts and destroys the React component rendered in the `container`. * * @param {DOMElement} container DOM element containing a React component. * @return {boolean} True if a component was found in and unmounted from * `container` */ unmountComponentAtNode: function(container) { var reactRootID = getReactRootID(container); var component = instancesByReactRootID[reactRootID]; if (!component) { return false; } ReactMount.unmountComponentFromNode(component, container); delete instancesByReactRootID[reactRootID]; delete containersByReactRootID[reactRootID]; if (true) { delete rootElementsByReactRootID[reactRootID]; } return true; }, /** * @deprecated */ unmountAndReleaseReactRootNode: function() { if (true) { console.warn( 'unmountAndReleaseReactRootNode() has been renamed to ' + 'unmountComponentAtNode() and will be removed in the next ' + 'version of React.' ); } return ReactMount.unmountComponentAtNode.apply(this, arguments); }, /** * Unmounts a component and removes it from the DOM. * * @param {ReactComponent} instance React component instance. * @param {DOMElement} container DOM element to unmount from. * @final * @internal * @see {ReactMount.unmountComponentAtNode} */ unmountComponentFromNode: function(instance, container) { instance.unmountComponent(); if (container.nodeType === DOC_NODE_TYPE) { container = container.documentElement; } // http://jsperf.com/emptying-a-node while (container.lastChild) { container.removeChild(container.lastChild); } }, /** * Finds the container DOM element that contains React component to which the * supplied DOM `id` belongs. * * @param {string} id The ID of an element rendered by a React component. * @return {?DOMElement} DOM element that contains the `id`. */ findReactContainerForID: function(id) { var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); var container = containersByReactRootID[reactRootID]; if (true) { var rootElement = rootElementsByReactRootID[reactRootID]; if (rootElement && rootElement.parentNode !== container) { invariant( // Call internalGetID here because getID calls isValid which calls // findReactContainerForID (this function). internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.' ); var containerChild = container.firstChild; if (containerChild && reactRootID === internalGetID(containerChild)) { // If the container has a new child with the same ID as the old // root element, then rootElementsByReactRootID[reactRootID] is // just stale and needs to be updated. The case that deserves a // warning is when the container is empty. rootElementsByReactRootID[reactRootID] = containerChild; } else { console.warn( 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode ); } } } return container; }, /** * Finds an element rendered by React with the supplied ID. * * @param {string} id ID of a DOM node in the React component. * @return {DOMElement} Root DOM node of the React component. */ findReactNodeByID: function(id) { var reactRoot = ReactMount.findReactContainerForID(id); return ReactMount.findComponentRoot(reactRoot, id); }, /** * True if the supplied `node` is rendered by React. * * @param {*} node DOM Element to check. * @return {boolean} True if the DOM Element appears to be rendered by React. * @internal */ isRenderedByReact: function(node) { if (node.nodeType !== 1) { // Not a DOMElement, therefore not a React component return false; } var id = ReactMount.getID(node); return id ? id.charAt(0) === SEPARATOR : false; }, /** * Traverses up the ancestors of the supplied node to find a node that is a * DOM representation of a React component. * * @param {*} node * @return {?DOMEventTarget} * @internal */ getFirstReactDOM: function(node) { var current = node; while (current && current.parentNode !== current) { if (ReactMount.isRenderedByReact(current)) { return current; } current = current.parentNode; } return null; }, /** * Finds a node with the supplied `id` inside of the supplied `ancestorNode`. * Exploits the ID naming scheme to perform the search quickly. * * @param {DOMEventTarget} ancestorNode Search from this root. * @pararm {string} id ID of the DOM representation of the component. * @return {DOMEventTarget} DOM node with the supplied `id`. * @internal */ findComponentRoot: function(ancestorNode, id) { var firstChildren = [ancestorNode.firstChild]; var childIndex = 0; while (childIndex < firstChildren.length) { var child = firstChildren[childIndex++]; while (child) { var childID = ReactMount.getID(child); if (childID) { if (id === childID) { return child; } else if (ReactInstanceHandles.isAncestorIDOf(childID, id)) { // If we find a child whose ID is an ancestor of the given ID, // then we can be sure that we only want to search the subtree // rooted at this child, so we can throw out the rest of the // search state. firstChildren.length = childIndex = 0; firstChildren.push(child.firstChild); break; } else { // TODO This should not be necessary if the ID hierarchy is // correct, but is occasionally necessary if the DOM has been // modified in unexpected ways. firstChildren.push(child.firstChild); } } else { // If this child had no ID, then there's a chance that it was // injected automatically by the browser, as when a `<table>` // element sprouts an extra `<tbody>` child as a side effect of // `.innerHTML` parsing. Optimistically continue down this // branch, but not before examining the other siblings. firstChildren.push(child.firstChild); } child = child.nextSibling; } } if (true) { console.error( 'Error while invoking `findComponentRoot` with the following ' + 'ancestor node:', ancestorNode ); } invariant( false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g. by the browser).', id, ReactMount.getID(ancestorNode) ); }, /** * React ID utilities. */ ATTR_NAME: ATTR_NAME, getReactRootID: getReactRootID, getID: getID, setID: setID, getNode: getNode, purgeID: purgeID, injection: {} }; module.exports = ReactMount; },{"./$":1,"./ReactEventEmitter":43,"./ReactInstanceHandles":47,"./getReactRootElementInContainer":92,"./invariant":95,"./nodeContains":109}],50:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactMountReady */ "use strict"; var PooledClass = require("./PooledClass"); var mixInto = require("./mixInto"); /** * A specialized pseudo-event module to help keep track of components waiting to * be notified when their DOM representations are available for use. * * This implements `PooledClass`, so you should never need to instantiate this. * Instead, use `ReactMountReady.getPooled()`. * * @param {?array<function>} initialCollection * @class ReactMountReady * @implements PooledClass * @internal */ function ReactMountReady(initialCollection) { this._queue = initialCollection || null; } mixInto(ReactMountReady, { /** * Enqueues a callback to be invoked when `notifyAll` is invoked. This is used * to enqueue calls to `componentDidMount` and `componentDidUpdate`. * * @param {ReactComponent} component Component being rendered. * @param {function(DOMElement)} callback Invoked when `notifyAll` is invoked. * @internal */ enqueue: function(component, callback) { this._queue = this._queue || []; this._queue.push({component: component, callback: callback}); }, /** * Invokes all enqueued callbacks and clears the queue. This is invoked after * the DOM representation of a component has been created or updated. * * @internal */ notifyAll: function() { var queue = this._queue; if (queue) { this._queue = null; for (var i = 0, l = queue.length; i < l; i++) { var component = queue[i].component; var callback = queue[i].callback; callback.call(component, component.getDOMNode()); } queue.length = 0; } }, /** * Resets the internal queue. * * @internal */ reset: function() { this._queue = null; }, /** * `PooledClass` looks for this. */ destructor: function() { this.reset(); } }); PooledClass.addPoolingTo(ReactMountReady); module.exports = ReactMountReady; },{"./PooledClass":23,"./mixInto":107}],51:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactMultiChild * @typechecks static-only */ "use strict"; var ReactComponent = require("./ReactComponent"); var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes"); var flattenChildren = require("./flattenChildren"); /** * Given a `curChild` and `newChild`, determines if `curChild` should be * updated as opposed to being destroyed or replaced. * * @param {?ReactComponent} curChild * @param {?ReactComponent} newChild * @return {boolean} True if `curChild` should be updated with `newChild`. * @protected */ function shouldUpdateChild(curChild, newChild) { return curChild && newChild && curChild.constructor === newChild.constructor; } /** * Updating children of a component may trigger recursive updates. The depth is * used to batch recursive updates to render markup more efficiently. * * @type {number} * @private */ var updateDepth = 0; /** * Queue of update configuration objects. * * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`. * * @type {array<object>} * @private */ var updateQueue = []; /** * Queue of markup to be rendered. * * @type {array<string>} * @private */ var markupQueue = []; /** * Enqueues markup to be rendered and inserted at a supplied index. * * @param {string} parentID ID of the parent component. * @param {string} markup Markup that renders into an element. * @param {number} toIndex Destination index. * @private */ function enqueueMarkup(parentID, markup, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.INSERT_MARKUP, markupIndex: markupQueue.push(markup) - 1, fromIndex: null, textContent: null, toIndex: toIndex }); } /** * Enqueues moving an existing element to another index. * * @param {string} parentID ID of the parent component. * @param {number} fromIndex Source index of the existing element. * @param {number} toIndex Destination index of the element. * @private */ function enqueueMove(parentID, fromIndex, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.MOVE_EXISTING, markupIndex: null, textContent: null, fromIndex: fromIndex, toIndex: toIndex }); } /** * Enqueues removing an element at an index. * * @param {string} parentID ID of the parent component. * @param {number} fromIndex Index of the element to remove. * @private */ function enqueueRemove(parentID, fromIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.REMOVE_NODE, markupIndex: null, textContent: null, fromIndex: fromIndex, toIndex: null }); } /** * Enqueues setting the text content. * * @param {string} parentID ID of the parent component. * @param {string} textContent Text content to set. * @private */ function enqueueTextContent(parentID, textContent) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.TEXT_CONTENT, markupIndex: null, textContent: textContent, fromIndex: null, toIndex: null }); } /** * Processes any enqueued updates. * * @private */ function processQueue() { if (updateQueue.length) { ReactComponent.DOMIDOperations.dangerouslyProcessChildrenUpdates( updateQueue, markupQueue ); clearQueue(); } } /** * Clears any enqueued updates. * * @private */ function clearQueue() { updateQueue.length = 0; markupQueue.length = 0; } /** * ReactMultiChild are capable of reconciling multiple children. * * @class ReactMultiChild * @internal */ var ReactMultiChild = { /** * Provides common functionality for components that must reconcile multiple * children. This is used by `ReactDOMComponent` to mount, update, and * unmount child components. * * @lends {ReactMultiChild.prototype} */ Mixin: { /** * Generates a "mount image" for each of the supplied children. In the case * of `ReactDOMComponent`, a mount image is a string of markup. * * @param {?object} nestedChildren Nested child maps. * @return {array} An array of mounted representations. * @internal */ mountChildren: function(nestedChildren, transaction) { var children = flattenChildren(nestedChildren); var mountImages = []; var index = 0; this._renderedChildren = children; for (var name in children) { var child = children[name]; if (children.hasOwnProperty(name) && child) { // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + '.' + name; var mountImage = child.mountComponent( rootID, transaction, this._mountDepth + 1 ); child._mountImage = mountImage; child._mountIndex = index; mountImages.push(mountImage); index++; } } return mountImages; }, /** * Replaces any rendered children with a text content string. * * @param {string} nextContent String of content. * @internal */ updateTextContent: function(nextContent) { updateDepth++; try { var prevChildren = this._renderedChildren; // Remove any rendered children. for (var name in prevChildren) { if (prevChildren.hasOwnProperty(name) && prevChildren[name]) { this._unmountChildByName(prevChildren[name], name); } } // Set new text content. this.setTextContent(nextContent); } catch (error) { updateDepth--; updateDepth || clearQueue(); throw error; } updateDepth--; updateDepth || processQueue(); }, /** * Updates the rendered children with new children. * * @param {?object} nextNestedChildren Nested child maps. * @param {ReactReconcileTransaction} transaction * @internal */ updateChildren: function(nextNestedChildren, transaction) { updateDepth++; try { this._updateChildren(nextNestedChildren, transaction); } catch (error) { updateDepth--; updateDepth || clearQueue(); throw error; } updateDepth--; updateDepth || processQueue(); }, /** * Improve performance by isolating this hot code path from the try/catch * block in `updateChildren`. * * @param {?object} nextNestedChildren Nested child maps. * @param {ReactReconcileTransaction} transaction * @final * @protected */ _updateChildren: function(nextNestedChildren, transaction) { var nextChildren = flattenChildren(nextNestedChildren); var prevChildren = this._renderedChildren; if (!nextChildren && !prevChildren) { return; } var name; // `nextIndex` will increment for each child in `nextChildren`, but // `lastIndex` will be the last index visited in `prevChildren`. var lastIndex = 0; var nextIndex = 0; for (name in nextChildren) { if (!nextChildren.hasOwnProperty(name)) { continue; } var prevChild = prevChildren && prevChildren[name]; var nextChild = nextChildren[name]; if (shouldUpdateChild(prevChild, nextChild)) { this.moveChild(prevChild, nextIndex, lastIndex); lastIndex = Math.max(prevChild._mountIndex, lastIndex); prevChild.receiveProps(nextChild.props, transaction); prevChild._mountIndex = nextIndex; } else { if (prevChild) { // Update `lastIndex` before `_mountIndex` gets unset by unmounting. lastIndex = Math.max(prevChild._mountIndex, lastIndex); this._unmountChildByName(prevChild, name); } if (nextChild) { this._mountChildByNameAtIndex( nextChild, name, nextIndex, transaction ); } } if (nextChild) { nextIndex++; } } // Remove children that are no longer present. for (name in prevChildren) { if (prevChildren.hasOwnProperty(name) && prevChildren[name] && !(nextChildren && nextChildren[name])) { this._unmountChildByName(prevChildren[name], name); } } }, /** * Unmounts all rendered children. This should be used to clean up children * when this component is unmounted. * * @internal */ unmountChildren: function() { var renderedChildren = this._renderedChildren; for (var name in renderedChildren) { var renderedChild = renderedChildren[name]; if (renderedChild && renderedChild.unmountComponent) { renderedChild.unmountComponent(); } } this._renderedChildren = null; }, /** * Moves a child component to the supplied index. * * @param {ReactComponent} child Component to move. * @param {number} toIndex Destination index of the element. * @param {number} lastIndex Last index visited of the siblings of `child`. * @protected */ moveChild: function(child, toIndex, lastIndex) { // If the index of `child` is less than `lastIndex`, then it needs to // be moved. Otherwise, we do not need to move it because a child will be // inserted or moved before `child`. if (child._mountIndex < lastIndex) { enqueueMove(this._rootNodeID, child._mountIndex, toIndex); } }, /** * Creates a child component. * * @param {ReactComponent} child Component to create. * @protected */ createChild: function(child) { enqueueMarkup(this._rootNodeID, child._mountImage, child._mountIndex); }, /** * Removes a child component. * * @param {ReactComponent} child Child to remove. * @protected */ removeChild: function(child) { enqueueRemove(this._rootNodeID, child._mountIndex); }, /** * Sets this text content string. * * @param {string} textContent Text content to set. * @protected */ setTextContent: function(textContent) { enqueueTextContent(this._rootNodeID, textContent); }, /** * Mounts a child with the supplied name. * * NOTE: This is part of `updateChildren` and is here for readability. * * @param {ReactComponent} child Component to mount. * @param {string} name Name of the child. * @param {number} index Index at which to insert the child. * @param {ReactReconcileTransaction} transaction * @private */ _mountChildByNameAtIndex: function(child, name, index, transaction) { // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + '.' + name; var mountImage = child.mountComponent( rootID, transaction, this._mountDepth + 1 ); child._mountImage = mountImage; child._mountIndex = index; this.createChild(child); this._renderedChildren = this._renderedChildren || {}; this._renderedChildren[name] = child; }, /** * Unmounts a rendered child by name. * * NOTE: This is part of `updateChildren` and is here for readability. * * @param {ReactComponent} child Component to unmount. * @param {string} name Name of the child in `this._renderedChildren`. * @private */ _unmountChildByName: function(child, name) { if (ReactComponent.isValidComponent(child)) { this.removeChild(child); child._mountImage = null; child._mountIndex = null; child.unmountComponent(); delete this._renderedChildren[name]; } } } }; module.exports = ReactMultiChild; },{"./ReactComponent":25,"./ReactMultiChildUpdateTypes":52,"./flattenChildren":85}],52:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactMultiChildUpdateTypes */ var keyMirror = require("./keyMirror"); /** * When a component's children are updated, a series of update configuration * objects are created in order to batch and serialize the required changes. * * Enumerates all the possible types of update configurations. * * @internal */ var ReactMultiChildUpdateTypes = keyMirror({ INSERT_MARKUP: null, MOVE_EXISTING: null, REMOVE_NODE: null, TEXT_CONTENT: null }); module.exports = ReactMultiChildUpdateTypes; },{"./keyMirror":101}],53:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactOwner */ "use strict"; var invariant = require("./invariant"); /** * ReactOwners are capable of storing references to owned components. * * All components are capable of //being// referenced by owner components, but * only ReactOwner components are capable of //referencing// owned components. * The named reference is known as a "ref". * * Refs are available when mounted and updated during reconciliation. * * var MyComponent = React.createClass({ * render: function() { * return ( * <div onClick={this.handleClick}> * <CustomComponent ref="custom" /> * </div> * ); * }, * handleClick: function() { * this.refs.custom.handleClick(); * }, * componentDidMount: function() { * this.refs.custom.initialize(); * } * }); * * Refs should rarely be used. When refs are used, they should only be done to * control data that is not handled by React's data flow. * * @class ReactOwner */ var ReactOwner = { /** * @param {?object} object * @return {boolean} True if `object` is a valid owner. * @final */ isValidOwner: function(object) { return !!( object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function' ); }, /** * Adds a component by ref to an owner component. * * @param {ReactComponent} component Component to reference. * @param {string} ref Name by which to refer to the component. * @param {ReactOwner} owner Component on which to record the ref. * @final * @internal */ addComponentAsRefTo: function(component, ref, owner) { invariant( ReactOwner.isValidOwner(owner), 'addComponentAsRefTo(...): Only a ReactOwner can have refs.' ); owner.attachRef(ref, component); }, /** * Removes a component by ref from an owner component. * * @param {ReactComponent} component Component to dereference. * @param {string} ref Name of the ref to remove. * @param {ReactOwner} owner Component on which the ref is recorded. * @final * @internal */ removeComponentAsRefFrom: function(component, ref, owner) { invariant( ReactOwner.isValidOwner(owner), 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs.' ); // Check that `component` is still the current ref because we do not want to // detach the ref if another component stole it. if (owner.refs[ref] === component) { owner.detachRef(ref); } }, /** * A ReactComponent must mix this in to have refs. * * @lends {ReactOwner.prototype} */ Mixin: { /** * 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) { invariant( component.isOwnedBy(this), 'attachRef(%s, ...): Only a component\'s owner can store a ref to it.', ref ); var refs = this.refs || (this.refs = {}); refs[ref] = component; }, /** * Detaches a reference name. * * @param {string} ref Name to dereference. * @final * @private */ detachRef: function(ref) { delete this.refs[ref]; } } }; module.exports = ReactOwner; },{"./invariant":95}],54:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactPerf * @typechecks static-only */ "use strict"; var ReactPerf = { /** * Boolean to enable/disable measurement. Set to false by default to prevent * accidental logging and perf loss. */ enableMeasure: false, /** * Holds onto the measure function in use. By default, don't measure * anything, but we'll override this if we inject a measure function. */ storedMeasure: _noMeasure, /** * Use this to wrap methods you want to measure. * * @param {string} objName * @param {string} fnName * @param {function} func * @return {function} */ measure: function(objName, fnName, func) { if (true) { var measuredFunc = null; return function() { if (ReactPerf.enableMeasure) { if (!measuredFunc) { measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); } return measuredFunc.apply(this, arguments); } return func.apply(this, arguments); }; } return func; }, injection: { /** * @param {function} measure */ injectMeasure: function(measure) { ReactPerf.storedMeasure = measure; } } }; if (true) { var ExecutionEnvironment = require("./ExecutionEnvironment"); var URL = ExecutionEnvironment.canUseDOM ? window.location.href : ''; ReactPerf.enableMeasure = ReactPerf.enableMeasure || !!URL.match(/[?&]react_perf\b/); } /** * Simply passes through the measured function, without measuring it. * * @param {string} objName * @param {string} fnName * @param {function} func * @return {function} */ function _noMeasure(objName, fnName, func) { return func; } module.exports = ReactPerf; },{"./ExecutionEnvironment":20}],55:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactPropTransferer */ "use strict"; var emptyFunction = require("./emptyFunction"); var invariant = require("./invariant"); var joinClasses = require("./joinClasses"); var merge = require("./merge"); /** * Creates a transfer strategy that will merge prop values using the supplied * `mergeStrategy`. If a prop was previously unset, this just sets it. * * @param {function} mergeStrategy * @return {function} */ function createTransferStrategy(mergeStrategy) { return function(props, key, value) { if (!props.hasOwnProperty(key)) { props[key] = value; } else { props[key] = mergeStrategy(props[key], value); } }; } /** * Transfer strategies dictate how props are transferred by `transferPropsTo`. */ var TransferStrategies = { /** * Never transfer `children`. */ children: emptyFunction, /** * Transfer the `className` prop by merging them. */ className: createTransferStrategy(joinClasses), /** * Never transfer the `ref` prop. */ ref: emptyFunction, /** * Transfer the `style` prop (which is an object) by merging them. */ style: createTransferStrategy(merge) }; /** * ReactPropTransferer are capable of transferring props to another component * using a `transferPropsTo` method. * * @class ReactPropTransferer */ var ReactPropTransferer = { TransferStrategies: TransferStrategies, /** * @lends {ReactPropTransferer.prototype} */ Mixin: { /** * Transfer props from this component to a target component. * * Props that do not have an explicit transfer strategy will be transferred * only if the target component does not already have the prop set. * * This is usually used to pass down props to a returned root component. * * @param {ReactComponent} component Component receiving the properties. * @return {ReactComponent} The supplied `component`. * @final * @protected */ transferPropsTo: function(component) { invariant( component.props.__owner__ === this, '%s: You can\'t call transferPropsTo() on a component that you ' + 'don\'t own, %s. This usually means you are calling ' + 'transferPropsTo() on a component passed in as props or children.', this.constructor.displayName, component.constructor.displayName ); var props = {}; for (var thatKey in component.props) { if (component.props.hasOwnProperty(thatKey)) { props[thatKey] = component.props[thatKey]; } } for (var thisKey in this.props) { if (!this.props.hasOwnProperty(thisKey)) { continue; } var transferStrategy = TransferStrategies[thisKey]; if (transferStrategy) { transferStrategy(props, thisKey, this.props[thisKey]); } else if (!props.hasOwnProperty(thisKey)) { props[thisKey] = this.props[thisKey]; } } component.props = props; return component; } } }; module.exports = ReactPropTransferer; },{"./emptyFunction":81,"./invariant":95,"./joinClasses":100,"./merge":104}],56:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactPropTypes */ "use strict"; var createObjectFrom = require("./createObjectFrom"); var invariant = require("./invariant"); /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var Props = require('ReactPropTypes'); * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * invariant( * propValue == null || * typeof propValue === 'string' || * propValue instanceof URI, * 'Invalid `%s` supplied to `%s`, expected string or URI.', * propName, * componentName * ); * } * }, * render: function() { ... } * }); * * @internal */ var Props = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), oneOf: createEnumTypeChecker, instanceOf: createInstanceTypeChecker }; var ANONYMOUS = '<<anonymous>>'; function createPrimitiveTypeChecker(expectedType) { function validatePrimitiveType(propValue, propName, componentName) { var propType = typeof propValue; if (propType === 'object' && Array.isArray(propValue)) { propType = 'array'; } invariant( propType === expectedType, 'Invalid prop `%s` of type `%s` supplied to `%s`, expected `%s`.', propName, propType, componentName, expectedType ); } return createChainableTypeChecker(validatePrimitiveType); } function createEnumTypeChecker(expectedValues) { var expectedEnum = createObjectFrom(expectedValues); function validateEnumType(propValue, propName, componentName) { invariant( expectedEnum[propValue], 'Invalid prop `%s` supplied to `%s`, expected one of %s.', propName, componentName, JSON.stringify(Object.keys(expectedEnum)) ); } return createChainableTypeChecker(validateEnumType); } function createInstanceTypeChecker(expectedClass) { function validateInstanceType(propValue, propName, componentName) { invariant( propValue instanceof expectedClass, 'Invalid prop `%s` supplied to `%s`, expected instance of `%s`.', propName, componentName, expectedClass.name || ANONYMOUS ); } return createChainableTypeChecker(validateInstanceType); } function createChainableTypeChecker(validate) { function createTypeChecker(isRequired) { function checkType(props, propName, componentName) { var propValue = props[propName]; if (propValue != null) { // Only validate if there is a value to check. validate(propValue, propName, componentName || ANONYMOUS); } else { invariant( !isRequired, 'Required prop `%s` was not specified in `%s`.', propName, componentName || ANONYMOUS ); } } if (!isRequired) { checkType.isRequired = createTypeChecker(true); } return checkType; } return createTypeChecker(false); } module.exports = Props; },{"./createObjectFrom":79,"./invariant":95}],57:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactReconcileTransaction * @typechecks static-only */ "use strict"; var ExecutionEnvironment = require("./ExecutionEnvironment"); var PooledClass = require("./PooledClass"); var ReactEventEmitter = require("./ReactEventEmitter"); var ReactInputSelection = require("./ReactInputSelection"); var ReactMountReady = require("./ReactMountReady"); var Transaction = require("./Transaction"); var mixInto = require("./mixInto"); /** * Ensures that, when possible, the selection range (currently selected text * input) is not disturbed by performing the transaction. */ var SELECTION_RESTORATION = { /** * @return {Selection} Selection information. */ initialize: ReactInputSelection.getSelectionInformation, /** * @param {Selection} sel Selection information returned from `initialize`. */ close: ReactInputSelection.restoreSelection }; /** * Suppresses events (blur/focus) that could be inadvertently dispatched due to * high level DOM manipulations (like temporarily removing a text input from the * DOM). */ var EVENT_SUPPRESSION = { /** * @return {boolean} The enabled status of `ReactEventEmitter` before the * reconciliation. */ initialize: function() { var currentlyEnabled = ReactEventEmitter.isEnabled(); ReactEventEmitter.setEnabled(false); return currentlyEnabled; }, /** * @param {boolean} previouslyEnabled Enabled status of `ReactEventEmitter` * before the reconciliation occured. `close` restores the previous value. */ close: function(previouslyEnabled) { ReactEventEmitter.setEnabled(previouslyEnabled); } }; /** * Provides a `ReactMountReady` queue for collecting `onDOMReady` callbacks * during the performing of the transaction. */ var ON_DOM_READY_QUEUEING = { /** * Initializes the internal `onDOMReady` queue. */ initialize: function() { this.reactMountReady.reset(); }, /** * After DOM is flushed, invoke all registered `onDOMReady` callbacks. */ close: function() { this.reactMountReady.notifyAll(); } }; /** * Executed within the scope of the `Transaction` instance. Consider these as * being member methods, but with an implied ordering while being isolated from * each other. */ var TRANSACTION_WRAPPERS = [ SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING ]; /** * Currently: * - The order that these are listed in the transaction is critical: * - Suppresses events. * - Restores selection range. * * Future: * - Restore document/overflow scroll positions that were unintentionally * modified via DOM insertions above the top viewport boundary. * - Implement/integrate with customized constraint based layout system and keep * track of which dimensions must be remeasured. * * @class ReactReconcileTransaction */ function ReactReconcileTransaction() { this.reinitializeTransaction(); this.reactMountReady = ReactMountReady.getPooled(null); } var Mixin = { /** * @see Transaction * @abstract * @final * @return {array<object>} List of operation wrap proceedures. * TODO: convert to array<TransactionWrapper> */ getTransactionWrappers: function() { if (ExecutionEnvironment.canUseDOM) { return TRANSACTION_WRAPPERS; } else { return []; } }, /** * @return {object} The queue to collect `onDOMReady` callbacks with. * TODO: convert to ReactMountReady */ getReactMountReady: function() { return this.reactMountReady; }, /** * `PooledClass` looks for this, and will invoke this before allowing this * instance to be resused. */ destructor: function() { ReactMountReady.release(this.reactMountReady); this.reactMountReady = null; } }; mixInto(ReactReconcileTransaction, Transaction.Mixin); mixInto(ReactReconcileTransaction, Mixin); PooledClass.addPoolingTo(ReactReconcileTransaction); module.exports = ReactReconcileTransaction; },{"./ExecutionEnvironment":20,"./PooledClass":23,"./ReactEventEmitter":43,"./ReactInputSelection":46,"./ReactMountReady":50,"./Transaction":72,"./mixInto":107}],58:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @typechecks static-only * @providesModule ReactServerRendering */ "use strict"; var ReactMarkupChecksum = require("./ReactMarkupChecksum"); var ReactReconcileTransaction = require("./ReactReconcileTransaction"); var ReactInstanceHandles = require("./ReactInstanceHandles"); /** * @param {object} component * @param {function} callback */ function renderComponentToString(component, callback) { // We use a callback API to keep the API async in case in the future we ever // need it, but in reality this is a synchronous operation. var id = ReactInstanceHandles.createReactRootID(); var transaction = ReactReconcileTransaction.getPooled(); transaction.reinitializeTransaction(); try { transaction.perform(function() { var markup = component.mountComponent(id, transaction, 0); markup = ReactMarkupChecksum.addChecksumToMarkup(markup); callback(markup); }, null); } finally { ReactReconcileTransaction.release(transaction); } } module.exports = { renderComponentToString: renderComponentToString }; },{"./ReactInstanceHandles":47,"./ReactMarkupChecksum":48,"./ReactReconcileTransaction":57}],59:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactTextComponent * @typechecks static-only */ "use strict"; var ReactComponent = require("./ReactComponent"); var ReactMount = require("./ReactMount"); var escapeTextForBrowser = require("./escapeTextForBrowser"); var mixInto = require("./mixInto"); /** * Text nodes violate a couple assumptions that React makes about components: * * - When mounting text into the DOM, adjacent text nodes are merged. * - Text nodes cannot be assigned a React root ID. * * This component is used to wrap strings in elements so that they can undergo * the same reconciliation that is applied to elements. * * TODO: Investigate representing React components in the DOM with text nodes. * * @class ReactTextComponent * @extends ReactComponent * @internal */ var ReactTextComponent = function(initialText) { this.construct({text: initialText}); }; mixInto(ReactTextComponent, ReactComponent.Mixin); mixInto(ReactTextComponent, { /** * Creates the markup for this text node. This node is not intended to have * any features besides containing text content. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction} transaction * @param {number} mountDepth number of components in the owner hierarchy * @return {string} Markup for this text node. * @internal */ mountComponent: function(rootID, transaction, mountDepth) { ReactComponent.Mixin.mountComponent.call( this, rootID, transaction, mountDepth ); return ( '<span ' + ReactMount.ATTR_NAME + '="' + escapeTextForBrowser(rootID) + '">' + escapeTextForBrowser(this.props.text) + '</span>' ); }, /** * Updates this component by updating the text content. * * @param {object} nextProps Contains the next text content. * @param {ReactReconcileTransaction} transaction * @internal */ receiveProps: function(nextProps, transaction) { if (nextProps.text !== this.props.text) { this.props.text = nextProps.text; ReactComponent.DOMIDOperations.updateTextContentByID( this._rootNodeID, nextProps.text ); } } }); module.exports = ReactTextComponent; },{"./ReactComponent":25,"./ReactMount":49,"./escapeTextForBrowser":82,"./mixInto":107}],60:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactUpdates */ "use strict"; var invariant = require("./invariant"); var dirtyComponents = []; var batchingStrategy = null; function ensureBatchingStrategy() { invariant(batchingStrategy, 'ReactUpdates: must inject a batching strategy'); } function batchedUpdates(callback, param) { ensureBatchingStrategy(); batchingStrategy.batchedUpdates(callback, param); } /** * Array comparator for ReactComponents by owner depth * * @param {ReactComponent} c1 first component you're comparing * @param {ReactComponent} c2 second component you're comparing * @return {number} Return value usable by Array.prototype.sort(). */ function mountDepthComparator(c1, c2) { return c1._mountDepth - c2._mountDepth; } function runBatchedUpdates() { // Since reconciling a component higher in the owner hierarchy usually (not // always -- see shouldComponentUpdate()) will reconcile children, reconcile // them before their children by sorting the array. dirtyComponents.sort(mountDepthComparator); for (var i = 0; i < dirtyComponents.length; i++) { // If a component is unmounted before pending changes apply, ignore them // TODO: Queue unmounts in the same list to avoid this happening at all var component = dirtyComponents[i]; if (component.isMounted()) { // If performUpdateIfNecessary happens to enqueue any new updates, we // shouldn't execute the callbacks until the next render happens, so // stash the callbacks first var callbacks = component._pendingCallbacks; component._pendingCallbacks = null; component.performUpdateIfNecessary(); if (callbacks) { for (var j = 0; j < callbacks.length; j++) { callbacks[j].call(component); } } } } } function clearDirtyComponents() { dirtyComponents.length = 0; } function flushBatchedUpdates() { // Run these in separate functions so the JIT can optimize try { runBatchedUpdates(); } catch (e) { // IE 8 requires catch to use finally. throw e; } finally { clearDirtyComponents(); } } /** * Mark a component as needing a rerender, adding an optional callback to a * list of functions which will be executed once the rerender occurs. */ function enqueueUpdate(component, callback) { invariant( !callback || typeof callback === "function", 'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.' ); ensureBatchingStrategy(); if (!batchingStrategy.isBatchingUpdates) { component.performUpdateIfNecessary(); callback && callback(); return; } dirtyComponents.push(component); if (callback) { if (component._pendingCallbacks) { component._pendingCallbacks.push(callback); } else { component._pendingCallbacks = [callback]; } } } var ReactUpdatesInjection = { injectBatchingStrategy: function(_batchingStrategy) { invariant( _batchingStrategy, 'ReactUpdates: must provide a batching strategy' ); invariant( typeof _batchingStrategy.batchedUpdates === 'function', 'ReactUpdates: must provide a batchedUpdates() function' ); invariant( typeof _batchingStrategy.isBatchingUpdates === 'boolean', 'ReactUpdates: must provide an isBatchingUpdates boolean attribute' ); batchingStrategy = _batchingStrategy; } }; var ReactUpdates = { batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate, flushBatchedUpdates: flushBatchedUpdates, injection: ReactUpdatesInjection }; module.exports = ReactUpdates; },{"./invariant":95}],61:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SelectEventPlugin */ "use strict"; var EventConstants = require("./EventConstants"); var EventPluginHub = require("./EventPluginHub"); var EventPropagators = require("./EventPropagators"); var ExecutionEnvironment = require("./ExecutionEnvironment"); var ReactInputSelection = require("./ReactInputSelection"); var SyntheticEvent = require("./SyntheticEvent"); var getActiveElement = require("./getActiveElement"); var isEventSupported = require("./isEventSupported"); var isTextInputElement = require("./isTextInputElement"); var keyOf = require("./keyOf"); var shallowEqual = require("./shallowEqual"); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { select: { phasedRegistrationNames: { bubbled: keyOf({onSelect: null}), captured: keyOf({onSelectCapture: null}) } } }; var useSelectionChange = false; var useSelect = false; if (ExecutionEnvironment.canUseDOM) { useSelectionChange = 'onselectionchange' in document; useSelect = isEventSupported('select'); } var activeElement = null; var activeElementID = null; var activeNativeEvent = null; var lastSelection = null; var mouseDown = false; /** * Get an object which is a unique representation of the current selection. * * The return value will not be consistent across nodes or browsers, but * two identical selections on the same node will return identical objects. * * @param {DOMElement} node * @param {object} */ function getSelection(node) { if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { return { start: node.selectionStart, end: node.selectionEnd }; } else if (document.selection) { var range = document.selection.createRange(); return { parentElement: range.parentElement(), text: range.text, top: range.boundingTop, left: range.boundingLeft }; } else { var selection = window.getSelection(); return { anchorNode: selection.anchorNode, anchorOffset: selection.anchorOffset, focusNode: selection.focusNode, focusOffset: selection.focusOffset }; } } /** * Poll selection to see whether it's changed. * * @param {object} nativeEvent * @return {?SyntheticEvent} */ function constructSelectEvent(nativeEvent) { // Ensure we have the right element, and that the user is not dragging a // selection (this matches native `select` event behavior). if (mouseDown || activeElement != getActiveElement()) { return; } // Only fire when selection has actually changed. var currentSelection = getSelection(activeElement); if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { lastSelection = currentSelection; var syntheticEvent = SyntheticEvent.getPooled( eventTypes.select, activeElementID, nativeEvent ); syntheticEvent.type = 'select'; syntheticEvent.target = activeElement; EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); return syntheticEvent; } } /** * Handle deferred event. And manually dispatch synthetic events. */ function dispatchDeferredSelectEvent() { if (!activeNativeEvent) { return; } var syntheticEvent = constructSelectEvent(activeNativeEvent); activeNativeEvent = null; // Enqueue and process the abstract event manually. if (syntheticEvent) { EventPluginHub.enqueueEvents(syntheticEvent); EventPluginHub.processEventQueue(); } } /** * This plugin creates an `onSelect` event that normalizes select events * across form elements. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - contentEditable * * This differs from native browser implementations in the following ways: * - Fires on contentEditable fields as well as inputs. * - Fires for collapsed selection. * - Fires after user input. */ var SelectEventPlugin = { eventTypes: eventTypes, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { switch (topLevelType) { // Track the input node that has focus. case topLevelTypes.topFocus: if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') { activeElement = topLevelTarget; activeElementID = topLevelTargetID; lastSelection = null; } break; case topLevelTypes.topBlur: activeElement = null; activeElementID = null; lastSelection = null; break; // Don't fire the event while the user is dragging. This matches the // semantics of the native select event. case topLevelTypes.topMouseDown: mouseDown = true; break; case topLevelTypes.topMouseUp: mouseDown = false; return constructSelectEvent(nativeEvent); // Chrome and IE fire non-standard event when selection is changed (and // sometimes when it hasn't). case topLevelTypes.topSelectionChange: return constructSelectEvent(nativeEvent); // Firefox doesn't support selectionchange, so check selection status // after each key entry. case topLevelTypes.topKeyDown: if (!useSelectionChange) { activeNativeEvent = nativeEvent; setTimeout(dispatchDeferredSelectEvent, 0); } break; } } }; module.exports = SelectEventPlugin; },{"./EventConstants":14,"./EventPluginHub":16,"./EventPropagators":19,"./ExecutionEnvironment":20,"./ReactInputSelection":46,"./SyntheticEvent":65,"./getActiveElement":88,"./isEventSupported":96,"./isTextInputElement":98,"./keyOf":102,"./shallowEqual":113}],62:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SimpleEventPlugin */ "use strict"; var EventConstants = require("./EventConstants"); var EventPropagators = require("./EventPropagators"); var SyntheticClipboardEvent = require("./SyntheticClipboardEvent"); var SyntheticEvent = require("./SyntheticEvent"); var SyntheticFocusEvent = require("./SyntheticFocusEvent"); var SyntheticKeyboardEvent = require("./SyntheticKeyboardEvent"); var SyntheticMouseEvent = require("./SyntheticMouseEvent"); var SyntheticTouchEvent = require("./SyntheticTouchEvent"); var SyntheticUIEvent = require("./SyntheticUIEvent"); var SyntheticWheelEvent = require("./SyntheticWheelEvent"); var invariant = require("./invariant"); var keyOf = require("./keyOf"); var topLevelTypes = EventConstants.topLevelTypes; var eventTypes = { blur: { phasedRegistrationNames: { bubbled: keyOf({onBlur: true}), captured: keyOf({onBlurCapture: true}) } }, click: { phasedRegistrationNames: { bubbled: keyOf({onClick: true}), captured: keyOf({onClickCapture: true}) } }, copy: { phasedRegistrationNames: { bubbled: keyOf({onCopy: true}), captured: keyOf({onCopyCapture: true}) } }, cut: { phasedRegistrationNames: { bubbled: keyOf({onCut: true}), captured: keyOf({onCutCapture: true}) } }, doubleClick: { phasedRegistrationNames: { bubbled: keyOf({onDoubleClick: true}), captured: keyOf({onDoubleClickCapture: true}) } }, drag: { phasedRegistrationNames: { bubbled: keyOf({onDrag: true}), captured: keyOf({onDragCapture: true}) } }, dragEnd: { phasedRegistrationNames: { bubbled: keyOf({onDragEnd: true}), captured: keyOf({onDragEndCapture: true}) } }, dragEnter: { phasedRegistrationNames: { bubbled: keyOf({onDragEnter: true}), captured: keyOf({onDragEnterCapture: true}) } }, dragExit: { phasedRegistrationNames: { bubbled: keyOf({onDragExit: true}), captured: keyOf({onDragExitCapture: true}) } }, dragLeave: { phasedRegistrationNames: { bubbled: keyOf({onDragLeave: true}), captured: keyOf({onDragLeaveCapture: true}) } }, dragOver: { phasedRegistrationNames: { bubbled: keyOf({onDragOver: true}), captured: keyOf({onDragOverCapture: true}) } }, dragStart: { phasedRegistrationNames: { bubbled: keyOf({onDragStart: true}), captured: keyOf({onDragStartCapture: true}) } }, drop: { phasedRegistrationNames: { bubbled: keyOf({onDrop: true}), captured: keyOf({onDropCapture: true}) } }, focus: { phasedRegistrationNames: { bubbled: keyOf({onFocus: true}), captured: keyOf({onFocusCapture: true}) } }, input: { phasedRegistrationNames: { bubbled: keyOf({onInput: true}), captured: keyOf({onInputCapture: true}) } }, keyDown: { phasedRegistrationNames: { bubbled: keyOf({onKeyDown: true}), captured: keyOf({onKeyDownCapture: true}) } }, keyPress: { phasedRegistrationNames: { bubbled: keyOf({onKeyPress: true}), captured: keyOf({onKeyPressCapture: true}) } }, keyUp: { phasedRegistrationNames: { bubbled: keyOf({onKeyUp: true}), captured: keyOf({onKeyUpCapture: true}) } }, // Note: We do not allow listening to mouseOver events. Instead, use the // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`. mouseDown: { phasedRegistrationNames: { bubbled: keyOf({onMouseDown: true}), captured: keyOf({onMouseDownCapture: true}) } }, mouseMove: { phasedRegistrationNames: { bubbled: keyOf({onMouseMove: true}), captured: keyOf({onMouseMoveCapture: true}) } }, mouseUp: { phasedRegistrationNames: { bubbled: keyOf({onMouseUp: true}), captured: keyOf({onMouseUpCapture: true}) } }, paste: { phasedRegistrationNames: { bubbled: keyOf({onPaste: true}), captured: keyOf({onPasteCapture: true}) } }, scroll: { phasedRegistrationNames: { bubbled: keyOf({onScroll: true}), captured: keyOf({onScrollCapture: true}) } }, submit: { phasedRegistrationNames: { bubbled: keyOf({onSubmit: true}), captured: keyOf({onSubmitCapture: true}) } }, touchCancel: { phasedRegistrationNames: { bubbled: keyOf({onTouchCancel: true}), captured: keyOf({onTouchCancelCapture: true}) } }, touchEnd: { phasedRegistrationNames: { bubbled: keyOf({onTouchEnd: true}), captured: keyOf({onTouchEndCapture: true}) } }, touchMove: { phasedRegistrationNames: { bubbled: keyOf({onTouchMove: true}), captured: keyOf({onTouchMoveCapture: true}) } }, touchStart: { phasedRegistrationNames: { bubbled: keyOf({onTouchStart: true}), captured: keyOf({onTouchStartCapture: true}) } }, wheel: { phasedRegistrationNames: { bubbled: keyOf({onWheel: true}), captured: keyOf({onWheelCapture: true}) } } }; var topLevelEventsToDispatchConfig = { topBlur: eventTypes.blur, topClick: eventTypes.click, topCopy: eventTypes.copy, topCut: eventTypes.cut, topDoubleClick: eventTypes.doubleClick, topDrag: eventTypes.drag, topDragEnd: eventTypes.dragEnd, topDragEnter: eventTypes.dragEnter, topDragExit: eventTypes.dragExit, topDragLeave: eventTypes.dragLeave, topDragOver: eventTypes.dragOver, topDragStart: eventTypes.dragStart, topDrop: eventTypes.drop, topFocus: eventTypes.focus, topInput: eventTypes.input, topKeyDown: eventTypes.keyDown, topKeyPress: eventTypes.keyPress, topKeyUp: eventTypes.keyUp, topMouseDown: eventTypes.mouseDown, topMouseMove: eventTypes.mouseMove, topMouseUp: eventTypes.mouseUp, topPaste: eventTypes.paste, topScroll: eventTypes.scroll, topSubmit: eventTypes.submit, topTouchCancel: eventTypes.touchCancel, topTouchEnd: eventTypes.touchEnd, topTouchMove: eventTypes.touchMove, topTouchStart: eventTypes.touchStart, topWheel: eventTypes.wheel }; var SimpleEventPlugin = { eventTypes: eventTypes, /** * Same as the default implementation, except cancels the event when return * value is false. * * @param {object} Event to be dispatched. * @param {function} Application-level callback. * @param {string} domID DOM ID to pass to the callback. */ executeDispatch: function(event, listener, domID) { var returnValue = listener(event, domID); if (returnValue === false) { event.stopPropagation(); event.preventDefault(); } }, /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) { var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; if (!dispatchConfig) { return null; } var EventConstructor; switch(topLevelType) { case topLevelTypes.topInput: case topLevelTypes.topSubmit: // HTML Events // @see http://www.w3.org/TR/html5/index.html#events-0 EventConstructor = SyntheticEvent; break; case topLevelTypes.topKeyDown: case topLevelTypes.topKeyPress: case topLevelTypes.topKeyUp: EventConstructor = SyntheticKeyboardEvent; break; case topLevelTypes.topBlur: case topLevelTypes.topFocus: EventConstructor = SyntheticFocusEvent; break; case topLevelTypes.topClick: // Firefox creates a click event on right mouse clicks. This removes the // unwanted click events. if (nativeEvent.button === 2) { return null; } /* falls through */ case topLevelTypes.topDoubleClick: case topLevelTypes.topDrag: case topLevelTypes.topDragEnd: case topLevelTypes.topDragEnter: case topLevelTypes.topDragExit: case topLevelTypes.topDragLeave: case topLevelTypes.topDragOver: case topLevelTypes.topDragStart: case topLevelTypes.topDrop: case topLevelTypes.topMouseDown: case topLevelTypes.topMouseMove: case topLevelTypes.topMouseUp: EventConstructor = SyntheticMouseEvent; break; case topLevelTypes.topTouchCancel: case topLevelTypes.topTouchEnd: case topLevelTypes.topTouchMove: case topLevelTypes.topTouchStart: EventConstructor = SyntheticTouchEvent; break; case topLevelTypes.topScroll: EventConstructor = SyntheticUIEvent; break; case topLevelTypes.topWheel: EventConstructor = SyntheticWheelEvent; break; case topLevelTypes.topCopy: case topLevelTypes.topCut: case topLevelTypes.topPaste: EventConstructor = SyntheticClipboardEvent; break; } invariant( EventConstructor, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType ); var event = EventConstructor.getPooled( dispatchConfig, topLevelTargetID, nativeEvent ); EventPropagators.accumulateTwoPhaseDispatches(event); return event; } }; module.exports = SimpleEventPlugin; },{"./EventConstants":14,"./EventPropagators":19,"./SyntheticClipboardEvent":63,"./SyntheticEvent":65,"./SyntheticFocusEvent":66,"./SyntheticKeyboardEvent":67,"./SyntheticMouseEvent":68,"./SyntheticTouchEvent":69,"./SyntheticUIEvent":70,"./SyntheticWheelEvent":71,"./invariant":95,"./keyOf":102}],63:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticClipboardEvent * @typechecks static-only */ "use strict"; var SyntheticEvent = require("./SyntheticEvent"); /** * @interface Event * @see http://www.w3.org/TR/clipboard-apis/ */ var ClipboardEventInterface = { clipboardData: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); module.exports = SyntheticClipboardEvent; },{"./SyntheticEvent":65}],64:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticCompositionEvent * @typechecks static-only */ "use strict"; var SyntheticEvent = require("./SyntheticEvent"); /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents */ var CompositionEventInterface = { data: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticCompositionEvent( dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass( SyntheticCompositionEvent, CompositionEventInterface ); module.exports = SyntheticCompositionEvent; },{"./SyntheticEvent":65}],65:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticEvent * @typechecks static-only */ "use strict"; var PooledClass = require("./PooledClass"); var emptyFunction = require("./emptyFunction"); var getEventTarget = require("./getEventTarget"); var merge = require("./merge"); var mergeInto = require("./mergeInto"); /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var EventInterface = { type: null, target: getEventTarget, currentTarget: null, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function(event) { return event.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; /** * Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. * * These systems should generally use pooling to reduce the frequency of garbage * collection. The system should check `isPersistent` to determine whether the * event should be released into the pool after being dispatched. Users that * need a persisted event should invoke `persist`. * * Synthetic events (and subclasses) implement the DOM Level 3 Events API by * normalizing browser quirks. Subclasses do not necessarily have to implement a * DOM interface; custom application-specific events can also subclass this. * * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. */ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) { this.dispatchConfig = dispatchConfig; this.dispatchMarker = dispatchMarker; this.nativeEvent = nativeEvent; var Interface = this.constructor.Interface; for (var propName in Interface) { if (!Interface.hasOwnProperty(propName)) { continue; } var normalize = Interface[propName]; if (normalize) { this[propName] = normalize(nativeEvent); } else { this[propName] = nativeEvent[propName]; } } if (nativeEvent.defaultPrevented || nativeEvent.returnValue === false) { this.isDefaultPrevented = emptyFunction.thatReturnsTrue; } else { this.isDefaultPrevented = emptyFunction.thatReturnsFalse; } this.isPropagationStopped = emptyFunction.thatReturnsFalse; } mergeInto(SyntheticEvent.prototype, { preventDefault: function() { this.defaultPrevented = true; var event = this.nativeEvent; event.preventDefault ? event.preventDefault() : event.returnValue = false; this.isDefaultPrevented = emptyFunction.thatReturnsTrue; }, stopPropagation: function() { var event = this.nativeEvent; event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; this.isPropagationStopped = emptyFunction.thatReturnsTrue; }, /** * We release all dispatched `SyntheticEvent`s after each event loop, adding * them back into the pool. This allows a way to hold onto a reference that * won't be added back into the pool. */ persist: function() { this.isPersistent = emptyFunction.thatReturnsTrue; }, /** * Checks if this event should be released back into the pool. * * @return {boolean} True if this should not be released, false otherwise. */ isPersistent: emptyFunction.thatReturnsFalse, /** * `PooledClass` looks for `destructor` on each instance it releases. */ destructor: function() { var Interface = this.constructor.Interface; for (var propName in Interface) { this[propName] = null; } this.dispatchConfig = null; this.dispatchMarker = null; this.nativeEvent = null; } }); SyntheticEvent.Interface = EventInterface; /** * Helper to reduce boilerplate when creating subclasses. * * @param {function} Class * @param {?object} Interface */ SyntheticEvent.augmentClass = function(Class, Interface) { var Super = this; var prototype = Object.create(Super.prototype); mergeInto(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; Class.Interface = merge(Super.Interface, Interface); Class.augmentClass = Super.augmentClass; PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler); }; PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler); module.exports = SyntheticEvent; },{"./PooledClass":23,"./emptyFunction":81,"./getEventTarget":89,"./merge":104,"./mergeInto":106}],66:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticFocusEvent * @typechecks static-only */ "use strict"; var SyntheticUIEvent = require("./SyntheticUIEvent"); /** * @interface FocusEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var FocusEventInterface = { relatedTarget: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); module.exports = SyntheticFocusEvent; },{"./SyntheticUIEvent":70}],67:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticKeyboardEvent * @typechecks static-only */ "use strict"; var SyntheticUIEvent = require("./SyntheticUIEvent"); /** * @interface KeyboardEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var KeyboardEventInterface = { 'char': null, key: null, location: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, repeat: null, locale: null, // Legacy Interface charCode: null, keyCode: null, which: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); module.exports = SyntheticKeyboardEvent; },{"./SyntheticUIEvent":70}],68:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticMouseEvent * @typechecks static-only */ "use strict"; var SyntheticUIEvent = require("./SyntheticUIEvent"); var ViewportMetrics = require("./ViewportMetrics"); /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var MouseEventInterface = { screenX: null, screenY: null, clientX: null, clientY: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, button: function(event) { // Webkit, Firefox, IE9+ // which: 1 2 3 // button: 0 1 2 (standard) var button = event.button; if ('which' in event) { return button; } // IE<9 // which: undefined // button: 0 0 0 // button: 1 4 2 (onmouseup) return button === 2 ? 2 : button === 4 ? 1 : 0; }, buttons: null, relatedTarget: function(event) { return event.relatedTarget || ( event.fromElement === event.srcElement ? event.toElement : event.fromElement ); }, // "Proprietary" Interface. pageX: function(event) { return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; }, pageY: function(event) { return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; } }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; },{"./SyntheticUIEvent":70,"./ViewportMetrics":73}],69:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticTouchEvent * @typechecks static-only */ "use strict"; var SyntheticUIEvent = require("./SyntheticUIEvent"); /** * @interface TouchEvent * @see http://www.w3.org/TR/touch-events/ */ var TouchEventInterface = { touches: null, targetTouches: null, changedTouches: null, altKey: null, metaKey: null, ctrlKey: null, shiftKey: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticUIEvent} */ function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); module.exports = SyntheticTouchEvent; },{"./SyntheticUIEvent":70}],70:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticUIEvent * @typechecks static-only */ "use strict"; var SyntheticEvent = require("./SyntheticEvent"); /** * @interface UIEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var UIEventInterface = { view: null, detail: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticEvent} */ function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; },{"./SyntheticEvent":65}],71:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule SyntheticWheelEvent * @typechecks static-only */ "use strict"; var SyntheticMouseEvent = require("./SyntheticMouseEvent"); /** * @interface WheelEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var WheelEventInterface = { deltaX: function(event) { // NOTE: IE<9 does not support x-axis delta. return ( 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 'wheelDeltaX' in event ? -event.wheelDeltaX : 0 ); }, deltaY: function(event) { return ( // Normalize (up is positive). 'deltaY' in event ? -event.deltaY : // Fallback to `wheelDeltaY` for Webkit. 'wheelDeltaY' in event ? event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9. 'wheelDelta' in event ? event.wheelData : 0 ); }, deltaZ: null, deltaMode: null }; /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @extends {SyntheticMouseEvent} */ function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) { SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent); } SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); module.exports = SyntheticWheelEvent; },{"./SyntheticMouseEvent":68}],72:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule Transaction */ "use strict"; var invariant = require("./invariant"); /** * `Transaction` creates a black box that is able to wrap any method such that * certain invariants are maintained before and after the method is invoked * (Even if an exception is thrown while invoking the wrapped method). Whoever * instantiates a transaction can provide enforcers of the invariants at * creation time. The `Transaction` class itself will supply one additional * automatic invariant for you - the invariant that any transaction instance * should not be ran while it is already being ran. You would typically create a * single instance of a `Transaction` for reuse multiple times, that potentially * is used to wrap several different methods. Wrappers are extremely simple - * they only require implementing two methods. * * <pre> * wrappers (injected at creation time) * + + * | | * +-----------------|--------|--------------+ * | v | | * | +---------------+ | | * | +--| wrapper1 |---|----+ | * | | +---------------+ v | | * | | +-------------+ | | * | | +----| wrapper2 |--------+ | * | | | +-------------+ | | | * | | | | | | * | v v v v | wrapper * | +---+ +---+ +---------+ +---+ +---+ | invariants * perform(anyMethod) | | | | | | | | | | | | maintained * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> * | | | | | | | | | | | | * | | | | | | | | | | | | * | | | | | | | | | | | | * | +---+ +---+ +---------+ +---+ +---+ | * | initialize close | * +-----------------------------------------+ * </pre> * * Bonus: * - Reports timing metrics by method name and wrapper index. * * Use cases: * - Preserving the input selection ranges before/after reconciliation. * Restoring selection even in the event of an unexpected error. * - Deactivating events while rearranging the DOM, preventing blurs/focuses, * while guaranteeing that afterwards, the event system is reactivated. * - Flushing a queue of collected DOM mutations to the main UI thread after a * reconciliation takes place in a worker thread. * - Invoking any collected `componentDidRender` callbacks after rendering new * content. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue * to preserve the `scrollTop` (an automatic scroll aware DOM). * - (Future use case): Layout calculations before and after DOM upates. * * Transactional plugin API: * - A module that has an `initialize` method that returns any precomputation. * - and a `close` method that accepts the precomputation. `close` is invoked * when the wrapped process is completed, or has failed. * * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules * that implement `initialize` and `close`. * @return {Transaction} Single transaction for reuse in thread. * * @class Transaction */ var Mixin = { /** * Sets up this instance so that it is prepared for collecting metrics. Does * so such that this setup method may be used on an instance that is already * initialized, in a way that does not consume additional memory upon reuse. * That can be useful if you decide to make your subclass of this mixin a * "PooledClass". */ reinitializeTransaction: function() { this.transactionWrappers = this.getTransactionWrappers(); if (!this.wrapperInitData) { this.wrapperInitData = []; } else { this.wrapperInitData.length = 0; } if (!this.timingMetrics) { this.timingMetrics = {}; } this.timingMetrics.methodInvocationTime = 0; if (!this.timingMetrics.wrapperInitTimes) { this.timingMetrics.wrapperInitTimes = []; } else { this.timingMetrics.wrapperInitTimes.length = 0; } if (!this.timingMetrics.wrapperCloseTimes) { this.timingMetrics.wrapperCloseTimes = []; } else { this.timingMetrics.wrapperCloseTimes.length = 0; } this._isInTransaction = false; }, _isInTransaction: false, /** * @abstract * @return {Array<TransactionWrapper>} Array of transaction wrappers. */ getTransactionWrappers: null, isInTransaction: function() { return !!this._isInTransaction; }, /** * Executes the function within a safety window. Use this for the top level * methods that result in large amounts of computation/mutations that would * need to be safety checked. * * @param {function} method Member of scope to call. * @param {Object} scope Scope to invoke from. * @param {Object?=} args... Arguments to pass to the method (optional). * Helps prevent need to bind in many cases. * @return Return value from `method`. */ perform: function(method, scope, a, b, c, d, e, f) { invariant( !this.isInTransaction(), 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.' ); var memberStart = Date.now(); var errorToThrow = null; var ret; try { this.initializeAll(); ret = method.call(scope, a, b, c, d, e, f); } catch (error) { // IE8 requires `catch` in order to use `finally`. errorToThrow = error; } finally { var memberEnd = Date.now(); this.methodInvocationTime += (memberEnd - memberStart); try { this.closeAll(); } catch (closeError) { // If `method` throws, prefer to show that stack trace over any thrown // by invoking `closeAll`. errorToThrow = errorToThrow || closeError; } } if (errorToThrow) { throw errorToThrow; } return ret; }, initializeAll: function() { this._isInTransaction = true; var transactionWrappers = this.transactionWrappers; var wrapperInitTimes = this.timingMetrics.wrapperInitTimes; var errorToThrow = null; for (var i = 0; i < transactionWrappers.length; i++) { var initStart = Date.now(); var wrapper = transactionWrappers[i]; try { this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; } catch (initError) { // Prefer to show the stack trace of the first error. errorToThrow = errorToThrow || initError; this.wrapperInitData[i] = Transaction.OBSERVED_ERROR; } finally { var curInitTime = wrapperInitTimes[i]; var initEnd = Date.now(); wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart); } } if (errorToThrow) { throw errorToThrow; } }, /** * Invokes each of `this.transactionWrappers.close[i]` functions, passing into * them the respective return values of `this.transactionWrappers.init[i]` * (`close`rs that correspond to initializers that failed will not be * invoked). */ closeAll: function() { invariant( this.isInTransaction(), 'Transaction.closeAll(): Cannot close transaction when none are open.' ); var transactionWrappers = this.transactionWrappers; var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes; var errorToThrow = null; for (var i = 0; i < transactionWrappers.length; i++) { var wrapper = transactionWrappers[i]; var closeStart = Date.now(); var initData = this.wrapperInitData[i]; try { if (initData !== Transaction.OBSERVED_ERROR) { wrapper.close && wrapper.close.call(this, initData); } } catch (closeError) { // Prefer to show the stack trace of the first error. errorToThrow = errorToThrow || closeError; } finally { var closeEnd = Date.now(); var curCloseTime = wrapperCloseTimes[i]; wrapperCloseTimes[i] = (curCloseTime || 0) + (closeEnd - closeStart); } } this.wrapperInitData.length = 0; this._isInTransaction = false; if (errorToThrow) { throw errorToThrow; } } }; var Transaction = { Mixin: Mixin, /** * Token to look for to determine if an error occured. */ OBSERVED_ERROR: {} }; module.exports = Transaction; },{"./invariant":95}],73:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ViewportMetrics */ "use strict"; var ViewportMetrics = { currentScrollLeft: 0, currentScrollTop: 0, refreshScrollValues: function() { ViewportMetrics.currentScrollLeft = document.body.scrollLeft + document.documentElement.scrollLeft; ViewportMetrics.currentScrollTop = document.body.scrollTop + document.documentElement.scrollTop; } }; module.exports = ViewportMetrics; },{}],74:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule accumulate */ "use strict"; var invariant = require("./invariant"); /** * Accumulates items that must not be null or undefined. * * This is used to conserve memory by avoiding array allocations. * * @return {*|array<*>} An accumulation of items. */ function accumulate(current, next) { invariant( next != null, 'accumulate(...): Accumulated items must be not be null or undefined.' ); if (current == null) { return next; } else { // Both are not empty. Warning: Never call x.concat(y) when you are not // certain that x is an Array (x could be a string with concat method). var currentIsArray = Array.isArray(current); var nextIsArray = Array.isArray(next); if (currentIsArray) { return current.concat(next); } else { if (nextIsArray) { return [current].concat(next); } else { return [current, next]; } } } } module.exports = accumulate; },{"./invariant":95}],75:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule adler32 */ /* jslint bitwise:true */ "use strict"; var MOD = 65521; // This is a clean-room implementation of adler32 designed for detecting // if markup is not what we expect it to be. It does not need to be // cryptographically strong, only reasonable good at detecting if markup // generated on the server is different than that on the client. function adler32(data) { var a = 1; var b = 0; for (var i = 0; i < data.length; i++) { a = (a + data.charCodeAt(i)) % MOD; b = (b + a) % MOD; } return a | (b << 16); } module.exports = adler32; },{}],76:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule copyProperties */ /** * Copy properties from one or more objects (up to 5) into the first object. * This is a shallow copy. It mutates the first object and also returns it. * * NOTE: `arguments` has a very significant performance penalty, which is why * we don't support unlimited arguments. */ function copyProperties(obj, a, b, c, d, e, f) { obj = obj || {}; if (true) { if (f) { throw new Error('Too many arguments passed to copyProperties'); } } var args = [a, b, c, d, e]; var ii = 0, v; while (args[ii]) { v = args[ii++]; for (var k in v) { obj[k] = v[k]; } // IE ignores toString in object iteration.. See: // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html if (v.hasOwnProperty && v.hasOwnProperty('toString') && (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { obj.toString = v.toString; } } return obj; } module.exports = copyProperties; },{}],77:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule createArrayFrom * @typechecks */ /** * NOTE: if you are a previous user of this function, it has been considered * unsafe because it's inconsistent across browsers for some inputs. * Instead use `Array.isArray()`. * * Perform a heuristic test to determine if an object is "array-like". * * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" * Joshu replied: "Mu." * * This function determines if its argument has "array nature": it returns * true if the argument is an actual array, an `arguments' object, or an * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). * * @param {*} obj * @return {boolean} */ function hasArrayNature(obj) { return ( // not null/false !!obj && // arrays are objects, NodeLists are functions in Safari (typeof obj == 'object' || typeof obj == 'function') && // quacks like an array ('length' in obj) && // not window !('setInterval' in obj) && // no DOM node should be considered an array-like // a 'select' element has 'length' and 'item' properties on IE8 (typeof obj.nodeType != 'number') && ( // a real array (// HTMLCollection/NodeList (Array.isArray(obj) || // arguments ('callee' in obj) || 'item' in obj)) ) ); } /** * Ensure that the argument is an array by wrapping it in an array if it is not. * Creates a copy of the argument if it is already an array. * * This is mostly useful idiomatically: * * var createArrayFrom = require('createArrayFrom'); * * function takesOneOrMoreThings(things) { * things = createArrayFrom(things); * ... * } * * This allows you to treat `things' as an array, but accept scalars in the API. * * This is also good for converting certain pseudo-arrays, like `arguments` or * HTMLCollections, into arrays. * * @param {*} obj * @return {array} */ function createArrayFrom(obj) { if (!hasArrayNature(obj)) { return [obj]; } if (obj.item) { // IE does not support Array#slice on HTMLCollections var l = obj.length, ret = new Array(l); while (l--) { ret[l] = obj[l]; } return ret; } return Array.prototype.slice.call(obj); } module.exports = createArrayFrom; },{}],78:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule createNodesFromMarkup * @typechecks */ /*jslint evil: true, sub: true */ var ExecutionEnvironment = require("./ExecutionEnvironment"); var createArrayFrom = require("./createArrayFrom"); var getMarkupWrap = require("./getMarkupWrap"); var invariant = require("./invariant"); /** * Dummy container used to render all markup. */ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; /** * Pattern used by `getNodeName`. */ var nodeNamePattern = /^\s*<(\w+)/; /** * Extracts the `nodeName` of the first element in a string of markup. * * @param {string} markup String of markup. * @return {?string} Node name of the supplied markup. */ function getNodeName(markup) { var nodeNameMatch = markup.match(nodeNamePattern); return nodeNameMatch && nodeNameMatch[1].toLowerCase(); } /** * Creates an array containing the nodes rendered from the supplied markup. The * optionally supplied `handleScript` function will be invoked once for each * <script> element that is rendered. If no `handleScript` function is supplied, * an exception is thrown if any <script> elements are rendered. * * @param {string} markup A string of valid HTML markup. * @param {?function} handleScript Invoked once for each rendered <script>. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. */ function createNodesFromMarkup(markup, handleScript) { var node = dummyNode; invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized'); var nodeName = getNodeName(markup); var wrap = nodeName && getMarkupWrap(nodeName); if (wrap) { node.innerHTML = wrap[1] + markup + wrap[2]; var wrapDepth = wrap[0]; while (wrapDepth--) { node = node.lastChild; } } else { node.innerHTML = markup; } var scripts = node.getElementsByTagName('script'); if (scripts.length) { invariant( handleScript, 'createNodesFromMarkup(...): Unexpected <script> element rendered.' ); createArrayFrom(scripts).forEach(handleScript); } var nodes = createArrayFrom(node.childNodes); while (node.lastChild) { node.removeChild(node.lastChild); } return nodes; } module.exports = createNodesFromMarkup; },{"./ExecutionEnvironment":20,"./createArrayFrom":77,"./getMarkupWrap":90,"./invariant":95}],79:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule createObjectFrom */ /** * Construct an object from an array of keys * and optionally specified value or list of values. * * >>> createObjectFrom(['a','b','c']); * {a: true, b: true, c: true} * * >>> createObjectFrom(['a','b','c'], false); * {a: false, b: false, c: false} * * >>> createObjectFrom(['a','b','c'], 'monkey'); * {c:'monkey', b:'monkey' c:'monkey'} * * >>> createObjectFrom(['a','b','c'], [1,2,3]); * {a: 1, b: 2, c: 3} * * >>> createObjectFrom(['women', 'men'], [true, false]); * {women: true, men: false} * * @param Array list of keys * @param mixed optional value or value array. defaults true. * @returns object */ function createObjectFrom(keys, values /* = true */) { if (true) { if (!Array.isArray(keys)) { throw new TypeError('Must pass an array of keys.'); } } var object = {}; var isArray = Array.isArray(values); if (typeof values == 'undefined') { values = true; } for (var ii = keys.length; ii--;) { object[keys[ii]] = isArray ? values[ii] : values; } return object; } module.exports = createObjectFrom; },{}],80:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule dangerousStyleValue * @typechecks static-only */ "use strict"; var CSSProperty = require("./CSSProperty"); /** * Convert a value into the proper css writable value. The `styleName` name * name should be logical (no hyphens), as specified * in `CSSProperty.isUnitlessNumber`. * * @param {string} styleName CSS property name such as `topMargin`. * @param {*} value CSS property value such as `10px`. * @return {string} Normalized style value with dimensions applied. */ function dangerousStyleValue(styleName, value) { // Note that we've removed escapeTextForBrowser() calls here since the // whole string will be escaped when the attribute is injected into // the markup. If you provide unsafe user data here they can inject // arbitrary CSS which may be problematic (I couldn't repro this): // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ // This is not an XSS hole but instead a potential CSS injection issue // which has lead to a greater discussion about how we're going to // trust URLs moving forward. See #2115901 var isEmpty = value == null || typeof value === 'boolean' || value === ''; if (isEmpty) { return ''; } var isNonNumeric = isNaN(value); if (isNonNumeric || value === 0 || CSSProperty.isUnitlessNumber[styleName]) { return '' + value; // cast to string } return value + 'px'; } module.exports = dangerousStyleValue; },{"./CSSProperty":2}],81:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule emptyFunction */ var copyProperties = require("./copyProperties"); function makeEmptyFunction(arg) { return function() { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ function emptyFunction() {} copyProperties(emptyFunction, { thatReturns: makeEmptyFunction, thatReturnsFalse: makeEmptyFunction(false), thatReturnsTrue: makeEmptyFunction(true), thatReturnsNull: makeEmptyFunction(null), thatReturnsThis: function() { return this; }, thatReturnsArgument: function(arg) { return arg; } }); module.exports = emptyFunction; },{"./copyProperties":76}],82:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule escapeTextForBrowser * @typechecks static-only */ "use strict"; var ESCAPE_LOOKUP = { "&": "&amp;", ">": "&gt;", "<": "&lt;", "\"": "&quot;", "'": "&#x27;", "/": "&#x2f;" }; var ESCAPE_REGEX = /[&><"'\/]/g; function escaper(match) { return ESCAPE_LOOKUP[match]; } /** * Escapes text to prevent scripting attacks. * * @param {*} text Text value to escape. * @return {string} An escaped string. */ function escapeTextForBrowser(text) { return ('' + text).replace(ESCAPE_REGEX, escaper); } module.exports = escapeTextForBrowser; },{}],83:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ex * @typechecks * @nostacktrace */ /** * This function transforms error message with arguments into plain text error * message, so that it can be passed to window.onerror without losing anything. * It can then be transformed back by `erx()` function. * * Usage: * throw new Error(ex('Error %s from %s', errorCode, userID)); * * @param {string} errorMessage */ var ex = function(errorMessage/*, arg1, arg2, ...*/) { var args = Array.prototype.slice.call(arguments).map(function(arg) { return String(arg); }); var expectedLength = errorMessage.split('%s').length - 1; if (expectedLength !== args.length - 1) { // something wrong with the formatting string return ex('ex args number mismatch: %s', JSON.stringify(args)); } return ex._prefix + JSON.stringify(args) + ex._suffix; }; ex._prefix = '<![EX['; ex._suffix = ']]>'; module.exports = ex; },{}],84:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule filterAttributes * @typechecks static-only */ /*jslint evil: true */ 'use strict'; /** * Like filter(), but for a DOM nodes attributes. Returns an array of * the filter DOMAttribute objects. Does some perf related this like * caching attributes.length. * * @param {DOMElement} node Node whose attributes you want to filter * @return {array} array of DOM attribute objects. */ function filterAttributes(node, func, context) { var attributes = node.attributes; var numAttributes = attributes.length; var accumulator = []; for (var i = 0; i < numAttributes; i++) { var attr = attributes.item(i); if (func.call(context, attr)) { accumulator.push(attr); } } return accumulator; } module.exports = filterAttributes; },{}],85:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule flattenChildren */ "use strict"; var invariant = require("./invariant"); var traverseAllChildren = require("./traverseAllChildren"); /** * @param {function} traverseContext Context passed through traversal. * @param {?ReactComponent} child React child component. * @param {!string} name String name of key path to child. */ function flattenSingleChildIntoContext(traverseContext, child, name) { // We found a component instance. var result = traverseContext; invariant( !result.hasOwnProperty(name), 'flattenChildren(...): Encountered two children with the same key, `%s`. ' + 'Children keys must be unique.', name ); result[name] = child; } /** * Flattens children that are typically specified as `props.children`. * @return {!object} flattened children keyed by name. */ function flattenChildren(children) { if (children == null) { return children; } var result = {}; traverseAllChildren(children, flattenSingleChildIntoContext, result); return result; } module.exports = flattenChildren; },{"./invariant":95,"./traverseAllChildren":114}],86:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule forEachAccumulated */ "use strict"; /** * @param {array} an "accumulation" of items which is either an Array or * a single item. Useful when paired with the `accumulate` module. This is a * simple utility that allows us to reason about a collection of items, but * handling the case when there is exactly one item (and we do not need to * allocate an array). */ var forEachAccumulated = function(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); } }; module.exports = forEachAccumulated; },{}],87:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ge */ /** * Find a node by ID. Optionally search a sub-tree outside of the document * * Use ge if you're not sure whether or not the element exists. You can test * for existence yourself in your application code. * * If your application code depends on the existence of the element, use $ * instead, which will throw in DEV if the element doesn't exist. */ function ge(arg, root, tag) { return typeof arg != 'string' ? arg : !root ? document.getElementById(arg) : _geFromSubtree(arg, root, tag); } function _geFromSubtree(id, root, tag) { var elem, children, ii; if (_getNodeID(root) == id) { return root; } else if (root.getElementsByTagName) { // All Elements implement this, which does an iterative DFS, which is // faster than recursion and doesn't run into stack depth issues. children = root.getElementsByTagName(tag || '*'); for (ii = 0; ii < children.length; ii++) { if (_getNodeID(children[ii]) == id) { return children[ii]; } } } else { // DocumentFragment does not implement getElementsByTagName, so // recurse over its children. Its children must be Elements, so // each child will use the getElementsByTagName case instead. children = root.childNodes; for (ii = 0; ii < children.length; ii++) { elem = _geFromSubtree(id, children[ii]); if (elem) { return elem; } } } return null; } /** * Return the ID value for a given node. This allows us to avoid issues * with forms that contain inputs with name="id". * * @return string (null if attribute not set) */ function _getNodeID(node) { // #document and #document-fragment do not have getAttributeNode. var id = node.getAttributeNode && node.getAttributeNode('id'); return id ? id.value : null; } module.exports = ge; },{}],88:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getActiveElement * @typechecks */ /** * Same as document.activeElement but wraps in a try-catch block. In IE it is * not safe to call document.activeElement if there is nothing focused. */ function getActiveElement() /*?DOMElement*/ { try { return document.activeElement; } catch (e) { return null; } } module.exports = getActiveElement; },{}],89:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getEventTarget * @typechecks static-only */ "use strict"; /** * Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. * * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node. */ function getEventTarget(nativeEvent) { var target = nativeEvent.target || nativeEvent.srcElement || window; // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @see http://www.quirksmode.org/js/events_properties.html return target.nodeType === 3 ? target.parentNode : target; } module.exports = getEventTarget; },{}],90:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getMarkupWrap */ var ExecutionEnvironment = require("./ExecutionEnvironment"); var invariant = require("./invariant"); /** * Dummy container used to detect which wraps are necessary. */ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; /** * Some browsers cannot use `innerHTML` to render certain elements standalone, * so we wrap them, render the wrapped nodes, then extract the desired node. * * In IE8, certain elements cannot render alone, so wrap all elements ('*'). */ var shouldWrap = { // Force wrapping for SVG elements because if they get created inside a <div>, // they will be initialized in the wrong namespace (and will not display). 'circle': true, 'g': true, 'line': true, 'path': true, 'polyline': true, 'rect': true, 'text': true }; var selectWrap = [1, '<select multiple="true">', '</select>']; var tableWrap = [1, '<table>', '</table>']; var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; var svgWrap = [1, '<svg>', '</svg>']; var markupWrap = { '*': [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': selectWrap, 'option': selectWrap, 'caption': tableWrap, 'colgroup': tableWrap, 'tbody': tableWrap, 'tfoot': tableWrap, 'thead': tableWrap, 'td': trWrap, 'th': trWrap, 'circle': svgWrap, 'g': svgWrap, 'line': svgWrap, 'path': svgWrap, 'polyline': svgWrap, 'rect': svgWrap, 'text': svgWrap }; /** * Gets the markup wrap configuration for the supplied `nodeName`. * * NOTE: This lazily detects which wraps are necessary for the current browser. * * @param {string} nodeName Lowercase `nodeName`. * @return {?array} Markup wrap configuration, if applicable. */ function getMarkupWrap(nodeName) { invariant(!!dummyNode, 'Markup wrapping node not initialized'); if (!markupWrap.hasOwnProperty(nodeName)) { nodeName = '*'; } if (!shouldWrap.hasOwnProperty(nodeName)) { if (nodeName === '*') { dummyNode.innerHTML = '<link />'; } else { dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; } shouldWrap[nodeName] = !dummyNode.firstChild; } return shouldWrap[nodeName] ? markupWrap[nodeName] : null; } module.exports = getMarkupWrap; },{"./ExecutionEnvironment":20,"./invariant":95}],91:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getNodeForCharacterOffset */ "use strict"; /** * Given any node return the first leaf node without children. * * @param {DOMElement|DOMTextNode} node * @return {DOMElement|DOMTextNode} */ function getLeafNode(node) { while (node && node.firstChild) { node = node.firstChild; } return node; } /** * Get the next sibling within a container. This will walk up the * DOM if a node's siblings have been exhausted. * * @param {DOMElement|DOMTextNode} node * @return {?DOMElement|DOMTextNode} */ function getSiblingNode(node) { while (node) { if (node.nextSibling) { return node.nextSibling; } node = node.parentNode; } } /** * Get object describing the nodes which contain characters at offset. * * @param {DOMElement|DOMTextNode} root * @param {number} offset * @return {?object} */ function getNodeForCharacterOffset(root, offset) { var node = getLeafNode(root); var nodeStart = 0; var nodeEnd = 0; while (node) { if (node.nodeType == 3) { nodeEnd = nodeStart + node.textContent.length; if (nodeStart <= offset && nodeEnd >= offset) { return { node: node, offset: offset - nodeStart }; } nodeStart = nodeEnd; } node = getLeafNode(getSiblingNode(node)); } } module.exports = getNodeForCharacterOffset; },{}],92:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getReactRootElementInContainer */ "use strict"; var DOC_NODE_TYPE = 9; /** * @param {DOMElement|DOMDocument} container DOM element that may contain * a React component * @return {?*} DOM element that may have the reactRoot ID, or null. */ function getReactRootElementInContainer(container) { if (!container) { return null; } if (container.nodeType === DOC_NODE_TYPE) { return container.documentElement; } else { return container.firstChild; } } module.exports = getReactRootElementInContainer; },{}],93:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule getTextContentAccessor */ "use strict"; var ExecutionEnvironment = require("./ExecutionEnvironment"); var contentKey = null; /** * Gets the key used to access text content on a DOM node. * * @return {?string} Key used to access text content. * @internal */ function getTextContentAccessor() { if (!contentKey && ExecutionEnvironment.canUseDOM) { contentKey = 'innerText' in document.createElement('div') ? 'innerText' : 'textContent'; } return contentKey; } module.exports = getTextContentAccessor; },{"./ExecutionEnvironment":20}],94:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule hyphenate * @typechecks */ var _uppercasePattern = /([A-Z])/g; /** * Hyphenates a camelcased string, for example: * * > hyphenate('backgroundColor') * < "background-color" * * @param {string} string * @return {string} */ function hyphenate(string) { return string.replace(_uppercasePattern, '-$1').toLowerCase(); } module.exports = hyphenate; },{}],95:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule invariant */ /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf style format 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) { if (!condition) { throw new Error('Invariant Violation'); } } module.exports = invariant; if (true) { var invariantDev = function(condition, format, a, b, c, d, e, f) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } if (!condition) { var args = [a, b, c, d, e, f]; var argIndex = 0; throw new Error( 'Invariant Violation: ' + format.replace(/%s/g, function() { return args[argIndex++]; }) ); } }; module.exports = invariantDev; } },{}],96:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isEventSupported */ "use strict"; var ExecutionEnvironment = require("./ExecutionEnvironment"); var testNode, useHasFeature; if (ExecutionEnvironment.canUseDOM) { testNode = document.createElement('div'); useHasFeature = document.implementation && document.implementation.hasFeature && // `hasFeature` always returns true in Firefox 19+. document.implementation.hasFeature('', '') !== true; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @param {?boolean} capture Check if the capture phase is supported. * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix, capture) { if (!testNode || (capture && !testNode.addEventListener)) { return false; } var element = document.createElement('div'); var eventName = 'on' + eventNameSuffix; var isSupported = eventName in element; if (!isSupported) { element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; if (typeof element[eventName] !== 'undefined') { element[eventName] = undefined; } element.removeAttribute(eventName); } if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { // This is the only way to test support for the `wheel` event in IE9+. isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } element = null; return isSupported; } module.exports = isEventSupported; },{"./ExecutionEnvironment":20}],97:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isNode * @typechecks */ /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM node. */ function isNode(object) { return !!(object && ( typeof Node !== 'undefined' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string' )); } module.exports = isNode; },{}],98:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isTextInputElement */ "use strict"; /** * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary */ var supportedInputTypes = { 'color': true, 'date': true, 'datetime': true, 'datetime-local': true, 'email': true, 'month': true, 'number': true, 'password': true, 'range': true, 'search': true, 'tel': true, 'text': true, 'time': true, 'url': true, 'week': true }; function isTextInputElement(elem) { return elem && ( (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type]) || elem.nodeName === 'TEXTAREA' ); } module.exports = isTextInputElement; },{}],99:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isTextNode * @typechecks */ var isNode = require("./isNode"); /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM text node. */ function isTextNode(object) { return isNode(object) && object.nodeType == 3; } module.exports = isTextNode; },{"./isNode":97}],100:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule joinClasses * @typechecks static-only */ "use strict"; /** * Combines multiple className strings into one. * http://jsperf.com/joinclasses-args-vs-array * * @param {...?string} classes * @return {string} */ function joinClasses(className/*, ... */) { if (!className) { className = ''; } var nextClass; var argLength = arguments.length; if (argLength > 1) { for (var ii = 1; ii < argLength; ii++) { nextClass = arguments[ii]; nextClass && (className += ' ' + nextClass); } } return className; } module.exports = joinClasses; },{}],101:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule keyMirror * @typechecks static-only */ "use strict"; var invariant = require("./invariant"); /** * 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; invariant( obj instanceof Object && !Array.isArray(obj), 'keyMirror(...): Argument must be an object.' ); for (key in obj) { if (!obj.hasOwnProperty(key)) { continue; } ret[key] = key; } return ret; }; module.exports = keyMirror; },{"./invariant":95}],102:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule keyOf */ /** * Allows extraction of a minified key. Let's the build system minify keys * without loosing the ability to dynamically use key strings as values * themselves. Pass in an object with a single key/val pair and it will return * you the string key of that single record. Suppose you want to grab the * value for a key 'className' inside of an object. Key/val minification may * have aliased that key to be 'xa12'. keyOf({className: null}) will return * 'xa12' in that case. Resolve keys you want to use once at startup time, then * reuse those resolutions. */ var keyOf = function(oneKeyObj) { var key; for (key in oneKeyObj) { if (!oneKeyObj.hasOwnProperty(key)) { continue; } return key; } return null; }; module.exports = keyOf; },{}],103:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule memoizeStringOnly * @typechecks static-only */ "use strict"; /** * Memoizes the return value of a function that accepts one string argument. * * @param {function} callback * @return {function} */ function memoizeStringOnly(callback) { var cache = {}; return function(string) { if (cache.hasOwnProperty(string)) { return cache[string]; } else { return cache[string] = callback.call(this, string); } }; } module.exports = memoizeStringOnly; },{}],104:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule merge */ "use strict"; var mergeInto = require("./mergeInto"); /** * Shallow merges two structures into a return value, without mutating either. * * @param {?object} one Optional object with properties to merge from. * @param {?object} two Optional object with properties to merge from. * @return {object} The shallow extension of one by two. */ var merge = function(one, two) { var result = {}; mergeInto(result, one); mergeInto(result, two); return result; }; module.exports = merge; },{"./mergeInto":106}],105:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mergeHelpers * * requiresPolyfills: Array.isArray */ "use strict"; var invariant = require("./invariant"); var keyMirror = require("./keyMirror"); /** * Maximum number of levels to traverse. Will catch circular structures. * @const */ var MAX_MERGE_DEPTH = 36; /** * We won't worry about edge cases like new String('x') or new Boolean(true). * Functions are considered terminals, and arrays are not. * @param {*} o The item/object/value to test. * @return {boolean} true iff the argument is a terminal. */ var isTerminal = function(o) { return typeof o !== 'object' || o === null; }; var mergeHelpers = { MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, isTerminal: isTerminal, /** * Converts null/undefined values into empty object. * * @param {?Object=} arg Argument to be normalized (nullable optional) * @return {!Object} */ normalizeMergeArg: function(arg) { return arg === undefined || arg === null ? {} : arg; }, /** * If merging Arrays, a merge strategy *must* be supplied. If not, it is * likely the caller's fault. If this function is ever called with anything * but `one` and `two` being `Array`s, it is the fault of the merge utilities. * * @param {*} one Array to merge into. * @param {*} two Array to merge from. */ checkMergeArrayArgs: function(one, two) { invariant( Array.isArray(one) && Array.isArray(two), 'Critical assumptions about the merge functions have been violated. ' + 'This is the fault of the merge functions themselves, not necessarily ' + 'the callers.' ); }, /** * @param {*} one Object to merge into. * @param {*} two Object to merge from. */ checkMergeObjectArgs: function(one, two) { mergeHelpers.checkMergeObjectArg(one); mergeHelpers.checkMergeObjectArg(two); }, /** * @param {*} arg */ checkMergeObjectArg: function(arg) { invariant( !isTerminal(arg) && !Array.isArray(arg), 'Critical assumptions about the merge functions have been violated. ' + 'This is the fault of the merge functions themselves, not necessarily ' + 'the callers.' ); }, /** * Checks that a merge was not given a circular object or an object that had * too great of depth. * * @param {number} Level of recursion to validate against maximum. */ checkMergeLevel: function(level) { invariant( level < MAX_MERGE_DEPTH, 'Maximum deep merge depth exceeded. You may be attempting to merge ' + 'circular structures in an unsupported way.' ); }, /** * Checks that the supplied merge strategy is valid. * * @param {string} Array merge strategy. */ checkArrayStrategy: function(strategy) { invariant( strategy === undefined || strategy in mergeHelpers.ArrayStrategies, 'You must provide an array strategy to deep merge functions to ' + 'instruct the deep merge how to resolve merging two arrays.' ); }, /** * Set of possible behaviors of merge algorithms when encountering two Arrays * that must be merged together. * - `clobber`: The left `Array` is ignored. * - `indexByIndex`: The result is achieved by recursively deep merging at * each index. (not yet supported.) */ ArrayStrategies: keyMirror({ Clobber: true, IndexByIndex: true }) }; module.exports = mergeHelpers; },{"./invariant":95,"./keyMirror":101}],106:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mergeInto * @typechecks static-only */ "use strict"; var mergeHelpers = require("./mergeHelpers"); var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; /** * Shallow merges two structures by mutating the first parameter. * * @param {object} one Object to be merged into. * @param {?object} two Optional object with properties to merge from. */ function mergeInto(one, two) { checkMergeObjectArg(one); if (two != null) { checkMergeObjectArg(two); for (var key in two) { if (!two.hasOwnProperty(key)) { continue; } one[key] = two[key]; } } } module.exports = mergeInto; },{"./mergeHelpers":105}],107:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mixInto */ "use strict"; /** * Simply copies properties to the prototype. */ var mixInto = function(constructor, methodBag) { var methodName; for (methodName in methodBag) { if (!methodBag.hasOwnProperty(methodName)) { continue; } constructor.prototype[methodName] = methodBag[methodName]; } }; module.exports = mixInto; },{}],108:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mutateHTMLNodeWithMarkup * @typechecks static-only */ /*jslint evil: true */ 'use strict'; var createNodesFromMarkup = require("./createNodesFromMarkup"); var filterAttributes = require("./filterAttributes"); var invariant = require("./invariant"); /** * You can't set the innerHTML of a document. Unless you have * this function. * * @param {DOMElement} node with tagName == 'html' * @param {string} markup markup string including <html>. */ function mutateHTMLNodeWithMarkup(node, markup) { invariant( node.tagName.toLowerCase() === 'html', 'mutateHTMLNodeWithMarkup(): node must have tagName of "html", got %s', node.tagName ); markup = markup.trim(); invariant( markup.toLowerCase().indexOf('<html') === 0, 'mutateHTMLNodeWithMarkup(): markup must start with <html' ); // First let's extract the various pieces of markup. var htmlOpenTagEnd = markup.indexOf('>') + 1; var htmlCloseTagStart = markup.lastIndexOf('<'); var htmlOpenTag = markup.substring(0, htmlOpenTagEnd); var innerHTML = markup.substring(htmlOpenTagEnd, htmlCloseTagStart); // Now for the fun stuff. Pass through both sets of attributes and // bring them up-to-date. We get the new set by creating a markup // fragment. var shouldExtractAttributes = htmlOpenTag.indexOf(' ') > -1; var attributeHolder = null; if (shouldExtractAttributes) { // We extract the attributes by creating a <span> and evaluating // the node. attributeHolder = createNodesFromMarkup( htmlOpenTag.replace('html ', 'span ') + '</span>' )[0]; // Add all attributes present in attributeHolder var attributesToSet = filterAttributes( attributeHolder, function(attr) { return node.getAttributeNS(attr.namespaceURI, attr.name) !== attr.value; } ); attributesToSet.forEach(function(attr) { node.setAttributeNS(attr.namespaceURI, attr.name, attr.value); }); } // Remove all attributes not present in attributeHolder var attributesToRemove = filterAttributes( node, function(attr) { // Remove all attributes if attributeHolder is null or if it does not have // the desired attribute. return !( attributeHolder && attributeHolder.hasAttributeNS(attr.namespaceURI, attr.name) ); } ); attributesToRemove.forEach(function(attr) { node.removeAttributeNS(attr.namespaceURI, attr.name); }); // Finally, set the inner HTML. No tricks needed. Do this last to // minimize likelihood of triggering reflows. node.innerHTML = innerHTML; } module.exports = mutateHTMLNodeWithMarkup; },{"./createNodesFromMarkup":78,"./filterAttributes":84,"./invariant":95}],109:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule nodeContains * @typechecks */ var isTextNode = require("./isTextNode"); /*jslint bitwise:true */ /** * Checks if a given DOM node contains or is another DOM node. * * @param {?DOMNode} outerNode Outer DOM node. * @param {?DOMNode} innerNode Inner DOM node. * @return {boolean} True if `outerNode` contains or is `innerNode`. */ function nodeContains(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return nodeContains(outerNode, innerNode.parentNode); } else if (outerNode.contains) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } module.exports = nodeContains; },{"./isTextNode":99}],110:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule objMap */ "use strict"; /** * For each key/value pair, invokes callback func and constructs a resulting * object which contains, for every key in obj, values that are the result of * of invoking the function: * * func(value, key, iteration) * * @param {?object} obj Object to map keys over * @param {function} func Invoked for each key/val pair. * @param {?*} context * @return {?object} Result of mapping or null if obj is falsey */ function objMap(obj, func, context) { if (!obj) { return null; } var i = 0; var ret = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { ret[key] = func.call(context, obj[key], key, i++); } } return ret; } module.exports = objMap; },{}],111:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule objMapKeyVal */ "use strict"; /** * Behaves the same as `objMap` but invokes func with the key first, and value * second. Use `objMap` unless you need this special case. * Invokes func as: * * func(key, value, iteration) * * @param {?object} obj Object to map keys over * @param {!function} func Invoked for each key/val pair. * @param {?*} context * @return {?object} Result of mapping or null if obj is falsey */ function objMapKeyVal(obj, func, context) { if (!obj) { return null; } var i = 0; var ret = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { ret[key] = func.call(context, key, obj[key], i++); } } return ret; } module.exports = objMapKeyVal; },{}],112:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule performanceNow * @typechecks static-only */ "use strict"; var ExecutionEnvironment = require("./ExecutionEnvironment"); /** * Detect if we can use window.performance.now() and gracefully * fallback to Date.now() if it doesn't exist. * We need to support Firefox < 15 for now due to Facebook's webdriver * infrastructure. */ var performance = null; if (ExecutionEnvironment.canUseDOM) { performance = window.performance || window.webkitPerformance; } if (!performance || !performance.now) { performance = Date; } var performanceNow = performance.now.bind(performance); module.exports = performanceNow; },{"./ExecutionEnvironment":20}],113:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule shallowEqual */ "use strict"; /** * Performs equality by iterating through keys on an object and returning * false when any key has values which are not strictly equal between * objA and objB. Returns true when the values of all keys are strictly equal. * * @return {boolean} */ function shallowEqual(objA, objB) { if (objA === objB) { return true; } var key; // Test for A's keys different from B. for (key in objA) { if (objA.hasOwnProperty(key) && (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) { return false; } } // Test for B'a keys missing from A. for (key in objB) { if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { return false; } } return true; } module.exports = shallowEqual; },{}],114:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule traverseAllChildren */ "use strict"; var ReactComponent = require("./ReactComponent"); var ReactTextComponent = require("./ReactTextComponent"); var invariant = require("./invariant"); /** * TODO: Test that: * 1. `mapChildren` transforms strings and numbers into `ReactTextComponent`. * 2. it('should fail when supplied duplicate key', function() { * 3. That a single child and an array with one item have the same key pattern. * }); */ /** * @param {?*} children Children tree container. * @param {!string} nameSoFar Name of the key path so far. * @param {!number} indexSoFar Number of children encountered until this point. * @param {!function} callback Callback to invoke with each child found. * @param {?*} traverseContext Used to pass information throughout the traversal * process. * @return {!number} The number of children in this subtree. */ var traverseAllChildrenImpl = function(children, nameSoFar, indexSoFar, callback, traverseContext) { var subtreeCount = 0; // Count of children found in the current subtree. if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { var child = children[i]; var nextName = nameSoFar + ReactComponent.getKey(child, i); var nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, nextIndex, callback, traverseContext ); } } else { var type = typeof children; var isOnlyChild = nameSoFar === ''; // If it's the only child, treat the name as if it was wrapped in an array // so that it's consistent if the number of children grows var storageName = isOnlyChild ? ReactComponent.getKey(children, 0): nameSoFar; if (children === null || children === undefined || type === 'boolean') { // All of the above are perceived as null. callback(traverseContext, null, storageName, indexSoFar); subtreeCount = 1; } else if (children.mountComponentIntoNode) { callback(traverseContext, children, storageName, indexSoFar); subtreeCount = 1; } else { if (type === 'object') { invariant( !children || children.nodeType !== 1, 'traverseAllChildren(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.' ); for (var key in children) { if (children.hasOwnProperty(key)) { subtreeCount += traverseAllChildrenImpl( children[key], nameSoFar + '{' + key + '}', indexSoFar + subtreeCount, callback, traverseContext ); } } } else if (type === 'string') { var normalizedText = new ReactTextComponent(children); callback(traverseContext, normalizedText, storageName, indexSoFar); subtreeCount += 1; } else if (type === 'number') { var normalizedNumber = new ReactTextComponent('' + children); callback(traverseContext, normalizedNumber, storageName, indexSoFar); subtreeCount += 1; } } } return subtreeCount; }; /** * Traverses children that are typically specified as `props.children`, but * might also be specified through attributes: * * - `traverseAllChildren(this.props.children, ...)` * - `traverseAllChildren(this.props.leftPanelChildren, ...)` * * The `traverseContext` is an optional argument that is passed through the * entire traversal. It can be used to store accumulations or anything else that * the callback might find relevant. * * @param {?*} children Children tree object. * @param {!function} callback To invoke upon traversing each child. * @param {?*} traverseContext Context for traversal. */ function traverseAllChildren(children, callback, traverseContext) { if (children !== null && children !== undefined) { traverseAllChildrenImpl(children, '', 0, callback, traverseContext); } } module.exports = traverseAllChildren; },{"./ReactComponent":25,"./ReactTextComponent":59,"./invariant":95}]},{},[24]) (24) }); ;
admin/client/App/screens/Item/components/RelatedItemsList/RelatedItemsListRow.js
linhanyang/keystone
import React, { Component, PropTypes } from 'react'; import { DropTarget, DragSource } from 'react-dnd'; import { Columns } from 'FieldTypes'; import { reorderItems, resetItems, moveItem, } from '../../actions'; import ListControl from '../../../List/components/ListControl'; class RelatedItemsListRow extends Component { render () { const { columns, item, connectDragSource, connectDropTarget, refList } = this.props; const cells = columns.map((col, i) => { const ColumnType = Columns[col.type] || Columns.__unrecognised__; const linkTo = !i ? `${Keystone.adminPath}/${refList.path}/${item.id}` : undefined; return <ColumnType key={col.path} list={refList} col={col} data={item} linkTo={linkTo} />; }); // add sortable icon when applicable if (connectDragSource) { cells.unshift(<ListControl key="_sort" type="sortable" dragSource={connectDragSource} />); } const row = (<tr key={'i' + item.id}>{cells}</tr>); if (connectDropTarget) { return connectDropTarget(row); } else { return row; } } } RelatedItemsListRow.propTypes = { columns: PropTypes.array.isRequired, dispatch: PropTypes.func.isRequired, dragNewSortOrder: React.PropTypes.number, index: PropTypes.number, item: PropTypes.object.isRequired, refList: PropTypes.object.isRequired, relatedItemId: PropTypes.string.isRequired, relationship: PropTypes.object.isRequired, // Injected by React DnD: isDragging: PropTypes.bool, // eslint-disable-line react/sort-prop-types connectDragSource: PropTypes.func, // eslint-disable-line react/sort-prop-types connectDropTarget: PropTypes.func, // eslint-disable-line react/sort-prop-types connectDragPreview: PropTypes.func, // eslint-disable-line react/sort-prop-types }; module.exports = exports = RelatedItemsListRow; // Expose Sortable /** * Implements drag source. */ const dragItem = { beginDrag (props) { const send = { ...props }; // props.dispatch(setDragBase(props.item, props.index)); return { ...send }; }, endDrag (props, monitor, component) { // Dropped outside of the drop target, reset rows if (!monitor.didDrop()) { props.dispatch(resetItems()); return; } const draggedItem = props.item; const prevSortOrder = draggedItem.sortOrder; const newSortOrder = props.dragNewSortOrder; // Dropping on self if (prevSortOrder === newSortOrder) { props.dispatch(resetItems()); return; } // dropped on a target const { columns, refList, relationship, relatedItemId, item } = props; props.dispatch(reorderItems({ columns, refList, relationship, relatedItemId, item, prevSortOrder, newSortOrder })); }, }; /** * Implements drag target. */ const dropItem = { drop (props, monitor, component) { return { ...props }; }, hover (props, monitor, component) { // reset row alerts // if (props.rowAlert.success || props.rowAlert.fail) { // props.dispatch(setRowAlert({ // reset: true, // })); // } const dragged = monitor.getItem().index; const over = props.index; // self if (dragged === over) { return; } // Since the items are moved on hover, we need to store the new sort order from the dragged over item so we can use it to reorder when the item is dropped. props.dispatch(moveItem({ prevIndex: dragged, newIndex: over, relationshipPath: props.relationship.path, newSortOrder: props.item.sortOrder, })); monitor.getItem().index = over; }, }; /** * Specifies the props to inject into your component. */ function dragProps (connect, monitor) { return { connectDragSource: connect.dragSource(), isDragging: monitor.isDragging(), connectDragPreview: connect.dragPreview(), }; } function dropProps (connect) { return { connectDropTarget: connect.dropTarget(), }; }; // exports.Sortable = RelatedItemsListRow; exports.Sortable = DragSource('item', dragItem, dragProps)(DropTarget('item', dropItem, dropProps)(RelatedItemsListRow));
example/app.js
zanroo/react-treeview
'use strict'; import React from 'react'; import ReactDOM from 'react-dom'; import TreeView from '../src/index'; import data from './data'; import '../src/default/style.css'; // import * as filters from './filter'; // Example: Customising The Header Decorator To Include Icons // const decorators = {}; /* decorators.Header = (props) => { const style = props.style; const iconType = props.node.children ? 'folder' : 'file-text'; const iconClass = `fa fa-${iconType}`; const iconStyle = { marginRight: '5px' }; return ( <div style={style.base}> <div style={style.title}> <i className={iconClass} style={iconStyle}/> {props.node.name} </div> </div> ); }; decorators.Loading = (props) => { ...... } decorators.Toggle = (props) => { ...... } decorators.Header = (props) => { ...... } decorators.Selected = (props) => { ...... } decorators.FirstChildSelected = (props) => { ...... } decorators.ColSelected = (props) => { ...... } decorators.SearchTree = (props) => { ...... } */ class DemoTree extends React.Component { constructor(props){ super(props); this.state = {data}; // this.onFilterMouseUp = this.onFilterMouseUp.bind(this); this.updateMe = this.updateMe.bind(this); } updateMe(){ this.forceUpdate(); } // onFilterMouseUp(e){ // const filter = e.target.value.trim(); // if(!filter){ return this.setState({data}); } // var filtered = filters.filterTree(data, filter); // filtered = filters.expandFilteredNodes(filtered, filter); // this.setState({data: filtered}); // } render(){ return ( <div> <TreeView data={this.state.data} use={ { select: true, firstChildSelect: true, colSelect: true, search: true, active: true } } options={ { nodeName: 'subs' } } /> </div> ); } } const content = document.getElementById('content'); ReactDOM.render(<DemoTree/>, content);
node_modules/semantic-ui-react/dist/es/modules/Progress/Progress.js
SuperUncleCat/ServerMonitoring
import _extends from 'babel-runtime/helpers/extends'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import _round from 'lodash/round'; import _clamp from 'lodash/clamp'; import _isUndefined from 'lodash/isUndefined'; import _without from 'lodash/without'; import cx from 'classnames'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { childrenUtils, createHTMLDivision, customPropTypes, getElementType, getUnhandledProps, META, SUI, useKeyOnly, useValueAndKey } from '../../lib'; /** * A progress bar shows the progression of a task. */ var Progress = function (_Component) { _inherits(Progress, _Component); function Progress() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Progress); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Progress.__proto__ || Object.getPrototypeOf(Progress)).call.apply(_ref, [this].concat(args))), _this), _this.calculatePercent = function () { var _this$props = _this.props, percent = _this$props.percent, total = _this$props.total, value = _this$props.value; if (!_isUndefined(percent)) return percent; if (!_isUndefined(total) && !_isUndefined(value)) return value / total * 100; }, _this.getPercent = function () { var precision = _this.props.precision; var percent = _clamp(_this.calculatePercent(), 0, 100); if (_isUndefined(precision)) return percent; return _round(percent, precision); }, _this.isAutoSuccess = function () { var _this$props2 = _this.props, autoSuccess = _this$props2.autoSuccess, percent = _this$props2.percent, total = _this$props2.total, value = _this$props2.value; return autoSuccess && (percent >= 100 || value >= total); }, _this.renderLabel = function () { var _this$props3 = _this.props, children = _this$props3.children, label = _this$props3.label; if (!childrenUtils.isNil(children)) return React.createElement( 'div', { className: 'label' }, children ); return createHTMLDivision(label, { defaultProps: { className: 'label' } }); }, _this.renderProgress = function (percent) { var _this$props4 = _this.props, precision = _this$props4.precision, progress = _this$props4.progress, total = _this$props4.total, value = _this$props4.value; if (!progress && _isUndefined(precision)) return; return React.createElement( 'div', { className: 'progress' }, progress !== 'ratio' ? percent + '%' : value + '/' + total ); }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Progress, [{ key: 'render', value: function render() { var _props = this.props, active = _props.active, attached = _props.attached, className = _props.className, color = _props.color, disabled = _props.disabled, error = _props.error, indicating = _props.indicating, inverted = _props.inverted, size = _props.size, success = _props.success, warning = _props.warning; var classes = cx('ui', color, size, useKeyOnly(active || indicating, 'active'), useKeyOnly(disabled, 'disabled'), useKeyOnly(error, 'error'), useKeyOnly(indicating, 'indicating'), useKeyOnly(inverted, 'inverted'), useKeyOnly(success || this.isAutoSuccess(), 'success'), useKeyOnly(warning, 'warning'), useValueAndKey(attached, 'attached'), 'progress', className); var rest = getUnhandledProps(Progress, this.props); var ElementType = getElementType(Progress, this.props); var percent = this.getPercent(); return React.createElement( ElementType, _extends({}, rest, { className: classes, 'data-percent': Math.floor(percent) }), React.createElement( 'div', { className: 'bar', style: { width: percent + '%' } }, this.renderProgress(percent) ), this.renderLabel() ); } }]); return Progress; }(Component); Progress._meta = { name: 'Progress', type: META.TYPES.MODULE }; Progress.handledProps = ['active', 'as', 'attached', 'autoSuccess', 'children', 'className', 'color', 'disabled', 'error', 'indicating', 'inverted', 'label', 'percent', 'precision', 'progress', 'size', 'success', 'total', 'value', 'warning']; Progress.propTypes = process.env.NODE_ENV !== "production" ? { /** An element type to render as (string or function). */ as: customPropTypes.as, /** A progress bar can show activity. */ active: PropTypes.bool, /** A progress bar can attach to and show the progress of an element (i.e. Card or Segment). */ attached: PropTypes.oneOf(['top', 'bottom']), /** Whether success state should automatically trigger when progress completes. */ autoSuccess: PropTypes.bool, /** Primary content. */ children: PropTypes.node, /** Additional classes. */ className: PropTypes.string, /** A progress bar can have different colors. */ color: PropTypes.oneOf(SUI.COLORS), /** A progress bar be disabled. */ disabled: PropTypes.bool, /** A progress bar can show a error state. */ error: PropTypes.bool, /** An indicating progress bar visually indicates the current level of progress of a task. */ indicating: PropTypes.bool, /** A progress bar can have its colors inverted. */ inverted: PropTypes.bool, /** Can be set to either to display progress as percent or ratio. */ label: customPropTypes.itemShorthand, /** Current percent complete. */ percent: customPropTypes.every([customPropTypes.disallow(['total', 'value']), PropTypes.oneOfType([PropTypes.number, PropTypes.string])]), /** Decimal point precision for calculated progress. */ precision: PropTypes.number, /** A progress bar can contain a text value indicating current progress. */ progress: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['percent', 'ratio'])]), /** A progress bar can vary in size. */ size: PropTypes.oneOf(_without(SUI.SIZES, 'mini', 'huge', 'massive')), /** A progress bar can show a success state. */ success: PropTypes.bool, /** For use with value. Together, these will calculate the percent. Mutually excludes percent. */ total: customPropTypes.every([customPropTypes.demand(['value']), customPropTypes.disallow(['percent']), PropTypes.oneOfType([PropTypes.number, PropTypes.string])]), /** For use with total. Together, these will calculate the percent. Mutually excludes percent. */ value: customPropTypes.every([customPropTypes.demand(['total']), customPropTypes.disallow(['percent']), PropTypes.oneOfType([PropTypes.number, PropTypes.string])]), /** A progress bar can show a warning state. */ warning: PropTypes.bool } : {}; export default Progress;
ajax/libs/analytics.js/2.3.13/analytics.min.js
fatso83/cdnjs
(function outer(modules,cache,entries){var global=function(){return this}();function require(name,jumped){if(cache[name])return cache[name].exports;if(modules[name])return call(name,require);throw new Error('cannot find module "'+name+'"')}function call(id,require){var m=cache[id]={exports:{}};var mod=modules[id];var name=mod[2];var fn=mod[0];fn.call(m.exports,function(req){var dep=modules[id][1][req];return require(dep?dep:req)},m,m.exports,outer,modules,cache,entries);if(name)cache[name]=cache[id];return cache[id].exports}for(var id in entries){if(entries[id]){global[entries[id]]=require(id)}else{require(id)}}require.duo=true;require.cache=cache;require.modules=modules;return require})({1:[function(require,module,exports){var Integrations=require("analytics.js-integrations");var Analytics=require("./analytics");var each=require("each");var analytics=module.exports=exports=new Analytics;analytics.require=require;exports.VERSION=require("./version");each(Integrations,function(name,Integration){analytics.use(Integration)})},{"analytics.js-integrations":2,"./analytics":3,each:4,"./version":5}],2:[function(require,module,exports){var each=require("each");var plugins=require("./integrations.js");each(plugins,function(plugin){var name=(plugin.Integration||plugin).prototype.name;exports[name]=plugin})},{each:4,"./integrations.js":6}],4:[function(require,module,exports){var type=require("type");var has=Object.prototype.hasOwnProperty;module.exports=function(obj,fn){switch(type(obj)){case"array":return array(obj,fn);case"object":if("number"==typeof obj.length)return array(obj,fn);return object(obj,fn);case"string":return string(obj,fn)}};function string(obj,fn){for(var i=0;i<obj.length;++i){fn(obj.charAt(i),i)}}function object(obj,fn){for(var key in obj){if(has.call(obj,key)){fn(key,obj[key])}}}function array(obj,fn){for(var i=0;i<obj.length;++i){fn(obj[i],i)}}},{type:7}],7:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if(val===null)return"null";if(val===undefined)return"undefined";if(val&&val.nodeType===1)return"element";if(val===Object(val))return"object";return typeof val}},{}],6:[function(require,module,exports){module.exports=[require("./lib/adroll"),require("./lib/adwords"),require("./lib/alexa"),require("./lib/amplitude"),require("./lib/appcues"),require("./lib/awesm"),require("./lib/awesomatic"),require("./lib/bing-ads"),require("./lib/bronto"),require("./lib/bugherd"),require("./lib/bugsnag"),require("./lib/chartbeat"),require("./lib/churnbee"),require("./lib/clicktale"),require("./lib/clicky"),require("./lib/comscore"),require("./lib/crazy-egg"),require("./lib/curebit"),require("./lib/customerio"),require("./lib/drip"),require("./lib/errorception"),require("./lib/evergage"),require("./lib/facebook-conversion-tracking"),require("./lib/foxmetrics"),require("./lib/frontleaf"),require("./lib/gauges"),require("./lib/get-satisfaction"),require("./lib/google-analytics"),require("./lib/google-tag-manager"),require("./lib/gosquared"),require("./lib/heap"),require("./lib/hellobar"),require("./lib/hittail"),require("./lib/hublo"),require("./lib/hubspot"),require("./lib/improvely"),require("./lib/insidevault"),require("./lib/inspectlet"),require("./lib/intercom"),require("./lib/keen-io"),require("./lib/kenshoo"),require("./lib/kissmetrics"),require("./lib/klaviyo"),require("./lib/leadlander"),require("./lib/livechat"),require("./lib/lucky-orange"),require("./lib/lytics"),require("./lib/mixpanel"),require("./lib/mojn"),require("./lib/mouseflow"),require("./lib/mousestats"),require("./lib/navilytics"),require("./lib/olark"),require("./lib/optimizely"),require("./lib/perfect-audience"),require("./lib/pingdom"),require("./lib/piwik"),require("./lib/preact"),require("./lib/qualaroo"),require("./lib/quantcast"),require("./lib/rollbar"),require("./lib/saasquatch"),require("./lib/sentry"),require("./lib/snapengage"),require("./lib/spinnakr"),require("./lib/tapstream"),require("./lib/trakio"),require("./lib/twitter-ads"),require("./lib/usercycle"),require("./lib/uservoice"),require("./lib/vero"),require("./lib/visual-website-optimizer"),require("./lib/webengage"),require("./lib/woopra"),require("./lib/yandex-metrica")]},{"./lib/adroll":8,"./lib/adwords":9,"./lib/alexa":10,"./lib/amplitude":11,"./lib/appcues":12,"./lib/awesm":13,"./lib/awesomatic":14,"./lib/bing-ads":15,"./lib/bronto":16,"./lib/bugherd":17,"./lib/bugsnag":18,"./lib/chartbeat":19,"./lib/churnbee":20,"./lib/clicktale":21,"./lib/clicky":22,"./lib/comscore":23,"./lib/crazy-egg":24,"./lib/curebit":25,"./lib/customerio":26,"./lib/drip":27,"./lib/errorception":28,"./lib/evergage":29,"./lib/facebook-conversion-tracking":30,"./lib/foxmetrics":31,"./lib/frontleaf":32,"./lib/gauges":33,"./lib/get-satisfaction":34,"./lib/google-analytics":35,"./lib/google-tag-manager":36,"./lib/gosquared":37,"./lib/heap":38,"./lib/hellobar":39,"./lib/hittail":40,"./lib/hublo":41,"./lib/hubspot":42,"./lib/improvely":43,"./lib/insidevault":44,"./lib/inspectlet":45,"./lib/intercom":46,"./lib/keen-io":47,"./lib/kenshoo":48,"./lib/kissmetrics":49,"./lib/klaviyo":50,"./lib/leadlander":51,"./lib/livechat":52,"./lib/lucky-orange":53,"./lib/lytics":54,"./lib/mixpanel":55,"./lib/mojn":56,"./lib/mouseflow":57,"./lib/mousestats":58,"./lib/navilytics":59,"./lib/olark":60,"./lib/optimizely":61,"./lib/perfect-audience":62,"./lib/pingdom":63,"./lib/piwik":64,"./lib/preact":65,"./lib/qualaroo":66,"./lib/quantcast":67,"./lib/rollbar":68,"./lib/saasquatch":69,"./lib/sentry":70,"./lib/snapengage":71,"./lib/spinnakr":72,"./lib/tapstream":73,"./lib/trakio":74,"./lib/twitter-ads":75,"./lib/usercycle":76,"./lib/uservoice":77,"./lib/vero":78,"./lib/visual-website-optimizer":79,"./lib/webengage":80,"./lib/woopra":81,"./lib/yandex-metrica":82}],8:[function(require,module,exports){var integration=require("analytics.js-integration");var snake=require("to-snake-case");var useHttps=require("use-https");var each=require("each");var is=require("is");var has=Object.prototype.hasOwnProperty;var AdRoll=module.exports=integration("AdRoll").assumesPageview().global("__adroll_loaded").global("adroll_adv_id").global("adroll_pix_id").global("adroll_custom_data").option("advId","").option("pixId","").tag("http",'<script src="http://a.adroll.com/j/roundtrip.js">').tag("https",'<script src="https://s.adroll.com/j/roundtrip.js">').mapping("events");AdRoll.prototype.initialize=function(page){window.adroll_adv_id=this.options.advId;window.adroll_pix_id=this.options.pixId;window.__adroll_loaded=true;var name=useHttps()?"https":"http";this.load(name,this.ready)};AdRoll.prototype.loaded=function(){return window.__adroll};AdRoll.prototype.page=function(page){var name=page.fullName();this.track(page.track(name))};AdRoll.prototype.track=function(track){var event=track.event();var user=this.analytics.user();var events=this.events(event);var total=track.revenue()||track.total()||0;var orderId=track.orderId()||0;each(events,function(event){var data={};if(user.id())data.user_id=user.id();data.adroll_conversion_value_in_dollars=total;data.order_id=orderId;data.adroll_segments=snake(event);window.__adroll.record_user(data)});if(!events.length){var data={};if(user.id())data.user_id=user.id();data.adroll_segments=snake(event);window.__adroll.record_user(data)}}},{"analytics.js-integration":83,"to-snake-case":84,"use-https":85,each:4,is:86}],83:[function(require,module,exports){var bind=require("bind");var callback=require("callback");var clone=require("clone");var debug=require("debug");var defaults=require("defaults");var protos=require("./protos");var slug=require("slug");var statics=require("./statics");module.exports=createIntegration;function createIntegration(name){function Integration(options){if(options&&options.addIntegration){return options.addIntegration(Integration)}this.debug=debug("analytics:integration:"+slug(name));this.options=defaults(clone(options)||{},this.defaults);this._queue=[];this.once("ready",bind(this,this.flush));Integration.emit("construct",this);this.ready=bind(this,this.ready);this._wrapInitialize();this._wrapPage();this._wrapTrack()}Integration.prototype.defaults={};Integration.prototype.globals=[];Integration.prototype.templates={};Integration.prototype.name=name;for(var key in statics)Integration[key]=statics[key];for(var key in protos)Integration.prototype[key]=protos[key];return Integration}},{bind:87,callback:88,clone:89,debug:90,defaults:91,"./protos":92,slug:93,"./statics":94}],87:[function(require,module,exports){var bind=require("bind"),bindAll=require("bind-all");module.exports=exports=bind;exports.all=bindAll;exports.methods=bindMethods;function bindMethods(obj,methods){methods=[].slice.call(arguments,1);for(var i=0,method;method=methods[i];i++){obj[method]=bind(obj,obj[method])}return obj}},{bind:95,"bind-all":96}],95:[function(require,module,exports){var slice=[].slice;module.exports=function(obj,fn){if("string"==typeof fn)fn=obj[fn];if("function"!=typeof fn)throw new Error("bind() requires a function");var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.concat(slice.call(arguments)))}}},{}],96:[function(require,module,exports){try{var bind=require("bind");var type=require("type")}catch(e){var bind=require("bind-component");var type=require("type-component")}module.exports=function(obj){for(var key in obj){var val=obj[key];if(type(val)==="function")obj[key]=bind(obj,obj[key])}return obj}},{bind:95,type:7}],88:[function(require,module,exports){var next=require("next-tick");module.exports=callback;function callback(fn){if("function"===typeof fn)fn()}callback.async=function(fn,wait){if("function"!==typeof fn)return;if(!wait)return next(fn);setTimeout(fn,wait)};callback.sync=callback},{"next-tick":97}],97:[function(require,module,exports){"use strict";if(typeof setImmediate=="function"){module.exports=function(f){setImmediate(f)}}else if(typeof process!="undefined"&&typeof process.nextTick=="function"){module.exports=process.nextTick}else if(typeof window=="undefined"||window.ActiveXObject||!window.postMessage){module.exports=function(f){setTimeout(f)}}else{var q=[];window.addEventListener("message",function(){var i=0;while(i<q.length){try{q[i++]()}catch(e){q=q.slice(i);window.postMessage("tic!","*");throw e}}q.length=0},true);module.exports=function(fn){if(!q.length)window.postMessage("tic!","*");q.push(fn)}}},{}],89:[function(require,module,exports){var type;try{type=require("type")}catch(e){type=require("type-component")}module.exports=clone;function clone(obj){switch(type(obj)){case"object":var copy={};for(var key in obj){if(obj.hasOwnProperty(key)){copy[key]=clone(obj[key])}}return copy;case"array":var copy=new Array(obj.length);for(var i=0,l=obj.length;i<l;i++){copy[i]=clone(obj[i])}return copy;case"regexp":var flags="";flags+=obj.multiline?"m":"";flags+=obj.global?"g":"";flags+=obj.ignoreCase?"i":"";return new RegExp(obj.source,flags);case"date":return new Date(obj.getTime());default:return obj}}},{type:7}],90:[function(require,module,exports){if("undefined"==typeof window){module.exports=require("./lib/debug")}else{module.exports=require("./debug")}},{"./lib/debug":98,"./debug":99}],98:[function(require,module,exports){var tty=require("tty");module.exports=debug;var names=[],skips=[];(process.env.DEBUG||"").split(/[\s,]+/).forEach(function(name){name=name.replace("*",".*?");if(name[0]==="-"){skips.push(new RegExp("^"+name.substr(1)+"$"))}else{names.push(new RegExp("^"+name+"$"))}});var colors=[6,2,3,4,5,1];var prev={};var prevColor=0;var isatty=tty.isatty(2);function color(){return colors[prevColor++%colors.length]}function humanize(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"}function debug(name){function disabled(){}disabled.enabled=false;var match=skips.some(function(re){return re.test(name)});if(match)return disabled;match=names.some(function(re){return re.test(name)});if(!match)return disabled;var c=color();function colored(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(prev[name]||curr);prev[name]=curr;fmt=" [9"+c+"m"+name+" "+"[3"+c+"m"+fmt+"[3"+c+"m"+" +"+humanize(ms)+"";console.error.apply(this,arguments)}function plain(fmt){fmt=coerce(fmt);fmt=(new Date).toUTCString()+" "+name+" "+fmt;console.error.apply(this,arguments)}colored.enabled=plain.enabled=true;return isatty||process.env.DEBUG_COLORS?colored:plain}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{}],99:[function(require,module,exports){module.exports=debug;function debug(name){if(!debug.enabled(name))return function(){};return function(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(debug[name]||curr);debug[name]=curr;fmt=name+" "+fmt+" +"+debug.humanize(ms);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];debug.enable=function(name){try{localStorage.debug=name}catch(e){}var split=(name||"").split(/[\s,]+/),len=split.length;for(var i=0;i<len;i++){name=split[i].replace("*",".*?");if(name[0]==="-"){debug.skips.push(new RegExp("^"+name.substr(1)+"$"))}else{debug.names.push(new RegExp("^"+name+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i<len;i++){if(debug.skips[i].test(name)){return false}}for(var i=0,len=debug.names.length;i<len;i++){if(debug.names[i].test(name)){return true}}return false};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],91:[function(require,module,exports){"use strict";var defaults=function(dest,src,recursive){for(var prop in src){if(recursive&&dest[prop]instanceof Object&&src[prop]instanceof Object){dest[prop]=defaults(dest[prop],src[prop],true)}else if(!(prop in dest)){dest[prop]=src[prop]}}return dest};module.exports=defaults},{}],92:[function(require,module,exports){var loadScript=require("segmentio/load-script");var normalize=require("to-no-case");var callback=require("callback");var Emitter=require("emitter");var events=require("./events");var tick=require("next-tick");var assert=require("assert");var after=require("after");var each=require("component/each");var type=require("type");var fmt=require("yields/fmt");var setTimeout=window.setTimeout;var setInterval=window.setInterval;var onerror=null;var onload=null;Emitter(exports);exports.initialize=function(){var ready=this.ready;tick(ready)};exports.loaded=function(){return false};exports.load=function(cb){callback.async(cb)};exports.page=function(page){};exports.track=function(track){};exports.map=function(obj,str){var a=normalize(str);var ret=[];if(!obj)return ret;if("object"==type(obj)){for(var k in obj){var item=obj[k];var b=normalize(k);if(b==a)ret.push(item)}}if("array"==type(obj)){if(!obj.length)return ret;if(!obj[0].key)return ret;for(var i=0;i<obj.length;++i){var item=obj[i];var b=normalize(item.key);if(b==a)ret.push(item.value)}}return ret};exports.invoke=function(method){if(!this[method])return;var args=[].slice.call(arguments,1);if(!this._ready)return this.queue(method,args);var ret;try{this.debug("%s with %o",method,args);ret=this[method].apply(this,args)}catch(e){this.debug("error %o calling %s with %o",e,method,args)}return ret};exports.queue=function(method,args){if("page"==method&&this._assumesPageview&&!this._initialized){return this.page.apply(this,args)}this._queue.push({method:method,args:args})};exports.flush=function(){this._ready=true;var call;while(call=this._queue.shift())this[call.method].apply(this,call.args)};exports.reset=function(){for(var i=0,key;key=this.globals[i];i++)window[key]=undefined;window.setTimeout=setTimeout;window.setInterval=setInterval;window.onerror=onerror;window.onload=onload};exports.load=function(name,locals,fn){if("function"==typeof name)fn=name,locals=null,name=null;if(name&&"object"==typeof name)fn=locals,locals=name,name=null;if("function"==typeof locals)fn=locals,locals=null;name=name||"library";locals=locals||{};locals=this.locals(locals);var template=this.templates[name];assert(template,fmt('Template "%s" not defined.',name));var attrs=render(template,locals);var el;switch(template.type){case"img":attrs.width=1;attrs.height=1;el=loadImage(attrs,fn);break;case"script":el=loadScript(attrs,fn);delete attrs.src;each(attrs,function(key,val){el.setAttribute(key,val)});break;case"iframe":el=loadIframe(attrs,fn);break}return el};exports.locals=function(locals){locals=locals||{};var cache=Math.floor((new Date).getTime()/36e5);if(!locals.hasOwnProperty("cache"))locals.cache=cache;each(this.options,function(key,val){if(!locals.hasOwnProperty(key))locals[key]=val});return locals};exports.ready=function(){this.emit("ready")};exports._wrapInitialize=function(){var initialize=this.initialize;this.initialize=function(){this.debug("initialize");this._initialized=true;var ret=initialize.apply(this,arguments);this.emit("initialize");return ret};if(this._assumesPageview)this.initialize=after(2,this.initialize)};exports._wrapPage=function(){var page=this.page;this.page=function(){if(this._assumesPageview&&!this._initialized){return this.initialize.apply(this,arguments)}return page.apply(this,arguments)}};exports._wrapTrack=function(){var t=this.track;this.track=function(track){var event=track.event();var called;var ret;for(var method in events){var regexp=events[method];if(!this[method])continue;if(!regexp.test(event))continue;ret=this[method].apply(this,arguments);called=true;break}if(!called)ret=t.apply(this,arguments);return ret}};function loadImage(attrs,fn){fn=fn||function(){};var img=new Image;img.onerror=error(fn,"failed to load pixel",img);img.onload=function(){fn()};img.src=attrs.src;img.width=1;img.height=1;return img}function error(fn,message,img){return function(e){e=e||window.event;var err=new Error(message);err.event=e;err.source=img;fn(err)}}function render(template,locals){var attrs={};each(template.attrs,function(key,val){attrs[key]=val.replace(/\{\{\ *(\w+)\ *\}\}/g,function(_,$1){return locals[$1]})});return attrs}},{"segmentio/load-script":100,"to-no-case":101,callback:88,emitter:102,"./events":103,"next-tick":97,assert:104,after:105,"component/each":106,type:7,"yields/fmt":107}],100:[function(require,module,exports){var onload=require("script-onload");var tick=require("next-tick");var type=require("type");module.exports=function loadScript(options,fn){if(!options)throw new Error("Cant load nothing...");if("string"==type(options))options={src:options};var https=document.location.protocol==="https:"||document.location.protocol==="chrome-extension:";if(options.src&&options.src.indexOf("//")===0){options.src=https?"https:"+options.src:"http:"+options.src}if(https&&options.https)options.src=options.https;else if(!https&&options.http)options.src=options.http;var script=document.createElement("script");script.type="text/javascript";script.async=true;script.src=options.src;if("function"==type(fn)){onload(script,fn)}tick(function(){var firstScript=document.getElementsByTagName("script")[0];firstScript.parentNode.insertBefore(script,firstScript)});return script}},{"script-onload":108,"next-tick":97,type:7}],108:[function(require,module,exports){module.exports=function(el,fn){return el.addEventListener?add(el,fn):attach(el,fn)};function add(el,fn){el.addEventListener("load",function(_,e){fn(null,e)},false);el.addEventListener("error",function(e){var err=new Error('failed to load the script "'+el.src+'"');err.event=e;fn(err)},false)}function attach(el,fn){el.attachEvent("onreadystatechange",function(e){if(!/complete|loaded/.test(el.readyState))return;fn(null,e)})}},{}],101:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasSeparator=/[\W_]/;function toNoCase(string){if(hasSpace.test(string))return string.toLowerCase();if(hasSeparator.test(string))return unseparate(string).toLowerCase();return uncamelize(string).toLowerCase()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],102:[function(require,module,exports){var index=require("indexof");module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}fn._off=on;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var i=index(callbacks,fn._off||fn);if(~i)callbacks.splice(i,1);return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1),callbacks=this._callbacks[event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{indexof:109}],109:[function(require,module,exports){module.exports=function(arr,obj){if(arr.indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i){if(arr[i]===obj)return i}return-1}},{}],103:[function(require,module,exports){module.exports={removedProduct:/removed[ _]?product/i,viewedProduct:/viewed[ _]?product/i,addedProduct:/added[ _]?product/i,completedOrder:/completed[ _]?order/i}},{}],104:[function(require,module,exports){var equals=require("equals");var fmt=require("fmt");var stack=require("stack");module.exports=exports=function(expr,msg){if(expr)return;throw new Error(msg||message())};exports.equal=function(actual,expected,msg){if(actual==expected)return;throw new Error(msg||fmt("Expected %o to equal %o.",actual,expected))};exports.notEqual=function(actual,expected,msg){if(actual!=expected)return;throw new Error(msg||fmt("Expected %o not to equal %o.",actual,expected))};exports.deepEqual=function(actual,expected,msg){if(equals(actual,expected))return;throw new Error(msg||fmt("Expected %o to deeply equal %o.",actual,expected))};exports.notDeepEqual=function(actual,expected,msg){if(!equals(actual,expected))return;throw new Error(msg||fmt("Expected %o not to deeply equal %o.",actual,expected))};exports.strictEqual=function(actual,expected,msg){if(actual===expected)return;throw new Error(msg||fmt("Expected %o to strictly equal %o.",actual,expected))};exports.notStrictEqual=function(actual,expected,msg){if(actual!==expected)return;throw new Error(msg||fmt("Expected %o not to strictly equal %o.",actual,expected))};exports.throws=function(block,error,msg){var err;try{block()}catch(e){err=e}if(!err)throw new Error(msg||fmt("Expected %s to throw an error.",block.toString()));if(error&&!(err instanceof error)){throw new Error(msg||fmt("Expected %s to throw an %o.",block.toString(),error))}};exports.doesNotThrow=function(block,error,msg){var err;try{block()}catch(e){err=e}if(err)throw new Error(msg||fmt("Expected %s not to throw an error.",block.toString()));if(error&&err instanceof error){throw new Error(msg||fmt("Expected %s not to throw an %o.",block.toString(),error))}};function message(){if(!Error.captureStackTrace)return"assertion failed";var callsite=stack()[2];var fn=callsite.getFunctionName();var file=callsite.getFileName();var line=callsite.getLineNumber()-1;var col=callsite.getColumnNumber()-1;var src=get(file);line=src.split("\n")[line].slice(col);var m=line.match(/assert\((.*)\)/);return m&&m[1].trim()}function get(script){var xhr=new XMLHttpRequest;xhr.open("GET",script,false);xhr.send(null);return xhr.responseText}},{equals:110,fmt:107,stack:111}],110:[function(require,module,exports){var type=require("type");module.exports=equals;equals.compare=compare;function equals(){var i=arguments.length-1;while(i>0){if(!compare(arguments[i],arguments[--i]))return false}return true}function compare(a,b,memos){if(a===b)return true;var fnA=types[type(a)];var fnB=types[type(b)];return fnA&&fnA===fnB?fnA(a,b,memos):false}var types={};types.number=function(a){return a!==a};types["function"]=function(a,b,memos){return a.toString()===b.toString()&&types.object(a,b,memos)&&compare(a.prototype,b.prototype)};types.date=function(a,b){return+a===+b};types.regexp=function(a,b){return a.toString()===b.toString()};types.element=function(a,b){return a.outerHTML===b.outerHTML};types.textnode=function(a,b){return a.textContent===b.textContent};function memoGaurd(fn){return function(a,b,memos){if(!memos)return fn(a,b,[]);var i=memos.length,memo;while(memo=memos[--i]){if(memo[0]===a&&memo[1]===b)return true}return fn(a,b,memos)}}types["arguments"]=types.array=memoGaurd(compareArrays);function compareArrays(a,b,memos){var i=a.length;if(i!==b.length)return false;memos.push([a,b]);while(i--){if(!compare(a[i],b[i],memos))return false}return true}types.object=memoGaurd(compareObjects);function compareObjects(a,b,memos){var ka=getEnumerableProperties(a);var kb=getEnumerableProperties(b);var i=ka.length;if(i!==kb.length)return false;ka.sort();kb.sort();while(i--)if(ka[i]!==kb[i])return false;memos.push([a,b]);i=ka.length;while(i--){var key=ka[i];if(!compare(a[key],b[key],memos))return false}return true}function getEnumerableProperties(object){var result=[];for(var k in object)if(k!=="constructor"){result.push(k)}return result}},{type:112}],112:[function(require,module,exports){var toString={}.toString;var DomNode=typeof window!="undefined"?window.Node:Function;module.exports=exports=function(x){var type=typeof x;if(type!="object")return type;type=types[toString.call(x)];if(type)return type;if(x instanceof DomNode)switch(x.nodeType){case 1:return"element";case 3:return"text-node";case 9:return"document";case 11:return"document-fragment";default:return"dom-node"}};var types=exports.types={"[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Arguments]":"arguments","[object Array]":"array","[object String]":"string","[object Null]":"null","[object Undefined]":"undefined","[object Number]":"number","[object Boolean]":"boolean","[object Object]":"object","[object Text]":"text-node","[object Uint8Array]":"bit-array","[object Uint16Array]":"bit-array","[object Uint32Array]":"bit-array","[object Uint8ClampedArray]":"bit-array","[object Error]":"error","[object FormData]":"form-data","[object File]":"file","[object Blob]":"blob"}},{}],107:[function(require,module,exports){module.exports=fmt;fmt.o=JSON.stringify;fmt.s=String;fmt.d=parseInt;function fmt(str){var args=[].slice.call(arguments,1);var j=0;return str.replace(/%([a-z])/gi,function(_,f){return fmt[f]?fmt[f](args[j++]):_+f})}},{}],111:[function(require,module,exports){module.exports=stack;function stack(){var orig=Error.prepareStackTrace;Error.prepareStackTrace=function(_,stack){return stack};var err=new Error;Error.captureStackTrace(err,arguments.callee);var stack=err.stack;Error.prepareStackTrace=orig;return stack}},{}],105:[function(require,module,exports){module.exports=function after(times,func){if(times<=0)return func();return function(){if(--times<1){return func.apply(this,arguments)}}}},{}],106:[function(require,module,exports){try{var type=require("type")}catch(err){var type=require("component-type")}var toFunction=require("to-function");var has=Object.prototype.hasOwnProperty;module.exports=function(obj,fn,ctx){fn=toFunction(fn);ctx=ctx||this;switch(type(obj)){case"array":return array(obj,fn,ctx);case"object":if("number"==typeof obj.length)return array(obj,fn,ctx);return object(obj,fn,ctx);case"string":return string(obj,fn,ctx)}};function string(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj.charAt(i),i)}}function object(obj,fn,ctx){for(var key in obj){if(has.call(obj,key)){fn.call(ctx,key,obj[key])}}}function array(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj[i],i)}}},{type:7,"component-type":7,"to-function":113}],113:[function(require,module,exports){var expr;try{expr=require("props")}catch(e){expr=require("component-props")}module.exports=toFunction;function toFunction(obj){switch({}.toString.call(obj)){case"[object Object]":return objectToFunction(obj);case"[object Function]":return obj;case"[object String]":return stringToFunction(obj);case"[object RegExp]":return regexpToFunction(obj);default:return defaultToFunction(obj)}}function defaultToFunction(val){return function(obj){return val===obj}}function regexpToFunction(re){return function(obj){return re.test(obj)}}function stringToFunction(str){if(/^ *\W+/.test(str))return new Function("_","return _ "+str);return new Function("_","return "+get(str))}function objectToFunction(obj){var match={};for(var key in obj){match[key]=typeof obj[key]==="string"?defaultToFunction(obj[key]):toFunction(obj[key])}return function(val){if(typeof val!=="object")return false;for(var key in match){if(!(key in val))return false;if(!match[key](val[key]))return false}return true}}function get(str){var props=expr(str);if(!props.length)return"_."+str;var val,i,prop;for(i=0;i<props.length;i++){prop=props[i];val="_."+prop;val="('function' == typeof "+val+" ? "+val+"() : "+val+")";str=stripNested(prop,str,val)}return str}function stripNested(prop,str,val){return str.replace(new RegExp("(\\.)?"+prop,"g"),function($0,$1){return $1?$0:val})}},{props:114,"component-props":114}],114:[function(require,module,exports){var globals=/\b(this|Array|Date|Object|Math|JSON)\b/g;module.exports=function(str,fn){var p=unique(props(str));if(fn&&"string"==typeof fn)fn=prefixed(fn);if(fn)return map(str,p,fn);return p};function props(str){return str.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(globals,"").match(/[$a-zA-Z_]\w*/g)||[]}function map(str,props,fn){var re=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return str.replace(re,function(_){if("("==_[_.length-1])return fn(_);if(!~props.indexOf(_))return _;return fn(_)})}function unique(arr){var ret=[];for(var i=0;i<arr.length;i++){if(~ret.indexOf(arr[i]))continue;ret.push(arr[i])}return ret}function prefixed(str){return function(_){return str+_}}},{}],93:[function(require,module,exports){module.exports=function(str,options){options||(options={});return str.toLowerCase().replace(options.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,options.separator||"-")}},{}],94:[function(require,module,exports){var after=require("after");var domify=require("component/domify");var each=require("component/each");var Emitter=require("emitter");Emitter(exports);exports.option=function(key,value){this.prototype.defaults[key]=value;return this};exports.mapping=function(name){this.option(name,[]);this.prototype[name]=function(str){return this.map(this.options[name],str) };return this};exports.global=function(key){this.prototype.globals.push(key);return this};exports.assumesPageview=function(){this.prototype._assumesPageview=true;return this};exports.readyOnLoad=function(){this.prototype._readyOnLoad=true;return this};exports.readyOnInitialize=function(){this.prototype._readyOnInitialize=true;return this};exports.tag=function(name,str){if(null==str){str=name;name="library"}this.prototype.templates[name]=objectify(str);return this};function objectify(str){str=str.replace(' src="',' data-src="');var el=domify(str);var attrs={};each(el.attributes,function(attr){var name="data-src"==attr.name?"src":attr.name;attrs[name]=attr.value});return{type:el.tagName.toLowerCase(),attrs:attrs}}},{after:105,"component/domify":115,"component/each":106,emitter:102}],115:[function(require,module,exports){module.exports=parse;var div=document.createElement("div");div.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';var innerHTMLBug=!div.getElementsByTagName("link").length;div=undefined;var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:innerHTMLBug?[1,"X<div>","</div>"]:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.text=map.circle=map.ellipse=map.line=map.path=map.polygon=map.polyline=map.rect=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");if(!doc)doc=document;var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=doc.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=doc.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=doc.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],84:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSnakeCase;function toSnakeCase(string){return toSpace(string).replace(/\s/g,"_")}},{"to-space-case":116}],116:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSpaceCase;function toSpaceCase(string){return clean(string).replace(/[\W_]+(.|$)/g,function(matches,match){return match?" "+match:""})}},{"to-no-case":117}],117:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasCamel=/[a-z][A-Z]/;var hasSeparator=/[\W_]/;function toNoCase(string){if(hasSpace.test(string))return string.toLowerCase();if(hasSeparator.test(string))string=unseparate(string);if(hasCamel.test(string))string=uncamelize(string);return string.toLowerCase()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],85:[function(require,module,exports){module.exports=function(url){switch(arguments.length){case 0:return check();case 1:return transform(url)}};function transform(url){return check()?"https:"+url:"http:"+url}function check(){return location.protocol=="https:"||location.protocol=="chrome-extension:"}},{}],86:[function(require,module,exports){var isEmpty=require("is-empty");try{var typeOf=require("type")}catch(e){var typeOf=require("component-type")}var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":118,type:7,"component-type":7}],118:[function(require,module,exports){module.exports=isEmpty;var has=Object.prototype.hasOwnProperty;function isEmpty(val){if(null==val)return true;if("number"==typeof val)return 0===val;if(undefined!==val.length)return 0===val.length;for(var key in val)if(has.call(val,key))return false;return true}},{}],9:[function(require,module,exports){var integration=require("analytics.js-integration");var onbody=require("on-body");var domify=require("domify");var Queue=require("queue");var each=require("each");var has=Object.prototype.hasOwnProperty;var q=new Queue({concurrency:1,timeout:2e3});var AdWords=module.exports=integration("AdWords").option("conversionId","").option("remarketing",false).tag("conversion",'<script src="//www.googleadservices.com/pagead/conversion.js">').mapping("events");AdWords.prototype.initialize=function(){onbody(this.ready)};AdWords.prototype.loaded=function(){return!!document.body};AdWords.prototype.page=function(page){var remarketing=this.options.remarketing;var id=this.options.conversionId;if(remarketing)this.remarketing(id)};AdWords.prototype.track=function(track){var id=this.options.conversionId;var events=this.events(track.event());var revenue=track.revenue()||0;var self=this;each(events,function(label){self.conversion({conversionId:id,value:revenue,label:label})})};AdWords.prototype.conversion=function(obj,fn){this.enqueue({google_conversion_id:obj.conversionId,google_conversion_language:"en",google_conversion_format:"3",google_conversion_color:"ffffff",google_conversion_label:obj.label,google_conversion_value:obj.value,google_remarketing_only:false},fn)};AdWords.prototype.remarketing=function(id){this.enqueue({google_conversion_id:id,google_remarketing_only:true})};AdWords.prototype.enqueue=function(obj,fn){this.debug("sending %o",obj);var self=this;q.push(function(next){self.globalize(obj);self.shim();self.load("conversion",function(){if(fn)fn();next()})})};AdWords.prototype.globalize=function(obj){for(var name in obj){if(obj.hasOwnProperty(name)){window[name]=obj[name]}}};AdWords.prototype.shim=function(){var self=this;var write=document.write;document.write=append;function append(str){var el=domify(str);if(!el.src)return write(str);if(!/googleadservices/.test(el.src))return write(str);self.debug("append %o",el);document.body.appendChild(el);document.write=write}}},{"analytics.js-integration":83,"on-body":119,domify:120,queue:121,each:4}],119:[function(require,module,exports){var each=require("each");var body=false;var callbacks=[];module.exports=function onBody(callback){if(body){call(callback)}else{callbacks.push(callback)}};var interval=setInterval(function(){if(!document.body)return;body=true;each(callbacks,call);clearInterval(interval)},5);function call(callback){callback(document.body)}},{each:106}],120:[function(require,module,exports){module.exports=parse;var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.text=map.circle=map.ellipse=map.line=map.path=map.polygon=map.polyline=map.rect=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html){if("string"!=typeof html)throw new TypeError("String expected");html=html.replace(/^\s+|\s+$/g,"");var m=/<([\w:]+)/.exec(html);if(!m)return document.createTextNode(html);var tag=m[1];if(tag=="body"){var el=document.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=document.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=document.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],121:[function(require,module,exports){var Emitter;var bind;try{Emitter=require("emitter");bind=require("bind")}catch(err){Emitter=require("component-emitter");bind=require("component-bind")}module.exports=Queue;function Queue(options){options=options||{};this.timeout=options.timeout||0;this.concurrency=options.concurrency||1;this.pending=0;this.jobs=[]}Emitter(Queue.prototype);Queue.prototype.length=function(){return this.pending+this.jobs.length};Queue.prototype.push=function(fn,cb){this.jobs.push([fn,cb]);setTimeout(bind(this,this.run),0)};Queue.prototype.run=function(){while(this.pending<this.concurrency){var job=this.jobs.shift();if(!job)break;this.exec(job)}};Queue.prototype.exec=function(job){var self=this;var ms=this.timeout;var fn=job[0];var cb=job[1];if(ms)fn=timeout(fn,ms);this.pending++;fn(function(err,res){cb&&cb(err,res);self.pending--;self.run()})};function timeout(fn,ms){return function(cb){var done;var id=setTimeout(function(){done=true;var err=new Error("Timeout of "+ms+"ms exceeded");err.timeout=timeout;cb(err)},ms);fn(function(err,res){if(done)return;clearTimeout(id);cb(err,res)})}}},{emitter:122,bind:95,"component-emitter":122,"component-bind":95}],122:[function(require,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var cb;for(var i=0;i<callbacks.length;i++){cb=callbacks[i];if(cb===fn||cb.fn===fn){callbacks.splice(i,1);break}}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1),callbacks=this._callbacks[event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],10:[function(require,module,exports){var integration=require("analytics.js-integration");var Alexa=module.exports=integration("Alexa").assumesPageview().global("_atrk_opts").option("account",null).option("domain","").option("dynamic",true).tag('<script src="//d31qbv1cthcecs.cloudfront.net/atrk.js">');Alexa.prototype.initialize=function(page){var self=this;window._atrk_opts={atrk_acct:this.options.account,domain:this.options.domain,dynamic:this.options.dynamic};this.load(function(){window.atrk();self.ready()})};Alexa.prototype.loaded=function(){return!!window.atrk}},{"analytics.js-integration":83}],11:[function(require,module,exports){var integration=require("analytics.js-integration");var Amplitude=module.exports=integration("Amplitude").global("amplitude").option("apiKey","").option("trackAllPages",false).option("trackNamedPages",true).option("trackCategorizedPages",true).tag('<script src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-1.1-min.js">');Amplitude.prototype.initialize=function(page){(function(e,t){var r=e.amplitude||{};r._q=[];function i(e){r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)))}}var s=["init","logEvent","setUserId","setGlobalUserProperties","setVersionName","setDomain"];for(var c=0;c<s.length;c++){i(s[c])}e.amplitude=r})(window,document);window.amplitude.init(this.options.apiKey);this.load(this.ready)};Amplitude.prototype.loaded=function(){return!!(window.amplitude&&window.amplitude.options)};Amplitude.prototype.page=function(page){var properties=page.properties();var category=page.category();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};Amplitude.prototype.identify=function(identify){var id=identify.userId();var traits=identify.traits();if(id)window.amplitude.setUserId(id);if(traits)window.amplitude.setGlobalUserProperties(traits)};Amplitude.prototype.track=function(track){var props=track.properties();var event=track.event();window.amplitude.logEvent(event,props)}},{"analytics.js-integration":83}],12:[function(require,module,exports){var integration=require("analytics.js-integration");var load=require("load-script");var is=require("is");module.exports=exports=function(analytics){analytics.addIntegration(Appcues)};var Appcues=exports.Integration=integration("Appcues").assumesPageview().global("Appcues").global("AppcuesIdentity").option("appcuesId","").option("userId","").option("userEmail","");Appcues.prototype.initialize=function(){this.load(function(){window.Appcues.init()})};Appcues.prototype.loaded=function(){return is.object(window.Appcues)};Appcues.prototype.load=function(callback){var script=load("//d2dubfq97s02eu.cloudfront.net/appcues-bundle.min.js",callback);script.setAttribute("data-appcues-id",this.options.appcuesId);script.setAttribute("data-user-id",this.options.userId);script.setAttribute("data-user-email",this.options.userEmail)};Appcues.prototype.identify=function(identify){window.Appcues.identify(identify.traits())}},{"analytics.js-integration":83,"load-script":123,is:86}],123:[function(require,module,exports){var onload=require("script-onload");var tick=require("next-tick");var type=require("type");module.exports=function loadScript(options,fn){if(!options)throw new Error("Cant load nothing...");if("string"==type(options))options={src:options};var https=document.location.protocol==="https:"||document.location.protocol==="chrome-extension:";if(options.src&&options.src.indexOf("//")===0){options.src=https?"https:"+options.src:"http:"+options.src}if(https&&options.https)options.src=options.https;else if(!https&&options.http)options.src=options.http;var script=document.createElement("script");script.type="text/javascript";script.async=true;script.src=options.src;if("function"==type(fn)){onload(script,fn)}tick(function(){var firstScript=document.getElementsByTagName("script")[0];firstScript.parentNode.insertBefore(script,firstScript)});return script}},{"script-onload":108,"next-tick":97,type:7}],13:[function(require,module,exports){var integration=require("analytics.js-integration");var each=require("each");var Awesm=module.exports=integration("awe.sm").assumesPageview().global("AWESM").option("apiKey","").tag('<script src="//widgets.awe.sm/v3/widgets.js?key={{ apiKey }}&async=true">').mapping("events");Awesm.prototype.initialize=function(page){window.AWESM={api_key:this.options.apiKey};this.load(this.ready)};Awesm.prototype.loaded=function(){return!!(window.AWESM&&window.AWESM._exists)};Awesm.prototype.track=function(track){var user=this.analytics.user();var goals=this.events(track.event());each(goals,function(goal){window.AWESM.convert(goal,track.cents(),null,user.id())})}},{"analytics.js-integration":83,each:4}],14:[function(require,module,exports){var integration=require("analytics.js-integration");var is=require("is");var noop=function(){};var onBody=require("on-body");var Awesomatic=module.exports=integration("Awesomatic").assumesPageview().global("Awesomatic").global("AwesomaticSettings").global("AwsmSetup").global("AwsmTmp").option("appId","").tag('<script src="https://1c817b7a15b6941337c0-dff9b5f4adb7ba28259631e99c3f3691.ssl.cf2.rackcdn.com/gen/embed.js">');Awesomatic.prototype.initialize=function(page){var self=this;var user=this.analytics.user();var id=user.id();var options=user.traits();options.appId=this.options.appId;if(id)options.user_id=id;this.load(function(){window.Awesomatic.initialize(options,function(){self.ready()})})};Awesomatic.prototype.loaded=function(){return is.object(window.Awesomatic)}},{"analytics.js-integration":83,is:86,"on-body":119}],15:[function(require,module,exports){var integration=require("analytics.js-integration");var onbody=require("on-body");var domify=require("domify");var extend=require("extend");var bind=require("bind");var when=require("when");var each=require("each");var has=Object.prototype.hasOwnProperty;var noop=function(){};var Bing=module.exports=integration("Bing Ads").option("siteId","").option("domainId","").tag('<script id="mstag_tops" src="//flex.msn.com/mstag/site/{{ siteId }}/mstag.js">').mapping("events");Bing.prototype.initialize=function(page){if(!window.mstag){window.mstag={loadTag:noop,time:(new Date).getTime(),_write:writeToAppend}}var self=this;onbody(function(){self.load(function(){var loaded=bind(self,self.loaded);when(loaded,self.ready)})})};Bing.prototype.loaded=function(){return!!(window.mstag&&window.mstag.loadTag!==noop)};Bing.prototype.track=function(track){var events=this.events(track.event());var revenue=track.revenue()||0;var self=this;each(events,function(goal){window.mstag.loadTag("analytics",{domainId:self.options.domainId,revenue:revenue,dedup:"1",type:"1",actionid:goal})})};function writeToAppend(str){var first=document.getElementsByTagName("script")[0];var el=domify(str);if("script"==el.tagName.toLowerCase()&&el.getAttribute("src")){var tmp=document.createElement("script");tmp.src=el.getAttribute("src");tmp.async=true;el=tmp}document.body.appendChild(el)}},{"analytics.js-integration":83,"on-body":119,domify:120,extend:124,bind:95,when:125,each:4}],124:[function(require,module,exports){module.exports=function extend(object){var args=Array.prototype.slice.call(arguments,1);for(var i=0,source;source=args[i];i++){if(!source)continue;for(var property in source){object[property]=source[property]}}return object}},{}],125:[function(require,module,exports){var callback=require("callback");module.exports=when;function when(condition,fn,interval){if(condition())return callback.async(fn);var ref=setInterval(function(){if(!condition())return;callback(fn);clearInterval(ref)},interval||10)}},{callback:88}],16:[function(require,module,exports){var integration=require("analytics.js-integration");var Identify=require("facade").Identify;var Track=require("facade").Track;var pixel=require("load-pixel")("http://app.bronto.com/public/");var qs=require("querystring");var each=require("each");var Bronto=module.exports=integration("Bronto").global("__bta").option("siteId","").option("host","").tag('<script src="//p.bm23.com/bta.js">');Bronto.prototype.initialize=function(page){var self=this;var params=qs.parse(window.location.search);if(!params._bta_tid&&!params._bta_c){this.debug("missing tracking URL parameters `_bta_tid` and `_bta_c`.")}this.load(function(){var opts=self.options;self.bta=new window.__bta(opts.siteId);if(opts.host)self.bta.setHost(opts.host);self.ready()})};Bronto.prototype.loaded=function(){return this.bta};Bronto.prototype.completedOrder=function(track){var user=this.analytics.user();var products=track.products();var props=track.properties();var items=[];var identify=new Identify({userId:user.id(),traits:user.traits()});var email=identify.email();each(products,function(product){var track=new Track({properties:product});items.push({item_id:track.id()||track.sku(),desc:product.description||track.name(),quantity:track.quantity(),amount:track.price()})});this.bta.addOrder({order_id:track.orderId(),email:email,items:items})}},{"analytics.js-integration":83,facade:126,"load-pixel":127,querystring:128,each:4}],126:[function(require,module,exports){var Facade=require("./facade");module.exports=Facade;Facade.Alias=require("./alias");Facade.Group=require("./group");Facade.Identify=require("./identify");Facade.Track=require("./track");Facade.Page=require("./page");Facade.Screen=require("./screen")},{"./facade":129,"./alias":130,"./group":131,"./identify":132,"./track":133,"./page":134,"./screen":135}],129:[function(require,module,exports){var clone=require("./utils").clone;var type=require("./utils").type;var isEnabled=require("./is-enabled");var objCase=require("obj-case");var traverse=require("isodate-traverse");var newDate=require("new-date");module.exports=Facade;function Facade(obj){if(!obj.hasOwnProperty("timestamp"))obj.timestamp=new Date;else obj.timestamp=newDate(obj.timestamp);traverse(obj);this.obj=obj}Facade.prototype.proxy=function(field){var fields=field.split(".");field=fields.shift();var obj=this[field]||this.field(field);if(!obj)return obj;if(typeof obj==="function")obj=obj.call(this)||{};if(fields.length===0)return transform(obj);obj=objCase(obj,fields.join("."));return transform(obj)};Facade.prototype.field=function(field){var obj=this.obj[field];return transform(obj)};Facade.proxy=function(field){return function(){return this.proxy(field)}};Facade.field=function(field){return function(){return this.field(field)}};Facade.multi=function(path){return function(){var multi=this.proxy(path+"s");if("array"==type(multi))return multi;var one=this.proxy(path);if(one)one=[clone(one)];return one||[]}};Facade.one=function(path){return function(){var one=this.proxy(path);if(one)return one;var multi=this.proxy(path+"s");if("array"==type(multi))return multi[0]}};Facade.prototype.json=function(){var ret=clone(this.obj);if(this.type)ret.type=this.type();return ret};Facade.prototype.context=Facade.prototype.options=function(integration){var options=clone(this.obj.options||this.obj.context)||{};if(!integration)return clone(options);if(!this.enabled(integration))return;var integrations=this.integrations();var value=integrations[integration]||objCase(integrations,integration);if("boolean"==typeof value)value={};return value||{}};Facade.prototype.enabled=function(integration){var allEnabled=this.proxy("options.providers.all");if(typeof allEnabled!=="boolean")allEnabled=this.proxy("options.all");if(typeof allEnabled!=="boolean")allEnabled=this.proxy("integrations.all");if(typeof allEnabled!=="boolean")allEnabled=true;var enabled=allEnabled&&isEnabled(integration);var options=this.integrations();if(options.providers&&options.providers.hasOwnProperty(integration)){enabled=options.providers[integration]}if(options.hasOwnProperty(integration)){var settings=options[integration];if(typeof settings==="boolean"){enabled=settings}else{enabled=true}}return enabled?true:false};Facade.prototype.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()};Facade.prototype.active=function(){var active=this.proxy("options.active");if(active===null||active===undefined)active=true;return active};Facade.prototype.sessionId=Facade.prototype.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")};Facade.prototype.groupId=Facade.proxy("options.groupId");Facade.prototype.traits=function(aliases){var ret=this.proxy("options.traits")||{};var id=this.userId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=null==this[alias]?this.proxy("options.traits."+alias):this[alias]();if(null==value)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Facade.prototype.library=function(){var library=this.proxy("options.library");if(!library)return{name:"unknown",version:null};if(typeof library==="string")return{name:library,version:null};return library};Facade.prototype.userId=Facade.field("userId");Facade.prototype.channel=Facade.field("channel");Facade.prototype.timestamp=Facade.field("timestamp");Facade.prototype.userAgent=Facade.proxy("options.userAgent");Facade.prototype.ip=Facade.proxy("options.ip");function transform(obj){var cloned=clone(obj);return cloned}},{"./utils":136,"./is-enabled":137,"obj-case":138,"isodate-traverse":139,"new-date":140}],136:[function(require,module,exports){try{exports.inherit=require("inherit");exports.clone=require("clone");exports.type=require("type")}catch(e){exports.inherit=require("inherit-component");exports.clone=require("clone-component");exports.type=require("type-component")}},{inherit:141,clone:142,type:7}],141:[function(require,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],142:[function(require,module,exports){var type;try{type=require("component-type")}catch(_){type=require("type")}module.exports=clone;function clone(obj){switch(type(obj)){case"object":var copy={};for(var key in obj){if(obj.hasOwnProperty(key)){copy[key]=clone(obj[key])}}return copy;case"array":var copy=new Array(obj.length);for(var i=0,l=obj.length;i<l;i++){copy[i]=clone(obj[i])}return copy;case"regexp":var flags="";flags+=obj.multiline?"m":"";flags+=obj.global?"g":"";flags+=obj.ignoreCase?"i":"";return new RegExp(obj.source,flags);case"date":return new Date(obj.getTime());default:return obj}}},{"component-type":7,type:7}],137:[function(require,module,exports){var disabled={Salesforce:true};module.exports=function(integration){return!disabled[integration]}},{}],138:[function(require,module,exports){var Case=require("case");var identity=function(_){return _};var cases=[identity,Case.upper,Case.lower,Case.snake,Case.pascal,Case.camel,Case.constant,Case.title,Case.capital,Case.sentence];module.exports=module.exports.find=multiple(find);module.exports.replace=function(obj,key,val){multiple(replace).apply(this,arguments);return obj};module.exports.del=function(obj,key){multiple(del).apply(this,arguments);return obj};function multiple(fn){return function(obj,key,val){var keys=key.split(".");if(keys.length===0)return;while(keys.length>1){key=keys.shift();obj=find(obj,key);if(obj===null||obj===undefined)return}key=keys.shift();return fn(obj,key,val)}}function find(obj,key){for(var i=0;i<cases.length;i++){var cased=cases[i](key);if(obj.hasOwnProperty(cased))return obj[cased]}}function del(obj,key){for(var i=0;i<cases.length;i++){var cased=cases[i](key);if(obj.hasOwnProperty(cased))delete obj[cased]}return obj}function replace(obj,key,val){for(var i=0;i<cases.length;i++){var cased=cases[i](key);if(obj.hasOwnProperty(cased))obj[cased]=val}return obj}},{"case":143}],143:[function(require,module,exports){var cases=require("./cases");module.exports=exports=determineCase;function determineCase(string){for(var key in cases){if(key=="none")continue;var convert=cases[key];if(convert(string)==string)return key}return null}exports.add=function(name,convert){exports[name]=cases[name]=convert};for(var key in cases){exports.add(key,cases[key])}},{"./cases":144}],144:[function(require,module,exports){var camel=require("to-camel-case"),capital=require("to-capital-case"),constant=require("to-constant-case"),dot=require("to-dot-case"),none=require("to-no-case"),pascal=require("to-pascal-case"),sentence=require("to-sentence-case"),slug=require("to-slug-case"),snake=require("to-snake-case"),space=require("to-space-case"),title=require("to-title-case");exports.camel=camel;exports.pascal=pascal;exports.dot=dot;exports.slug=slug;exports.snake=snake;exports.space=space;exports.constant=constant;exports.capital=capital;exports.title=title;exports.sentence=sentence;exports.lower=function(string){return none(string).toLowerCase()};exports.upper=function(string){return none(string).toUpperCase()};exports.inverse=function(string){for(var i=0,char;char=string[i];i++){if(!/[a-z]/i.test(char))continue;var upper=char.toUpperCase();var lower=char.toLowerCase();string[i]=char==upper?lower:upper}return string};exports.none=none},{"to-camel-case":145,"to-capital-case":146,"to-constant-case":147,"to-dot-case":148,"to-no-case":117,"to-pascal-case":149,"to-sentence-case":150,"to-slug-case":151,"to-snake-case":152,"to-space-case":153,"to-title-case":154}],145:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toCamelCase;function toCamelCase(string){return toSpace(string).replace(/\s(\w)/g,function(matches,letter){return letter.toUpperCase()})}},{"to-space-case":153}],153:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSpaceCase;function toSpaceCase(string){return clean(string).replace(/[\W_]+(.|$)/g,function(matches,match){return match?" "+match:""})}},{"to-no-case":117}],146:[function(require,module,exports){var clean=require("to-no-case");module.exports=toCapitalCase;function toCapitalCase(string){return clean(string).replace(/(^|\s)(\w)/g,function(matches,previous,letter){return previous+letter.toUpperCase()})}},{"to-no-case":117}],147:[function(require,module,exports){var snake=require("to-snake-case");module.exports=toConstantCase;function toConstantCase(string){return snake(string).toUpperCase()}},{"to-snake-case":152}],152:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSnakeCase;function toSnakeCase(string){return toSpace(string).replace(/\s/g,"_")}},{"to-space-case":153}],148:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toDotCase;function toDotCase(string){return toSpace(string).replace(/\s/g,".")}},{"to-space-case":153}],149:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toPascalCase;function toPascalCase(string){return toSpace(string).replace(/(?:^|\s)(\w)/g,function(matches,letter){return letter.toUpperCase()})}},{"to-space-case":153}],150:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSentenceCase;function toSentenceCase(string){return clean(string).replace(/[a-z]/i,function(letter){return letter.toUpperCase()})}},{"to-no-case":117}],151:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toSlugCase;function toSlugCase(string){return toSpace(string).replace(/\s/g,"-")}},{"to-space-case":153}],154:[function(require,module,exports){var capital=require("to-capital-case"),escape=require("escape-regexp"),map=require("map"),minors=require("title-case-minors");module.exports=toTitleCase;var escaped=map(minors,escape);var minorMatcher=new RegExp("[^^]\\b("+escaped.join("|")+")\\b","ig");var colonMatcher=/:\s*(\w)/g;function toTitleCase(string){return capital(string).replace(minorMatcher,function(minor){return minor.toLowerCase()}).replace(colonMatcher,function(letter){return letter.toUpperCase()})}},{"to-capital-case":146,"escape-regexp":155,map:156,"title-case-minors":157}],155:[function(require,module,exports){module.exports=function(str){return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g,"\\$1")}},{}],156:[function(require,module,exports){var each=require("each");module.exports=function map(obj,iterator){var arr=[];each(obj,function(o){arr.push(iterator.apply(null,arguments))});return arr}},{each:106}],157:[function(require,module,exports){module.exports=["a","an","and","as","at","but","by","en","for","from","how","if","in","neither","nor","of","on","only","onto","out","or","per","so","than","that","the","to","until","up","upon","v","v.","versus","vs","vs.","via","when","with","without","yet"]},{}],139:[function(require,module,exports){var is=require("is");var isodate=require("isodate");var each;try{each=require("each")}catch(err){each=require("each-component")}module.exports=traverse;function traverse(input,strict){if(strict===undefined)strict=true; if(is.object(input))return object(input,strict);if(is.array(input))return array(input,strict);return input}function object(obj,strict){each(obj,function(key,val){if(isodate.is(val,strict)){obj[key]=isodate.parse(val)}else if(is.object(val)||is.array(val)){traverse(val,strict)}});return obj}function array(arr,strict){each(arr,function(val,x){if(is.object(val)){traverse(val,strict)}else if(isodate.is(val,strict)){arr[x]=isodate.parse(val)}});return arr}},{is:158,isodate:159,each:4}],158:[function(require,module,exports){var isEmpty=require("is-empty");try{var typeOf=require("type")}catch(e){var typeOf=require("component-type")}var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":118,type:7,"component-type":7}],159:[function(require,module,exports){var matcher=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;exports.parse=function(iso){var numericKeys=[1,5,6,7,11,12];var arr=matcher.exec(iso);var offset=0;if(!arr)return new Date(iso);for(var i=0,val;val=numericKeys[i];i++){arr[val]=parseInt(arr[val],10)||0}arr[2]=parseInt(arr[2],10)||1;arr[3]=parseInt(arr[3],10)||1;arr[2]--;arr[8]=arr[8]?(arr[8]+"00").substring(0,3):0;if(arr[4]==" "){offset=(new Date).getTimezoneOffset()}else if(arr[9]!=="Z"&&arr[10]){offset=arr[11]*60+arr[12];if("+"==arr[10])offset=0-offset}var millis=Date.UTC(arr[1],arr[2],arr[3],arr[5],arr[6]+offset,arr[7],arr[8]);return new Date(millis)};exports.is=function(string,strict){if(strict&&false===/^\d{4}-\d{2}-\d{2}/.test(string))return false;return matcher.test(string)}},{}],140:[function(require,module,exports){var is=require("is");var isodate=require("isodate");var milliseconds=require("./milliseconds");var seconds=require("./seconds");module.exports=function newDate(val){if(is.date(val))return val;if(is.number(val))return new Date(toMs(val));if(isodate.is(val))return isodate.parse(val);if(milliseconds.is(val))return milliseconds.parse(val);if(seconds.is(val))return seconds.parse(val);return new Date(val)};function toMs(num){if(num<315576e5)return num*1e3;return num}},{is:160,isodate:159,"./milliseconds":161,"./seconds":162}],160:[function(require,module,exports){var isEmpty=require("is-empty"),typeOf=require("type");var types=["arguments","array","boolean","date","element","function","null","number","object","regexp","string","undefined"];for(var i=0,type;type=types[i];i++)exports[type]=generate(type);exports.fn=exports["function"];exports.empty=isEmpty;exports.nan=function(val){return exports.number(val)&&val!=val};function generate(type){return function(value){return type===typeOf(value)}}},{"is-empty":118,type:7}],161:[function(require,module,exports){var matcher=/\d{13}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(millis){millis=parseInt(millis,10);return new Date(millis)}},{}],162:[function(require,module,exports){var matcher=/\d{10}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(seconds){var millis=parseInt(seconds,10)*1e3;return new Date(millis)}},{}],130:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");module.exports=Alias;function Alias(dictionary){Facade.call(this,dictionary)}inherit(Alias,Facade);Alias.prototype.type=Alias.prototype.action=function(){return"alias"};Alias.prototype.from=Alias.prototype.previousId=function(){return this.field("previousId")||this.field("from")};Alias.prototype.to=Alias.prototype.userId=function(){return this.field("userId")||this.field("to")}},{"./utils":136,"./facade":129}],131:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");var newDate=require("new-date");module.exports=Group;function Group(dictionary){Facade.call(this,dictionary)}inherit(Group,Facade);Group.prototype.type=Group.prototype.action=function(){return"group"};Group.prototype.groupId=Facade.field("groupId");Group.prototype.created=function(){var created=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(created)return newDate(created)};Group.prototype.traits=function(aliases){var ret=this.properties();var id=this.groupId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=null==this[alias]?this.proxy("traits."+alias):this[alias]();if(null==value)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Group.prototype.properties=function(){return this.field("traits")||this.field("properties")||{}}},{"./utils":136,"./facade":129,"new-date":140}],132:[function(require,module,exports){var Facade=require("./facade");var isEmail=require("is-email");var newDate=require("new-date");var utils=require("./utils");var get=require("obj-case");var trim=require("trim");var inherit=utils.inherit;var clone=utils.clone;var type=utils.type;module.exports=Identify;function Identify(dictionary){Facade.call(this,dictionary)}inherit(Identify,Facade);Identify.prototype.type=Identify.prototype.action=function(){return"identify"};Identify.prototype.traits=function(aliases){var ret=this.field("traits")||{};var id=this.userId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=null==this[alias]?this.proxy("traits."+alias):this[alias]();if(null==value)continue;ret[aliases[alias]]=value;if(alias!==aliases[alias])delete ret[alias]}return ret};Identify.prototype.email=function(){var email=this.proxy("traits.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Identify.prototype.created=function(){var created=this.proxy("traits.created")||this.proxy("traits.createdAt");if(created)return newDate(created)};Identify.prototype.companyCreated=function(){var created=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(created)return newDate(created)};Identify.prototype.name=function(){var name=this.proxy("traits.name");if(typeof name==="string")return trim(name);var firstName=this.firstName();var lastName=this.lastName();if(firstName&&lastName)return trim(firstName+" "+lastName)};Identify.prototype.firstName=function(){var firstName=this.proxy("traits.firstName");if(typeof firstName==="string")return trim(firstName);var name=this.proxy("traits.name");if(typeof name==="string")return trim(name).split(" ")[0]};Identify.prototype.lastName=function(){var lastName=this.proxy("traits.lastName");if(typeof lastName==="string")return trim(lastName);var name=this.proxy("traits.name");if(typeof name!=="string")return;var space=trim(name).indexOf(" ");if(space===-1)return;return trim(name.substr(space+1))};Identify.prototype.uid=function(){return this.userId()||this.username()||this.email()};Identify.prototype.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")};Identify.prototype.age=function(){var date=this.birthday();var age=get(this.traits(),"age");if(null!=age)return age;if("date"!=type(date))return;var now=new Date;return now.getFullYear()-date.getFullYear()};Identify.prototype.avatar=function(){var traits=this.traits();return get(traits,"avatar")||get(traits,"photoUrl")};Identify.prototype.position=function(){var traits=this.traits();return get(traits,"position")||get(traits,"jobTitle")};Identify.prototype.username=Facade.proxy("traits.username");Identify.prototype.website=Facade.one("traits.website");Identify.prototype.websites=Facade.multi("traits.website");Identify.prototype.phone=Facade.one("traits.phone");Identify.prototype.phones=Facade.multi("traits.phone");Identify.prototype.address=Facade.proxy("traits.address");Identify.prototype.gender=Facade.proxy("traits.gender");Identify.prototype.birthday=Facade.proxy("traits.birthday")},{"./facade":129,"is-email":163,"new-date":140,"./utils":136,"obj-case":138,trim:164}],163:[function(require,module,exports){module.exports=isEmail;var matcher=/.+\@.+\..+/;function isEmail(string){return matcher.test(string)}},{}],164:[function(require,module,exports){exports=module.exports=trim;function trim(str){if(str.trim)return str.trim();return str.replace(/^\s*|\s*$/g,"")}exports.left=function(str){if(str.trimLeft)return str.trimLeft();return str.replace(/^\s*/,"")};exports.right=function(str){if(str.trimRight)return str.trimRight();return str.replace(/\s*$/,"")}},{}],133:[function(require,module,exports){var inherit=require("./utils").inherit;var clone=require("./utils").clone;var type=require("./utils").type;var Facade=require("./facade");var Identify=require("./identify");var isEmail=require("is-email");var get=require("obj-case");module.exports=Track;function Track(dictionary){Facade.call(this,dictionary)}inherit(Track,Facade);Track.prototype.type=Track.prototype.action=function(){return"track"};Track.prototype.event=Facade.field("event");Track.prototype.value=Facade.proxy("properties.value");Track.prototype.category=Facade.proxy("properties.category");Track.prototype.country=Facade.proxy("properties.country");Track.prototype.state=Facade.proxy("properties.state");Track.prototype.city=Facade.proxy("properties.city");Track.prototype.zip=Facade.proxy("properties.zip");Track.prototype.id=Facade.proxy("properties.id");Track.prototype.sku=Facade.proxy("properties.sku");Track.prototype.tax=Facade.proxy("properties.tax");Track.prototype.name=Facade.proxy("properties.name");Track.prototype.price=Facade.proxy("properties.price");Track.prototype.total=Facade.proxy("properties.total");Track.prototype.coupon=Facade.proxy("properties.coupon");Track.prototype.shipping=Facade.proxy("properties.shipping");Track.prototype.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.orderId")};Track.prototype.subtotal=function(){var subtotal=get(this.properties(),"subtotal");var total=this.total();var n;if(subtotal)return subtotal;if(!total)return 0;if(n=this.tax())total-=n;if(n=this.shipping())total-=n;return total};Track.prototype.products=function(){var props=this.properties();var products=get(props,"products");return"array"==type(products)?products:[]};Track.prototype.quantity=function(){var props=this.obj.properties||{};return props.quantity||1};Track.prototype.currency=function(){var props=this.obj.properties||{};return props.currency||"USD"};Track.prototype.referrer=Facade.proxy("properties.referrer");Track.prototype.query=Facade.proxy("options.query");Track.prototype.properties=function(aliases){var ret=this.field("properties")||{};aliases=aliases||{};for(var alias in aliases){var value=null==this[alias]?this.proxy("properties."+alias):this[alias]();if(null==value)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Track.prototype.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()};Track.prototype.email=function(){var email=this.proxy("traits.email");email=email||this.proxy("properties.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Track.prototype.revenue=function(){var revenue=this.proxy("properties.revenue");var event=this.event();if(!revenue&&event&&event.match(/completed ?order/i)){revenue=this.proxy("properties.total")}return currency(revenue)};Track.prototype.cents=function(){var revenue=this.revenue();return"number"!=typeof revenue?this.value()||0:revenue*100};Track.prototype.identify=function(){var json=this.json();json.traits=this.traits();return new Identify(json)};function currency(val){if(!val)return;if(typeof val==="number")return val;if(typeof val!=="string")return;val=val.replace(/\$/g,"");val=parseFloat(val);if(!isNaN(val))return val}},{"./utils":136,"./facade":129,"./identify":132,"is-email":163,"obj-case":138}],134:[function(require,module,exports){var inherit=require("./utils").inherit;var Facade=require("./facade");var Track=require("./track");module.exports=Page;function Page(dictionary){Facade.call(this,dictionary)}inherit(Page,Facade);Page.prototype.type=Page.prototype.action=function(){return"page"};Page.prototype.category=Facade.field("category");Page.prototype.name=Facade.field("name");Page.prototype.properties=function(){var props=this.field("properties")||{};var category=this.category();var name=this.name();if(category)props.category=category;if(name)props.name=name;return props};Page.prototype.fullName=function(){var category=this.category();var name=this.name();return name&&category?category+" "+name:name};Page.prototype.event=function(name){return name?"Viewed "+name+" Page":"Loaded a Page"};Page.prototype.track=function(name){var props=this.properties();return new Track({event:this.event(name),timestamp:this.timestamp(),context:this.context(),properties:props})}},{"./utils":136,"./facade":129,"./track":133}],135:[function(require,module,exports){var inherit=require("./utils").inherit;var Page=require("./page");var Track=require("./track");module.exports=Screen;function Screen(dictionary){Page.call(this,dictionary)}inherit(Screen,Page);Screen.prototype.type=Screen.prototype.action=function(){return"screen"};Screen.prototype.event=function(name){return name?"Viewed "+name+" Screen":"Loaded a Screen"};Screen.prototype.track=function(name){var props=this.properties();return new Track({event:this.event(name),timestamp:this.timestamp(),context:this.context(),properties:props})}},{"./utils":136,"./page":134,"./track":133}],127:[function(require,module,exports){var stringify=require("querystring").stringify;var sub=require("substitute");module.exports=function(path){return function(query,obj,fn){if("function"==typeof obj)fn=obj,obj={};obj=obj||{};fn=fn||function(){};var url=sub(path,obj);var img=new Image;img.onerror=error(fn,"failed to load pixel",img);img.onload=function(){fn()};query=stringify(query);if(query)query="?"+query;img.src=url+query;img.width=1;img.height=1;return img}};function error(fn,message,img){return function(e){e=e||window.event;var err=new Error(message);err.event=e;err.source=img;fn(err)}}},{querystring:128,substitute:165}],128:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;var trim=require("trim");var type=require("type");exports.parse=function(str){if("string"!=typeof str)return{};str=trim(str);if(""==str)return{};if("?"==str.charAt(0))str=str.slice(1);var obj={};var pairs=str.split("&");for(var i=0;i<pairs.length;i++){var parts=pairs[i].split("=");var key=decode(parts[0]);var m;if(m=/(\w+)\[(\d+)\]/.exec(key)){obj[m[1]]=obj[m[1]]||[];obj[m[1]][m[2]]=decode(parts[1]);continue}obj[parts[0]]=null==parts[1]?"":decode(parts[1])}return obj};exports.stringify=function(obj){if(!obj)return"";var pairs=[];for(var key in obj){var value=obj[key];if("array"==type(value)){for(var i=0;i<value.length;++i){pairs.push(encode(key+"["+i+"]")+"="+encode(value[i]))}continue}pairs.push(encode(key)+"="+encode(obj[key]))}return pairs.join("&")}},{trim:164,type:7}],165:[function(require,module,exports){module.exports=substitute;function substitute(str,obj,expr){if(!obj)throw new TypeError("expected an object");expr=expr||/:(\w+)/g;return str.replace(expr,function(_,prop){return null!=obj[prop]?obj[prop]:_})}},{}],17:[function(require,module,exports){var integration=require("analytics.js-integration");var tick=require("next-tick");var BugHerd=module.exports=integration("BugHerd").assumesPageview().global("BugHerdConfig").global("_bugHerd").option("apiKey","").option("showFeedbackTab",true).tag('<script src="//www.bugherd.com/sidebarv2.js?apikey={{ apiKey }}">');BugHerd.prototype.initialize=function(page){window.BugHerdConfig={feedback:{hide:!this.options.showFeedbackTab}};var ready=this.ready;this.load(function(){tick(ready)})};BugHerd.prototype.loaded=function(){return!!window._bugHerd}},{"analytics.js-integration":83,"next-tick":97}],18:[function(require,module,exports){var integration=require("analytics.js-integration");var is=require("is");var extend=require("extend");var onError=require("on-error");var Bugsnag=module.exports=integration("Bugsnag").global("Bugsnag").option("apiKey","").tag('<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js">');Bugsnag.prototype.initialize=function(page){var self=this;this.load(function(){window.Bugsnag.apiKey=self.options.apiKey;self.ready()})};Bugsnag.prototype.loaded=function(){return is.object(window.Bugsnag)};Bugsnag.prototype.identify=function(identify){window.Bugsnag.metaData=window.Bugsnag.metaData||{};extend(window.Bugsnag.metaData,identify.traits())}},{"analytics.js-integration":83,is:86,extend:124,"on-error":166}],166:[function(require,module,exports){module.exports=onError;var callbacks=[];if("function"==typeof window.onerror)callbacks.push(window.onerror);window.onerror=handler;function handler(){for(var i=0,fn;fn=callbacks[i];i++)fn.apply(this,arguments)}function onError(fn){callbacks.push(fn);if(window.onerror!=handler){callbacks.push(window.onerror);window.onerror=handler}}},{}],19:[function(require,module,exports){var integration=require("analytics.js-integration");var defaults=require("defaults");var onBody=require("on-body");var Chartbeat=module.exports=integration("Chartbeat").assumesPageview().global("_sf_async_config").global("_sf_endpt").global("pSUPERFLY").option("domain","").option("uid",null).tag('<script src="//static.chartbeat.com/js/chartbeat.js">');Chartbeat.prototype.initialize=function(page){var self=this;window._sf_async_config=window._sf_async_config||{};window._sf_async_config.useCanonical=true;defaults(window._sf_async_config,this.options);onBody(function(){window._sf_endpt=(new Date).getTime();self.load(self.ready)})};Chartbeat.prototype.loaded=function(){return!!window.pSUPERFLY};Chartbeat.prototype.page=function(page){var props=page.properties();var name=page.fullName();window.pSUPERFLY.virtualPage(props.path,name||props.title)}},{"analytics.js-integration":83,defaults:167,"on-body":119}],167:[function(require,module,exports){module.exports=defaults;function defaults(dest,defaults){for(var prop in defaults){if(!(prop in dest)){dest[prop]=defaults[prop]}}return dest}},{}],20:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_cbq");var each=require("each");var has=Object.prototype.hasOwnProperty;var supported={activation:true,changePlan:true,register:true,refund:true,charge:true,cancel:true,login:true};var ChurnBee=module.exports=integration("ChurnBee").global("_cbq").global("ChurnBee").option("apiKey","").tag('<script src="//api.churnbee.com/cb.js">').mapping("events");ChurnBee.prototype.initialize=function(page){push("_setApiKey",this.options.apiKey);this.load(this.ready)};ChurnBee.prototype.loaded=function(){return!!window.ChurnBee};ChurnBee.prototype.track=function(track){var event=track.event();var events=this.events(event);events.push(event);each(events,function(event){if(true!=supported[event])return;push(event,track.properties({revenue:"amount"}))})}},{"analytics.js-integration":83,"global-queue":168,each:4}],168:[function(require,module,exports){module.exports=generate;function generate(name,options){options=options||{};return function(args){args=[].slice.call(arguments);window[name]||(window[name]=[]);options.wrap===false?window[name].push.apply(window[name],args):window[name].push(args)}}},{}],21:[function(require,module,exports){var date=require("load-date");var domify=require("domify");var each=require("each");var integration=require("analytics.js-integration");var is=require("is");var useHttps=require("use-https");var onBody=require("on-body");var ClickTale=module.exports=integration("ClickTale").assumesPageview().global("WRInitTime").global("ClickTale").global("ClickTaleSetUID").global("ClickTaleField").global("ClickTaleEvent").option("httpCdnUrl","http://s.clicktale.net/WRe0.js").option("httpsCdnUrl","").option("projectId","").option("recordingRatio",.01).option("partitionId","").tag('<script src="{{src}}">');ClickTale.prototype.initialize=function(page){var self=this;window.WRInitTime=date.getTime();onBody(function(body){body.appendChild(domify('<div id="ClickTaleDiv" style="display: none;">'))});var http=this.options.httpCdnUrl;var https=this.options.httpsCdnUrl;if(useHttps()&&!https)return this.debug("https option required");var src=useHttps()?https:http;this.load({src:src},function(){window.ClickTale(self.options.projectId,self.options.recordingRatio,self.options.partitionId);self.ready()})};ClickTale.prototype.loaded=function(){return is.fn(window.ClickTale)};ClickTale.prototype.identify=function(identify){var id=identify.userId();window.ClickTaleSetUID(id);each(identify.traits(),function(key,value){window.ClickTaleField(key,value)})};ClickTale.prototype.track=function(track){window.ClickTaleEvent(track.event())}},{"load-date":169,domify:120,each:4,"analytics.js-integration":83,is:86,"use-https":85,"on-body":119}],169:[function(require,module,exports){var time=new Date,perf=window.performance;if(perf&&perf.timing&&perf.timing.responseEnd){time=new Date(perf.timing.responseEnd)}module.exports=time},{}],22:[function(require,module,exports){var Identify=require("facade").Identify;var extend=require("extend");var integration=require("analytics.js-integration");var is=require("is");var Clicky=module.exports=integration("Clicky").assumesPageview().global("clicky").global("clicky_site_ids").global("clicky_custom").option("siteId",null).tag('<script src="//static.getclicky.com/js"></script>');Clicky.prototype.initialize=function(page){var user=this.analytics.user();window.clicky_site_ids=window.clicky_site_ids||[this.options.siteId];this.identify(new Identify({userId:user.id(),traits:user.traits()}));this.load(this.ready)};Clicky.prototype.loaded=function(){return is.object(window.clicky)};Clicky.prototype.page=function(page){var properties=page.properties();var category=page.category();var name=page.fullName();window.clicky.log(properties.path,name||properties.title)};Clicky.prototype.identify=function(identify){window.clicky_custom=window.clicky_custom||{};window.clicky_custom.session=window.clicky_custom.session||{};extend(window.clicky_custom.session,identify.traits())};Clicky.prototype.track=function(track){window.clicky.goal(track.event(),track.revenue())}},{facade:126,extend:124,"analytics.js-integration":83,is:86}],23:[function(require,module,exports){var integration=require("analytics.js-integration");var useHttps=require("use-https");var Comscore=module.exports=integration("comScore").assumesPageview().global("_comscore").global("COMSCORE").option("c1","2").option("c2","").tag("http",'<script src="http://b.scorecardresearch.com/beacon.js">').tag("https",'<script src="https://sb.scorecardresearch.com/beacon.js">');Comscore.prototype.initialize=function(page){window._comscore=window._comscore||[this.options];var name=useHttps()?"https":"http";this.load(name,this.ready)};Comscore.prototype.loaded=function(){return!!window.COMSCORE}},{"analytics.js-integration":83,"use-https":85}],24:[function(require,module,exports){var integration=require("analytics.js-integration");var CrazyEgg=module.exports=integration("Crazy Egg").assumesPageview().global("CE2").option("accountNumber","").tag('<script src="//dnn506yrbagrg.cloudfront.net/pages/scripts/{{ path }}.js?{{ cache }}">');CrazyEgg.prototype.initialize=function(page){var number=this.options.accountNumber;var path=number.slice(0,4)+"/"+number.slice(4);var cache=Math.floor((new Date).getTime()/36e5);this.load({path:path,cache:cache},this.ready)};CrazyEgg.prototype.loaded=function(){return!!window.CE2}},{"analytics.js-integration":83}],25:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_curebitq");var Identify=require("facade").Identify;var throttle=require("throttle");var Track=require("facade").Track;var iso=require("to-iso-string");var clone=require("clone");var each=require("each");var bind=require("bind");var Curebit=module.exports=integration("Curebit").global("_curebitq").global("curebit").option("siteId","").option("iframeWidth","100%").option("iframeHeight","480").option("iframeBorder",0).option("iframeId","curebit_integration").option("responsive",true).option("device","").option("insertIntoId","").option("campaigns",{}).option("server","https://www.curebit.com").tag('<script src="//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js">');Curebit.prototype.initialize=function(page){push("init",{site_id:this.options.siteId,server:this.options.server});this.load(this.ready);this.page=throttle(bind(this,this.page),250)};Curebit.prototype.loaded=function(){return!!window.curebit};Curebit.prototype.injectIntoId=function(url,id,fn){var server=this.options.server;when(function(){return document.getElementById(id)},function(){var script=document.createElement("script");script.src=url;var parent=document.getElementById(id);parent.appendChild(script);onload(script,fn)})};Curebit.prototype.page=function(page){var user=this.analytics.user();var campaigns=this.options.campaigns;var path=window.location.pathname;if(!campaigns[path])return;var tags=(campaigns[path]||"").split(",");if(!tags.length)return;var settings={responsive:this.options.responsive,device:this.options.device,campaign_tags:tags,iframe:{width:this.options.iframeWidth,height:this.options.iframeHeight,id:this.options.iframeId,frameborder:this.options.iframeBorder,container:this.options.insertIntoId}};var identify=new Identify({userId:user.id(),traits:user.traits()});if(identify.email()){settings.affiliate_member={email:identify.email(),first_name:identify.firstName(),last_name:identify.lastName(),customer_id:identify.userId()}}push("register_affiliate",settings)};Curebit.prototype.completedOrder=function(track){var user=this.analytics.user();var orderId=track.orderId();var products=track.products();var props=track.properties();var items=[];var identify=new Identify({traits:user.traits(),userId:user.id()});each(products,function(product){var track=new Track({properties:product});items.push({product_id:track.id()||track.sku(),quantity:track.quantity(),image_url:product.image,price:track.price(),title:track.name(),url:product.url})});push("register_purchase",{order_date:iso(props.date||new Date),order_number:orderId,coupon_code:track.coupon(),subtotal:track.total(),customer_id:identify.userId(),first_name:identify.firstName(),last_name:identify.lastName(),email:identify.email(),items:items})}},{"analytics.js-integration":83,"global-queue":168,facade:126,throttle:170,"to-iso-string":171,clone:172,each:4,bind:95}],170:[function(require,module,exports){module.exports=throttle;function throttle(func,wait){var rtn;var last=0;return function throttled(){var now=(new Date).getTime();var delta=now-last;if(delta>=wait){rtn=func.apply(this,arguments);last=now}return rtn}}},{}],171:[function(require,module,exports){module.exports=toIsoString;function toIsoString(date){return date.getUTCFullYear()+"-"+pad(date.getUTCMonth()+1)+"-"+pad(date.getUTCDate())+"T"+pad(date.getUTCHours())+":"+pad(date.getUTCMinutes())+":"+pad(date.getUTCSeconds())+"."+String((date.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}function pad(number){var n=number.toString();return n.length===1?"0"+n:n}},{}],172:[function(require,module,exports){var type;try{type=require("type")}catch(e){type=require("type-component")}module.exports=clone;function clone(obj){switch(type(obj)){case"object":var copy={};for(var key in obj){if(obj.hasOwnProperty(key)){copy[key]=clone(obj[key])}}return copy;case"array":var copy=new Array(obj.length);for(var i=0,l=obj.length;i<l;i++){copy[i]=clone(obj[i])}return copy;case"regexp":var flags="";flags+=obj.multiline?"m":"";flags+=obj.global?"g":"";flags+=obj.ignoreCase?"i":"";return new RegExp(obj.source,flags);case"date":return new Date(obj.getTime());default:return obj}}},{type:7}],26:[function(require,module,exports){var alias=require("alias");var convertDates=require("convert-dates");var Identify=require("facade").Identify;var integration=require("analytics.js-integration");var Customerio=module.exports=integration("Customer.io").assumesPageview().global("_cio").option("siteId","").tag('<script id="cio-tracker" src="https://assets.customer.io/assets/track.js" data-site-id="{{ siteId }}">');Customerio.prototype.initialize=function(page){window._cio=window._cio||[];(function(){var a,b,c;a=function(f){return function(){window._cio.push([f].concat(Array.prototype.slice.call(arguments,0)))}};b=["identify","track"];for(c=0;c<b.length;c++){window._cio[b[c]]=a(b[c])}})();this.load(this.ready)};Customerio.prototype.loaded=function(){return!!window._cio&&window._cio.push!==Array.prototype.push};Customerio.prototype.identify=function(identify){if(!identify.userId())return this.debug("user id required");var traits=identify.traits({created:"created_at"});traits=convertDates(traits,convertDate);window._cio.identify(traits)};Customerio.prototype.group=function(group){var traits=group.traits();var user=this.analytics.user();traits=alias(traits,function(trait){return"Group "+trait});this.identify(new Identify({userId:user.id(),traits:traits}))};Customerio.prototype.track=function(track){var properties=track.properties();properties=convertDates(properties,convertDate);window._cio.track(track.event(),properties)};function convertDate(date){return Math.floor(date.getTime()/1e3)}},{alias:173,"convert-dates":174,facade:126,"analytics.js-integration":83}],173:[function(require,module,exports){var type=require("type");try{var clone=require("clone")}catch(e){var clone=require("clone-component")}module.exports=alias;function alias(obj,method){switch(type(method)){case"object":return aliasByDictionary(clone(obj),method);case"function":return aliasByFunction(clone(obj),method)}}function aliasByDictionary(obj,aliases){for(var key in aliases){if(undefined===obj[key])continue;obj[aliases[key]]=obj[key];delete obj[key]}return obj}function aliasByFunction(obj,convert){var output={};for(var key in obj)output[convert(key)]=obj[key];return output}},{type:7,clone:142}],174:[function(require,module,exports){var is=require("is");try{var clone=require("clone")}catch(e){var clone=require("clone-component")}module.exports=convertDates;function convertDates(obj,convert){obj=clone(obj);for(var key in obj){var val=obj[key];if(is.date(val))obj[key]=convert(val);if(is.object(val))obj[key]=convertDates(val,convert)}return obj}},{is:86,clone:89}],27:[function(require,module,exports){var alias=require("alias");var integration=require("analytics.js-integration");var is=require("is");var load=require("load-script");var push=require("global-queue")("_dcq");var Drip=module.exports=integration("Drip").assumesPageview().global("dc").global("_dcq").global("_dcs").option("account","").tag('<script src="//tag.getdrip.com/{{ account }}.js">');Drip.prototype.initialize=function(page){window._dcq=window._dcq||[];window._dcs=window._dcs||{};window._dcs.account=this.options.account;this.load(this.ready)};Drip.prototype.loaded=function(){return is.object(window.dc)};Drip.prototype.track=function(track){var props=track.properties();var cents=track.cents();if(cents)props.value=cents;delete props.revenue;push("track",track.event(),props)};Drip.prototype.identify=function(identify){push("identify",identify.traits())}},{alias:173,"analytics.js-integration":83,is:86,"load-script":123,"global-queue":168}],28:[function(require,module,exports){var extend=require("extend");var integration=require("analytics.js-integration");var onError=require("on-error");var push=require("global-queue")("_errs");var Errorception=module.exports=integration("Errorception").assumesPageview().global("_errs").option("projectId","").option("meta",true).tag('<script src="//beacon.errorception.com/{{ projectId }}.js">'); Errorception.prototype.initialize=function(page){window._errs=window._errs||[this.options.projectId];onError(push);this.load(this.ready)};Errorception.prototype.loaded=function(){return!!(window._errs&&window._errs.push!==Array.prototype.push)};Errorception.prototype.identify=function(identify){if(!this.options.meta)return;var traits=identify.traits();window._errs=window._errs||[];window._errs.meta=window._errs.meta||{};extend(window._errs.meta,traits)}},{extend:124,"analytics.js-integration":83,"on-error":166,"global-queue":168}],29:[function(require,module,exports){var each=require("each");var integration=require("analytics.js-integration");var push=require("global-queue")("_aaq");var Evergage=module.exports=integration("Evergage").assumesPageview().global("_aaq").option("account","").option("dataset","").tag('<script src="//cdn.evergage.com/beacon/{{ account }}/{{ dataset }}/scripts/evergage.min.js">');Evergage.prototype.initialize=function(page){var account=this.options.account;var dataset=this.options.dataset;window._aaq=window._aaq||[];push("setEvergageAccount",account);push("setDataset",dataset);push("setUseSiteConfig",true);this.load(this.ready)};Evergage.prototype.loaded=function(){return!!(window._aaq&&window._aaq.push!==Array.prototype.push)};Evergage.prototype.page=function(page){var props=page.properties();var name=page.name();if(name)push("namePage",name);each(props,function(key,value){push("setCustomField",key,value,"page")});window.Evergage.init(true)};Evergage.prototype.identify=function(identify){var id=identify.userId();if(!id)return;push("setUser",id);var traits=identify.traits({email:"userEmail",name:"userName"});each(traits,function(key,value){push("setUserField",key,value,"page")})};Evergage.prototype.group=function(group){var props=group.traits();var id=group.groupId();if(!id)return;push("setCompany",id);each(props,function(key,value){push("setAccountField",key,value,"page")})};Evergage.prototype.track=function(track){push("trackAction",track.event(),track.properties())}},{each:4,"analytics.js-integration":83,"global-queue":168}],30:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_fbq");var each=require("each");var has=Object.prototype.hasOwnProperty;var Facebook=module.exports=integration("Facebook Conversion Tracking").global("_fbq").option("currency","USD").tag('<script src="//connect.facebook.net/en_US/fbds.js">').mapping("events");Facebook.prototype.initialize=function(page){window._fbq=window._fbq||[];this.load(this.ready);window._fbq.loaded=true};Facebook.prototype.loaded=function(){return!!(window._fbq&&window._fbq.loaded)};Facebook.prototype.track=function(track){var event=track.event();var events=this.events(event);var revenue=track.revenue()||0;var self=this;each(events,function(event){push("track",event,{value:String(revenue.toFixed(2)),currency:self.options.currency})});if(!events.length){var data=track.properties();push("track",event,data)}}},{"analytics.js-integration":83,"global-queue":168,each:4}],31:[function(require,module,exports){var push=require("global-queue")("_fxm");var integration=require("analytics.js-integration");var Track=require("facade").Track;var each=require("each");var FoxMetrics=module.exports=integration("FoxMetrics").assumesPageview().global("_fxm").option("appId","").tag('<script src="//d35tca7vmefkrc.cloudfront.net/scripts/{{ appId }}.js">');FoxMetrics.prototype.initialize=function(page){window._fxm=window._fxm||[];this.load(this.ready)};FoxMetrics.prototype.loaded=function(){return!!(window._fxm&&window._fxm.appId)};FoxMetrics.prototype.page=function(page){var properties=page.proxy("properties");var category=page.category();var name=page.name();this._category=category;push("_fxm.pages.view",properties.title,name,category,properties.url,properties.referrer)};FoxMetrics.prototype.identify=function(identify){var id=identify.userId();if(!id)return;push("_fxm.visitor.profile",id,identify.firstName(),identify.lastName(),identify.email(),identify.address(),undefined,undefined,identify.traits())};FoxMetrics.prototype.track=function(track){var props=track.properties();var category=this._category||props.category;push(track.event(),category,props)};FoxMetrics.prototype.viewedProduct=function(track){ecommerce("productview",track)};FoxMetrics.prototype.removedProduct=function(track){ecommerce("removecartitem",track)};FoxMetrics.prototype.addedProduct=function(track){ecommerce("cartitem",track)};FoxMetrics.prototype.completedOrder=function(track){var orderId=track.orderId();push("_fxm.ecommerce.order",orderId,track.subtotal(),track.shipping(),track.tax(),track.city(),track.state(),track.zip(),track.quantity());each(track.products(),function(product){var track=new Track({properties:product});ecommerce("purchaseitem",track,[track.quantity(),track.price(),orderId])})};function ecommerce(event,track,arr){push.apply(null,["_fxm.ecommerce."+event,track.id()||track.sku(),track.name(),track.category()].concat(arr||[]))}},{"global-queue":168,"analytics.js-integration":83,facade:126,each:4}],32:[function(require,module,exports){var integration=require("analytics.js-integration");var bind=require("bind");var when=require("when");var is=require("is");var Frontleaf=module.exports=integration("Frontleaf").assumesPageview().global("_fl").global("_flBaseUrl").option("baseUrl","https://api.frontleaf.com").option("token","").option("stream","").option("trackNamedPages",false).option("trackCategorizedPages",false).tag('<script id="_fl" src="{{ baseUrl }}/lib/tracker.js">');Frontleaf.prototype.initialize=function(page){window._fl=window._fl||[];window._flBaseUrl=window._flBaseUrl||this.options.baseUrl;this._push("setApiToken",this.options.token);this._push("setStream",this.options.stream);var loaded=bind(this,this.loaded);var ready=this.ready;this.load({baseUrl:window._flBaseUrl},this.ready)};Frontleaf.prototype.loaded=function(){return is.array(window._fl)&&window._fl.ready===true};Frontleaf.prototype.identify=function(identify){var userId=identify.userId();if(userId){this._push("setUser",{id:userId,name:identify.name()||identify.username(),data:clean(identify.traits())})}};Frontleaf.prototype.group=function(group){var groupId=group.groupId();if(groupId){this._push("setAccount",{id:groupId,name:group.proxy("traits.name"),data:clean(group.traits())})}};Frontleaf.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};Frontleaf.prototype.track=function(track){var event=track.event();this._push("event",event,clean(track.properties()))};Frontleaf.prototype._push=function(command){var args=[].slice.call(arguments,1);window._fl.push(function(t){t[command].apply(command,args)})};function clean(obj){var ret={};var excludeKeys=["id","name","firstName","lastName"];var len=excludeKeys.length;for(var i=0;i<len;i++){clear(obj,excludeKeys[i])}obj=flatten(obj);for(var key in obj){var val=obj[key];if(null==val){continue}if(is.array(val)){ret[key]=val.toString();continue}ret[key]=val}return ret}function clear(obj,key){if(obj.hasOwnProperty(key)){delete obj[key]}}function flatten(source){var output={};function step(object,prev){for(var key in object){var value=object[key];var newKey=prev?prev+" "+key:key;if(!is.array(value)&&is.object(value)){return step(value,newKey)}output[newKey]=value}}step(source);return output}},{"analytics.js-integration":83,bind:95,when:125,is:86}],33:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_gauges");var Gauges=module.exports=integration("Gauges").assumesPageview().global("_gauges").option("siteId","").tag('<script id="gauges-tracker" src="//secure.gaug.es/track.js" data-site-id="{{ siteId }}">');Gauges.prototype.initialize=function(page){window._gauges=window._gauges||[];this.load(this.ready)};Gauges.prototype.loaded=function(){return!!(window._gauges&&window._gauges.push!==Array.prototype.push)};Gauges.prototype.page=function(page){push("track")}},{"analytics.js-integration":83,"global-queue":168}],34:[function(require,module,exports){var integration=require("analytics.js-integration");var onBody=require("on-body");var GetSatisfaction=module.exports=integration("Get Satisfaction").assumesPageview().global("GSFN").option("widgetId","").tag('<script src="https://loader.engage.gsfn.us/loader.js">');GetSatisfaction.prototype.initialize=function(page){var self=this;var widget=this.options.widgetId;var div=document.createElement("div");var id=div.id="getsat-widget-"+widget;onBody(function(body){body.appendChild(div)});this.load(function(){window.GSFN.loadWidget(widget,{containerId:id});self.ready()})};GetSatisfaction.prototype.loaded=function(){return!!window.GSFN}},{"analytics.js-integration":83,"on-body":119}],35:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_gaq");var length=require("object").length;var canonical=require("canonical");var useHttps=require("use-https");var Track=require("facade").Track;var callback=require("callback");var load=require("load-script");var keys=require("object").keys;var dot=require("obj-case");var each=require("each");var type=require("type");var url=require("url");var is=require("is");var group;var user;module.exports=exports=function(analytics){analytics.addIntegration(GA);group=analytics.group();user=analytics.user()};var GA=exports.Integration=integration("Google Analytics").readyOnLoad().global("ga").global("gaplugins").global("_gaq").global("GoogleAnalyticsObject").option("anonymizeIp",false).option("classic",false).option("domain","none").option("doubleClick",false).option("enhancedLinkAttribution",false).option("ignoredReferrers",null).option("includeSearch",false).option("siteSpeedSampleRate",1).option("trackingId","").option("trackNamedPages",true).option("trackCategorizedPages",true).option("sendUserId",false).option("metrics",{}).option("dimensions",{}).tag("library",'<script src="//www.google-analytics.com/analytics.js">').tag("double click",'<script src="//stats.g.doubleclick.net/dc.js">').tag("http",'<script src="http://www.google-analytics.com/ga.js">').tag("https",'<script src="https://ssl.google-analytics.com/ga.js">');GA.on("construct",function(integration){if(!integration.options.classic)return;integration.initialize=integration.initializeClassic;integration.loaded=integration.loadedClassic;integration.page=integration.pageClassic;integration.track=integration.trackClassic;integration.completedOrder=integration.completedOrderClassic});GA.prototype.initialize=function(){var opts=this.options;window.GoogleAnalyticsObject="ga";window.ga=window.ga||function(){window.ga.q=window.ga.q||[];window.ga.q.push(arguments)};window.ga.l=(new Date).getTime();window.ga("create",opts.trackingId,{cookieDomain:opts.domain||GA.prototype.defaults.domain,siteSpeedSampleRate:opts.siteSpeedSampleRate,allowLinker:true});if(opts.doubleClick){window.ga("require","displayfeatures")}if(opts.sendUserId&&user.id()){window.ga("set","userId",user.id())}if(opts.anonymizeIp)window.ga("set","anonymizeIp",true);var custom=metrics(user.traits(),opts);if(length(custom))window.ga("set",custom);this.load("library",this.ready)};GA.prototype.loaded=function(){return!!window.gaplugins};GA.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var pageview={};var track;this._category=category;window.ga("send","pageview",{page:path(props,this.options),title:name||props.title,location:props.url});if(category&&this.options.trackCategorizedPages){track=page.track(category);this.track(track,{noninteraction:true})}if(name&&this.options.trackNamedPages){track=page.track(name);this.track(track,{noninteraction:true})}};GA.prototype.track=function(track,options){var opts=options||track.options(this.name);var props=track.properties();window.ga("send","event",{eventAction:track.event(),eventCategory:props.category||this._category||"All",eventLabel:props.label,eventValue:formatValue(props.value||track.revenue()),nonInteraction:props.noninteraction||opts.noninteraction})};GA.prototype.completedOrder=function(track){var total=track.total()||track.revenue()||0;var orderId=track.orderId();var products=track.products();var props=track.properties();if(!orderId)return;if(!this.ecommerce){window.ga("require","ecommerce","ecommerce.js");this.ecommerce=true}window.ga("ecommerce:addTransaction",{affiliation:props.affiliation,shipping:track.shipping(),revenue:total,tax:track.tax(),id:orderId,currency:track.currency()});each(products,function(product){var track=new Track({properties:product});window.ga("ecommerce:addItem",{category:track.category(),quantity:track.quantity(),price:track.price(),name:track.name(),sku:track.sku(),id:orderId,currency:track.currency()})});window.ga("ecommerce:send")};GA.prototype.initializeClassic=function(){var opts=this.options;var anonymize=opts.anonymizeIp;var db=opts.doubleClick;var domain=opts.domain;var enhanced=opts.enhancedLinkAttribution;var ignore=opts.ignoredReferrers;var sample=opts.siteSpeedSampleRate;window._gaq=window._gaq||[];push("_setAccount",opts.trackingId);push("_setAllowLinker",true);if(anonymize)push("_gat._anonymizeIp");if(domain)push("_setDomainName",domain);if(sample)push("_setSiteSpeedSampleRate",sample);if(enhanced){var protocol="https:"===document.location.protocol?"https:":"http:";var pluginUrl=protocol+"//www.google-analytics.com/plugins/ga/inpage_linkid.js";push("_require","inpage_linkid",pluginUrl)}if(ignore){if(!is.array(ignore))ignore=[ignore];each(ignore,function(domain){push("_addIgnoredRef",domain)})}if(this.options.doubleClick){this.load("double click",this.ready)}else{var name=useHttps()?"https":"http";this.load(name,this.ready)}};GA.prototype.loadedClassic=function(){return!!(window._gaq&&window._gaq.push!==Array.prototype.push)};GA.prototype.pageClassic=function(page){var opts=page.options(this.name);var category=page.category();var props=page.properties();var name=page.fullName();var track;push("_trackPageview",path(props,this.options));if(category&&this.options.trackCategorizedPages){track=page.track(category);this.track(track,{noninteraction:true})}if(name&&this.options.trackNamedPages){track=page.track(name);this.track(track,{noninteraction:true})}};GA.prototype.trackClassic=function(track,options){var opts=options||track.options(this.name);var props=track.properties();var revenue=track.revenue();var event=track.event();var category=this._category||props.category||"All";var label=props.label;var value=formatValue(revenue||props.value);var noninteraction=props.noninteraction||opts.noninteraction;push("_trackEvent",category,event,label,value,noninteraction)};GA.prototype.completedOrderClassic=function(track){var total=track.total()||track.revenue()||0;var orderId=track.orderId();var products=track.products()||[];var props=track.properties();var currency=track.currency();if(!orderId)return;push("_addTrans",orderId,props.affiliation,total,track.tax(),track.shipping(),track.city(),track.state(),track.country());each(products,function(product){var track=new Track({properties:product});push("_addItem",orderId,track.sku(),track.name(),track.category(),track.price(),track.quantity())});push("_set","currencyCode",currency);push("_trackTrans")};function path(properties,options){if(!properties)return;var str=properties.path;if(options.includeSearch&&properties.search)str+=properties.search;return str}function formatValue(value){if(!value||value<0)return 0;return Math.round(value)}function metrics(obj,data){var dimensions=data.dimensions;var metrics=data.metrics;var names=keys(metrics).concat(keys(dimensions));var ret={};for(var i=0;i<names.length;++i){var name=names[i];var key=metrics[name]||dimensions[name];var value=dot(obj,name)||obj[name];if(null==value)continue;ret[key]=value}return ret}},{"analytics.js-integration":83,"global-queue":168,object:175,canonical:176,"use-https":85,facade:126,callback:88,"load-script":123,"obj-case":138,each:4,type:7,url:177,is:86}],175:[function(require,module,exports){var has=Object.prototype.hasOwnProperty;exports.keys=Object.keys||function(obj){var keys=[];for(var key in obj){if(has.call(obj,key)){keys.push(key)}}return keys};exports.values=function(obj){var vals=[];for(var key in obj){if(has.call(obj,key)){vals.push(obj[key])}}return vals};exports.merge=function(a,b){for(var key in b){if(has.call(b,key)){a[key]=b[key]}}return a};exports.length=function(obj){return exports.keys(obj).length};exports.isEmpty=function(obj){return 0==exports.length(obj)}},{}],176:[function(require,module,exports){module.exports=function canonical(){var tags=document.getElementsByTagName("link");for(var i=0,tag;tag=tags[i];i++){if("canonical"==tag.getAttribute("rel"))return tag.getAttribute("href")}}},{}],177:[function(require,module,exports){exports.parse=function(url){var a=document.createElement("a");a.href=url;return{href:a.href,host:a.host,port:a.port,hash:a.hash,hostname:a.hostname,pathname:a.pathname,protocol:a.protocol,search:a.search,query:a.search.slice(1)}};exports.isAbsolute=function(url){if(0==url.indexOf("//"))return true;if(~url.indexOf("://"))return true;return false};exports.isRelative=function(url){return!exports.isAbsolute(url)};exports.isCrossDomain=function(url){url=exports.parse(url);return url.hostname!=location.hostname||url.port!=location.port||url.protocol!=location.protocol}},{}],36:[function(require,module,exports){var push=require("global-queue")("dataLayer",{wrap:false});var integration=require("analytics.js-integration");var GTM=module.exports=integration("Google Tag Manager").assumesPageview().global("dataLayer").global("google_tag_manager").option("containerId","").option("trackNamedPages",true).option("trackCategorizedPages",true).tag('<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer">');GTM.prototype.initialize=function(){push({"gtm.start":+new Date,event:"gtm.js"});this.load(this.ready)};GTM.prototype.loaded=function(){return!!(window.dataLayer&&[].push!=window.dataLayer.push)};GTM.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var opts=this.options;var track;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};GTM.prototype.track=function(track){var props=track.properties();props.event=track.event();push(props)}},{"global-queue":168,"analytics.js-integration":83}],37:[function(require,module,exports){var integration=require("analytics.js-integration");var Identify=require("facade").Identify;var Track=require("facade").Track;var callback=require("callback");var load=require("load-script");var onBody=require("on-body");var each=require("each");var GoSquared=module.exports=integration("GoSquared").assumesPageview().global("_gs").option("siteToken","").option("anonymizeIP",false).option("cookieDomain",null).option("useCookies",true).option("trackHash",false).option("trackLocal",false).option("trackParams",true).tag('<script src="//d1l6p2sc9645hc.cloudfront.net/tracker.js">');GoSquared.prototype.initialize=function(page){var self=this;var options=this.options;var user=this.analytics.user();push(options.siteToken);each(options,function(name,value){if("siteToken"==name)return;if(null==value)return;push("set",name,value)});self.identify(new Identify({traits:user.traits(),userId:user.id()}));self.load(this.ready)};GoSquared.prototype.loaded=function(){return!!(window._gs&&window._gs.v)};GoSquared.prototype.page=function(page){var props=page.properties();var name=page.fullName();push("track",props.path,name||props.title)};GoSquared.prototype.identify=function(identify){var traits=identify.traits({userId:"userID"});var username=identify.username();var email=identify.email();var id=identify.userId();if(id)push("set","visitorID",id);var name=email||username||id;if(name)push("set","visitorName",name);push("set","visitor",traits)};GoSquared.prototype.track=function(track){push("event",track.event(),track.properties())};GoSquared.prototype.completedOrder=function(track){var products=track.products();var items=[];each(products,function(product){var track=new Track({properties:product});items.push({category:track.category(),quantity:track.quantity(),price:track.price(),name:track.name()})});push("transaction",track.orderId(),{revenue:track.total(),track:true},items)};function push(){var _gs=window._gs=window._gs||function(){(_gs.q=_gs.q||[]).push(arguments)};_gs.apply(null,arguments)}},{"analytics.js-integration":83,facade:126,callback:88,"load-script":123,"on-body":119,each:4}],38:[function(require,module,exports){var integration=require("analytics.js-integration");var alias=require("alias");var Heap=module.exports=integration("Heap").assumesPageview().global("heap").global("_heapid").option("apiKey","").tag('<script src="//d36lvucg9kzous.cloudfront.net">');Heap.prototype.initialize=function(page){window.heap=window.heap||[];window.heap.load=function(a){window._heapid=a;var d=function(a){return function(){window.heap.push([a].concat(Array.prototype.slice.call(arguments,0)))}},e=["identify","track"];for(var f=0;f<e.length;f++)window.heap[e[f]]=d(e[f])};window.heap.load(this.options.apiKey);this.load(this.ready)};Heap.prototype.loaded=function(){return window.heap&&window.heap.appid};Heap.prototype.identify=function(identify){var traits=identify.traits();var username=identify.username();var id=identify.userId();var handle=username||id;if(handle)traits.handle=handle;delete traits.username;window.heap.identify(traits)};Heap.prototype.track=function(track){window.heap.track(track.event(),track.properties())}},{"analytics.js-integration":83,alias:173}],39:[function(require,module,exports){var integration=require("analytics.js-integration");var Hellobar=module.exports=integration("Hello Bar").assumesPageview().global("_hbq").option("apiKey","").tag('<script src="//s3.amazonaws.com/scripts.hellobar.com/{{ apiKey }}.js">');Hellobar.prototype.initialize=function(page){window._hbq=window._hbq||[];this.load(this.ready)};Hellobar.prototype.loaded=function(){return!!(window._hbq&&window._hbq.push!==Array.prototype.push)}},{"analytics.js-integration":83}],40:[function(require,module,exports){var integration=require("analytics.js-integration");var is=require("is");var HitTail=module.exports=integration("HitTail").assumesPageview().global("htk").option("siteId","").tag('<script src="//{{ siteId }}.hittail.com/mlt.js">');HitTail.prototype.initialize=function(page){this.load(this.ready)};HitTail.prototype.loaded=function(){return is.fn(window.htk)}},{"analytics.js-integration":83,is:86}],41:[function(require,module,exports){var integration=require("analytics.js-integration");var Hublo=module.exports=integration("Hublo").assumesPageview().global("_hublo_").option("apiKey",null).tag('<script src="//cdn.hublo.co/{{ apiKey }}.js">');Hublo.prototype.initialize=function(page){this.load(this.ready)};Hublo.prototype.loaded=function(){return!!(window._hublo_&&typeof window._hublo_.setup==="function")}},{"analytics.js-integration":83}],42:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_hsq");var convert=require("convert-dates");var HubSpot=module.exports=integration("HubSpot").assumesPageview().global("_hsq").option("portalId",null).tag('<script id="hs-analytics" src="https://js.hs-analytics.net/analytics/{{ cache }}/{{ portalId }}.js">');HubSpot.prototype.initialize=function(page){window._hsq=[];var cache=Math.ceil(new Date/3e5)*3e5;this.load({cache:cache},this.ready)};HubSpot.prototype.loaded=function(){return!!(window._hsq&&window._hsq.push!==Array.prototype.push)};HubSpot.prototype.page=function(page){push("_trackPageview")};HubSpot.prototype.identify=function(identify){if(!identify.email())return;var traits=identify.traits();traits=convertDates(traits);push("identify",traits)};HubSpot.prototype.track=function(track){var props=track.properties();props=convertDates(props);push("trackEvent",track.event(),props)};function convertDates(properties){return convert(properties,function(date){return date.getTime()})}},{"analytics.js-integration":83,"global-queue":168,"convert-dates":174}],43:[function(require,module,exports){var integration=require("analytics.js-integration");var alias=require("alias");var Improvely=module.exports=integration("Improvely").assumesPageview().global("_improvely").global("improvely").option("domain","").option("projectId",null).tag('<script src="//{{ domain }}.iljmp.com/improvely.js">');Improvely.prototype.initialize=function(page){window._improvely=[];window.improvely={init:function(e,t){window._improvely.push(["init",e,t])},goal:function(e){window._improvely.push(["goal",e])},label:function(e){window._improvely.push(["label",e])}};var domain=this.options.domain;var id=this.options.projectId;window.improvely.init(domain,id);this.load(this.ready)};Improvely.prototype.loaded=function(){return!!(window.improvely&&window.improvely.identify)};Improvely.prototype.identify=function(identify){var id=identify.userId();if(id)window.improvely.label(id)};Improvely.prototype.track=function(track){var props=track.properties({revenue:"amount"});props.type=track.event();window.improvely.goal(props)}},{"analytics.js-integration":83,alias:173}],44:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_iva");var Track=require("facade").Track;var is=require("is");var has=Object.prototype.hasOwnProperty;var InsideVault=module.exports=integration("InsideVault").global("_iva").option("clientId","").option("domain","").tag('<script src="//analytics.staticiv.com/iva.js">').mapping("events");InsideVault.prototype.initialize=function(page){var domain=this.options.domain;window._iva=window._iva||[];push("setClientId",this.options.clientId);if(domain)push("setDomain",domain);this.load(this.ready)};InsideVault.prototype.loaded=function(){return!!(window._iva&&window._iva.push!==Array.prototype.push)};InsideVault.prototype.page=function(page){push("trackEvent","click")};InsideVault.prototype.track=function(track){var user=this.analytics.user();var events=this.options.events;var event=track.event();var value=track.revenue()||track.value()||0;var eventId=track.orderId()||user.id()||"";if(!has.call(events,event))return;event=events[event];if(event!="sale"){push("trackEvent",event,value,eventId)}}},{"analytics.js-integration":83,"global-queue":168,facade:126,is:86}],45:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("__insp");var alias=require("alias");var clone=require("clone");var Inspectlet=module.exports=integration("Inspectlet").assumesPageview().global("__insp").global("__insp_").option("wid","").tag('<script src="//www.inspectlet.com/inspectlet.js">');Inspectlet.prototype.initialize=function(page){push("wid",this.options.wid);this.load(this.ready)};Inspectlet.prototype.loaded=function(){return!!window.__insp_};Inspectlet.prototype.identify=function(identify){var traits=identify.traits({id:"userid"});push("tagSession",traits)};Inspectlet.prototype.track=function(track){push("tagSession",track.event())}},{"analytics.js-integration":83,"global-queue":168,alias:173,clone:172}],46:[function(require,module,exports){var integration=require("analytics.js-integration");var convertDates=require("convert-dates");var defaults=require("defaults");var isEmail=require("is-email");var load=require("load-script");var empty=require("is-empty");var alias=require("alias");var each=require("each");var when=require("when");var is=require("is");var Intercom=module.exports=integration("Intercom").assumesPageview().global("Intercom").option("activator","#IntercomDefaultWidget").option("appId","").option("inbox",false).tag('<script src="https://static.intercomcdn.com/intercom.v1.js">');Intercom.prototype.initialize=function(page){var self=this;this.load(function(){when(function(){return self.loaded()},self.ready)})};Intercom.prototype.loaded=function(){return is.fn(window.Intercom)};Intercom.prototype.page=function(page){window.Intercom("update")};Intercom.prototype.identify=function(identify){var traits=identify.traits({userId:"user_id"});var activator=this.options.activator;var opts=identify.options(this.name);var companyCreated=identify.companyCreated();var created=identify.created();var email=identify.email();var name=identify.name();var id=identify.userId();var group=this.analytics.group();if(!id&&!traits.email)return;traits.app_id=this.options.appId;if(null!=traits.company&&!is.object(traits.company))delete traits.company;if(traits.company)defaults(traits.company,group.traits());if(name)traits.name=name;if(traits.company&&companyCreated)traits.company.created=companyCreated;if(created)traits.created=created;traits=convertDates(traits,formatDate);traits=alias(traits,{created:"created_at"});if(traits.company)traits.company=alias(traits.company,{created:"created_at"});if(opts.increments)traits.increments=opts.increments;if(opts.userHash)traits.user_hash=opts.userHash;if(opts.user_hash)traits.user_hash=opts.user_hash;if("#IntercomDefaultWidget"!=activator){traits.widget={activator:activator}}var method=this._id!==id?"boot":"update";this._id=id;window.Intercom(method,traits)};Intercom.prototype.group=function(group){var props=group.properties();var id=group.groupId();if(id)props.id=id;window.Intercom("update",{company:props})};Intercom.prototype.track=function(track){window.Intercom("trackEvent",track.event(),track.properties())};function formatDate(date){return Math.floor(date/1e3)}},{"analytics.js-integration":83,"convert-dates":174,defaults:167,"is-email":163,"load-script":123,"is-empty":118,alias:173,each:4,when:125,is:86}],47:[function(require,module,exports){var integration=require("analytics.js-integration");var Keen=module.exports=integration("Keen IO").global("Keen").option("projectId","").option("readKey","").option("writeKey","").option("ipAddon",false).option("uaAddon",false).option("urlAddon",false).option("referrerAddon",false).option("trackNamedPages",true).option("trackAllPages",false).option("trackCategorizedPages",true).tag('<script src="//d26b395fwzu5fz.cloudfront.net/3.0.7/{{ lib }}.min.js">');Keen.prototype.initialize=function(){var options=this.options;!function(a,b){if(void 0===b[a]){b["_"+a]={},b[a]=function(c){b["_"+a].clients=b["_"+a].clients||{},b["_"+a].clients[c.projectId]=this,this._config=c},b[a].ready=function(c){b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c)};for(var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){var e=c[d],f=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};b[a].prototype[e]=f(e)}}}("Keen",window);this.client=new window.Keen({projectId:options.projectId,writeKey:options.writeKey,readKey:options.readKey});var lib=this.options.readKey?"keen":"keen-tracker";this.load({lib:lib},this.ready)};Keen.prototype.loaded=function(){return!!(window.Keen&&window.Keen.prototype.configure)};Keen.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};Keen.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();var user={};var options=this.options;if(id)user.userId=id;if(traits)user.traits=traits;var props={user:user};var addons=[];if(options.ipAddon){addons.push({name:"keen:ip_to_geo",input:{ip:"ip_address"},output:"ip_geo_info"}); props.ip_address="${keen.ip}"}if(options.uaAddon){addons.push({name:"keen:ua_parser",input:{ua_string:"user_agent"},output:"parsed_user_agent"});props.user_agent="${keen.user_agent}"}if(options.urlAddon){addons.push({name:"keen:url_parser",input:{url:"page_url"},output:"parsed_page_url"});props.page_url=document.location.href}if(options.referrerAddon){addons.push({name:"keen:referrer_parser",input:{referrer_url:"referrer_url",page_url:"page_url"},output:"referrer_info"});props.referrer_url=document.referrer;props.page_url=document.location.href}props.keen={timestamp:identify.timestamp(),addons:addons};this.client.setGlobalProperties(function(){return props})};Keen.prototype.track=function(track){this.client.addEvent(track.event(),track.properties())}},{"analytics.js-integration":83}],48:[function(require,module,exports){var integration=require("analytics.js-integration");var indexof=require("indexof");var is=require("is");var Kenshoo=module.exports=integration("Kenshoo").global("k_trackevent").option("cid","").option("subdomain","").option("events",[]).tag('<script src="//{{ subdomain }}.xg4ken.com/media/getpx.php?cid={{ cid }}">');Kenshoo.prototype.initialize=function(page){this.load(this.ready)};Kenshoo.prototype.loaded=function(){return is.fn(window.k_trackevent)};Kenshoo.prototype.track=function(track){var events=this.options.events;var traits=track.traits();var event=track.event();var revenue=track.revenue()||0;if(!~indexof(events,event))return;var params=["id="+this.options.cid,"type=conv","val="+revenue,"orderId="+track.orderId(),"promoCode="+track.coupon(),"valueCurrency="+track.currency(),"GCID=","kw=","product="];window.k_trackevent(params,this.options.subdomain)}},{"analytics.js-integration":83,indexof:109,is:86}],49:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_kmq");var Track=require("facade").Track;var alias=require("alias");var Batch=require("batch");var each=require("each");var is=require("is");var KISSmetrics=module.exports=integration("KISSmetrics").assumesPageview().global("_kmq").global("KM").global("_kmil").option("apiKey","").option("trackNamedPages",true).option("trackCategorizedPages",true).option("prefixProperties",true).tag("useless",'<script src="//i.kissmetrics.com/i.js">').tag("library",'<script src="//doug1izaerwt3.cloudfront.net/{{ apiKey }}.1.js">');exports.isMobile=navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/iPhone|iPod/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Opera Mini/i)||navigator.userAgent.match(/IEMobile/i);KISSmetrics.prototype.initialize=function(page){var self=this;window._kmq=[];if(exports.isMobile)push("set",{"Mobile Session":"Yes"});var batch=new Batch;batch.push(function(done){self.load("useless",done)});batch.push(function(done){self.load("library",done)});batch.end(function(){self.trackPage(page);self.ready()})};KISSmetrics.prototype.loaded=function(){return is.object(window.KM)};KISSmetrics.prototype.page=function(page){if(!window.KM_SKIP_PAGE_VIEW)window.KM.pageView();this.trackPage(page)};KISSmetrics.prototype.trackPage=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};KISSmetrics.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();if(id)push("identify",id);if(traits)push("set",traits)};KISSmetrics.prototype.track=function(track){var mapping={revenue:"Billing Amount"};var event=track.event();var properties=track.properties(mapping);if(this.options.prefixProperties)properties=prefix(event,properties);push("record",event,properties)};KISSmetrics.prototype.alias=function(alias){push("alias",alias.to(),alias.from())};KISSmetrics.prototype.completedOrder=function(track){var products=track.products();var event=track.event();push("record",event,prefix(event,track.properties()));window._kmq.push(function(){var km=window.KM;each(products,function(product,i){var temp=new Track({event:event,properties:product});var item=prefix(event,product);item._t=km.ts()+i;item._d=1;km.set(item)})})};function prefix(event,properties){var prefixed={};each(properties,function(key,val){if(key==="Billing Amount"){prefixed[key]=val}else{prefixed[event+" - "+key]=val}});return prefixed}},{"analytics.js-integration":83,"global-queue":168,facade:126,alias:173,batch:178,each:4,is:86}],178:[function(require,module,exports){try{var EventEmitter=require("events").EventEmitter}catch(err){var Emitter=require("emitter")}function noop(){}module.exports=Batch;function Batch(){if(!(this instanceof Batch))return new Batch;this.fns=[];this.concurrency(Infinity);this.throws(true);for(var i=0,len=arguments.length;i<len;++i){this.push(arguments[i])}}if(EventEmitter){Batch.prototype.__proto__=EventEmitter.prototype}else{Emitter(Batch.prototype)}Batch.prototype.concurrency=function(n){this.n=n;return this};Batch.prototype.push=function(fn){this.fns.push(fn);return this};Batch.prototype.throws=function(throws){this.e=!!throws;return this};Batch.prototype.end=function(cb){var self=this,total=this.fns.length,pending=total,results=[],errors=[],cb=cb||noop,fns=this.fns,max=this.n,throws=this.e,index=0,done;if(!fns.length)return cb(null,results);function next(){var i=index++;var fn=fns[i];if(!fn)return;var start=new Date;try{fn(callback)}catch(err){callback(err)}function callback(err,res){if(done)return;if(err&&throws)return done=true,cb(err);var complete=total-pending+1;var end=new Date;results[i]=res;errors[i]=err;self.emit("progress",{index:i,value:res,error:err,pending:pending,total:total,complete:complete,percent:complete/total*100|0,start:start,end:end,duration:end-start});if(--pending)next();else if(!throws)cb(errors,results);else cb(null,results)}}for(var i=0;i<fns.length;i++){if(i==max)break;next()}return this}},{emitter:179}],179:[function(require,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var cb;for(var i=0;i<callbacks.length;i++){cb=callbacks[i];if(cb===fn||cb.fn===fn){callbacks.splice(i,1);break}}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1),callbacks=this._callbacks[event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],50:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_learnq");var tick=require("next-tick");var alias=require("alias");var aliases={id:"$id",email:"$email",firstName:"$first_name",lastName:"$last_name",phone:"$phone_number",title:"$title"};var Klaviyo=module.exports=integration("Klaviyo").assumesPageview().global("_learnq").option("apiKey","").tag('<script src="//a.klaviyo.com/media/js/learnmarklet.js">');Klaviyo.prototype.initialize=function(page){var self=this;push("account",this.options.apiKey);this.load(function(){tick(self.ready)})};Klaviyo.prototype.loaded=function(){return!!(window._learnq&&window._learnq.push!==Array.prototype.push)};Klaviyo.prototype.identify=function(identify){var traits=identify.traits(aliases);if(!traits.$id&&!traits.$email)return;push("identify",traits)};Klaviyo.prototype.group=function(group){var props=group.properties();if(!props.name)return;push("identify",{$organization:props.name})};Klaviyo.prototype.track=function(track){push("track",track.event(),track.properties({revenue:"$value"}))}},{"analytics.js-integration":83,"global-queue":168,"next-tick":97,alias:173}],51:[function(require,module,exports){var integration=require("analytics.js-integration");var LeadLander=module.exports=integration("LeadLander").assumesPageview().global("llactid").global("trackalyzer").option("accountId",null).tag('<script src="http://t6.trackalyzer.com/trackalyze-nodoc.js">');LeadLander.prototype.initialize=function(page){window.llactid=this.options.accountId;this.load(this.ready)};LeadLander.prototype.loaded=function(){return!!window.trackalyzer}},{"analytics.js-integration":83}],52:[function(require,module,exports){var integration=require("analytics.js-integration");var clone=require("clone");var each=require("each");var Identify=require("facade").Identify;var when=require("when");var LiveChat=module.exports=integration("LiveChat").assumesPageview().global("__lc").global("__lc_inited").global("LC_API").global("LC_Invite").option("group",0).option("license","").tag('<script src="//cdn.livechatinc.com/tracking.js">');LiveChat.prototype.initialize=function(page){var self=this;var user=this.analytics.user();var identify=new Identify({userId:user.id(),traits:user.traits()});window.__lc=clone(this.options);window.__lc.visitor={name:identify.name(),email:identify.email()};this.load(function(){when(function(){return self.loaded()},self.ready)})};LiveChat.prototype.loaded=function(){return!!(window.LC_API&&window.LC_Invite)};LiveChat.prototype.identify=function(identify){var traits=identify.traits({userId:"User ID"});window.LC_API.set_custom_variables(convert(traits))};function convert(traits){var arr=[];each(traits,function(key,value){arr.push({name:key,value:value})});return arr}},{"analytics.js-integration":83,clone:172,each:4,facade:126,when:125}],53:[function(require,module,exports){var integration=require("analytics.js-integration");var Identify=require("facade").Identify;var useHttps=require("use-https");var LuckyOrange=module.exports=integration("Lucky Orange").assumesPageview().global("_loq").global("__wtw_watcher_added").global("__wtw_lucky_site_id").global("__wtw_lucky_is_segment_io").global("__wtw_custom_user_data").option("siteId",null).tag("http",'<script src="http://www.luckyorange.com/w.js?{{ cache }}">').tag("https",'<script src="https://ssl.luckyorange.com/w.js?{{ cache }}">');LuckyOrange.prototype.initialize=function(page){var user=this.analytics.user();window._loq||(window._loq=[]);window.__wtw_lucky_site_id=this.options.siteId;this.identify(new Identify({traits:user.traits(),userId:user.id()}));var cache=Math.floor((new Date).getTime()/6e4);var name=useHttps()?"https":"http";this.load(name,{cache:cache},this.ready)};LuckyOrange.prototype.loaded=function(){return!!window.__wtw_watcher_added};LuckyOrange.prototype.identify=function(identify){var traits=identify.traits();var email=identify.email();var name=identify.name();if(name)traits.name=name;if(email)traits.email=email;window.__wtw_custom_user_data=traits}},{"analytics.js-integration":83,facade:126,"use-https":85}],54:[function(require,module,exports){var integration=require("analytics.js-integration");var alias=require("alias");var Lytics=module.exports=integration("Lytics").global("jstag").option("cid","").option("cookie","seerid").option("delay",2e3).option("sessionTimeout",1800).option("url","//c.lytics.io").tag('<script src="//c.lytics.io/static/io.min.js">');var aliases={sessionTimeout:"sessecs"};Lytics.prototype.initialize=function(page){var options=alias(this.options,aliases);window.jstag=function(){var t={_q:[],_c:options,ts:(new Date).getTime()};t.send=function(){this._q.push(["ready","send",Array.prototype.slice.call(arguments)]);return this};return t}();this.load(this.ready)};Lytics.prototype.loaded=function(){return!!(window.jstag&&window.jstag.bind)};Lytics.prototype.page=function(page){window.jstag.send(page.properties())};Lytics.prototype.identify=function(identify){var traits=identify.traits({userId:"_uid"});window.jstag.send(traits)};Lytics.prototype.track=function(track){var props=track.properties();props._e=track.event();window.jstag.send(props)}},{"analytics.js-integration":83,alias:173}],55:[function(require,module,exports){var alias=require("alias");var clone=require("clone");var dates=require("convert-dates");var integration=require("analytics.js-integration");var is=require("is");var iso=require("to-iso-string");var indexof=require("indexof");var del=require("obj-case").del;var some=require("some");var Mixpanel=module.exports=integration("Mixpanel").global("mixpanel").option("increments",[]).option("cookieName","").option("nameTag",true).option("pageview",false).option("people",false).option("token","").option("trackAllPages",false).option("trackNamedPages",true).option("trackCategorizedPages",true).tag('<script src="//cdn.mxpnl.com/libs/mixpanel-2.2.min.js">');var optionsAliases={cookieName:"cookie_name"};Mixpanel.prototype.initialize=function(){(function(c,a){window.mixpanel=a;var b,d,h,e;a._i=[];a.init=function(b,c,f){function d(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof f?g=a[f]=[]:f="mixpanel";g.people=g.people||[];h=["disable","track","track_pageview","track_links","track_forms","register","register_once","unregister","identify","alias","name_tag","set_config","people.set","people.increment","people.track_charge","people.append"];for(e=0;e<h.length;e++)d(g,h[e]);a._i.push([b,c,f])};a.__SV=1.2})(document,window.mixpanel||[]);this.options.increments=lowercase(this.options.increments);var options=alias(this.options,optionsAliases);window.mixpanel.init(options.token,options);this.load(this.ready)};Mixpanel.prototype.loaded=function(){return!!(window.mixpanel&&window.mixpanel.config)};Mixpanel.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};var traitAliases={created:"$created",email:"$email",firstName:"$first_name",lastName:"$last_name",lastSeen:"$last_seen",name:"$name",username:"$username",phone:"$phone"};Mixpanel.prototype.identify=function(identify){var username=identify.username();var email=identify.email();var id=identify.userId();if(id)window.mixpanel.identify(id);var nametag=email||username||id;if(nametag)window.mixpanel.name_tag(nametag);var traits=identify.traits(traitAliases);if(traits.$created)del(traits,"createdAt");window.mixpanel.register(dates(traits,iso));if(this.options.people)window.mixpanel.people.set(traits)};Mixpanel.prototype.track=function(track){var increments=this.options.increments;var increment=track.event().toLowerCase();var people=this.options.people;var props=track.properties();var revenue=track.revenue();delete props.distinct_id;delete props.ip;delete props.mp_name_tag;delete props.mp_note;delete props.token;for(var key in props){var val=props[key];if(is.array(val)&&some(val,is.object))props[key]=val.length}if(people&&~indexof(increments,increment)){window.mixpanel.people.increment(track.event());window.mixpanel.people.set("Last "+track.event(),new Date)}props=dates(props,iso);window.mixpanel.track(track.event(),props);if(revenue&&people){window.mixpanel.people.track_charge(revenue)}};Mixpanel.prototype.alias=function(alias){var mp=window.mixpanel;var to=alias.to();if(mp.get_distinct_id&&mp.get_distinct_id()===to)return;if(mp.get_property&&mp.get_property("$people_distinct_id")===to)return;mp.alias(to,alias.from())};function lowercase(arr){var ret=new Array(arr.length);for(var i=0;i<arr.length;++i){ret[i]=String(arr[i]).toLowerCase()}return ret}},{alias:173,clone:172,"convert-dates":174,"analytics.js-integration":83,is:86,"to-iso-string":171,indexof:109,"obj-case":138,some:180}],180:[function(require,module,exports){var some=[].some;module.exports=function(arr,fn){if(some)return some.call(arr,fn);for(var i=0,l=arr.length;i<l;++i){if(fn(arr[i],i))return true}return false}},{}],56:[function(require,module,exports){var integration=require("analytics.js-integration");var bind=require("bind");var when=require("when");var is=require("is");var Mojn=module.exports=integration("Mojn").option("customerCode","").global("_mojnTrack").tag('<script src="https://track.idtargeting.com/{{ customerCode }}/track.js">');Mojn.prototype.initialize=function(){window._mojnTrack=window._mojnTrack||[];window._mojnTrack.push({cid:this.options.customerCode});var loaded=bind(this,this.loaded);var ready=this.ready;this.load(function(){when(loaded,ready)})};Mojn.prototype.loaded=function(){return is.object(window._mojnTrack)};Mojn.prototype.identify=function(identify){var email=identify.email();if(!email)return;var img=new Image;img.src="//matcher.idtargeting.com/analytics.gif?cid="+this.options.customerCode+"&_mjnctid="+email;img.width=1;img.height=1;return img};Mojn.prototype.track=function(track){var properties=track.properties();var revenue=properties.revenue;var currency=properties.currency||"";var conv=currency+revenue;if(!revenue)return;window._mojnTrack.push({conv:conv});return conv}},{"analytics.js-integration":83,bind:95,when:125,is:86}],57:[function(require,module,exports){var push=require("global-queue")("_mfq");var integration=require("analytics.js-integration");var each=require("each");var Mouseflow=module.exports=integration("Mouseflow").assumesPageview().global("mouseflow").global("_mfq").option("apiKey","").option("mouseflowHtmlDelay",0).tag('<script src="//cdn.mouseflow.com/projects/{{ apiKey }}.js">');Mouseflow.prototype.initialize=function(page){window.mouseflowHtmlDelay=this.options.mouseflowHtmlDelay;this.load(this.ready)};Mouseflow.prototype.loaded=function(){return!!window.mouseflow};Mouseflow.prototype.page=function(page){if(!window.mouseflow)return;if("function"!=typeof mouseflow.newPageView)return;mouseflow.newPageView()};Mouseflow.prototype.identify=function(identify){set(identify.traits())};Mouseflow.prototype.track=function(track){var props=track.properties();props.event=track.event();set(props)};function set(obj){each(obj,function(key,value){push("setVariable",key,value)})}},{"global-queue":168,"analytics.js-integration":83,each:4}],58:[function(require,module,exports){var integration=require("analytics.js-integration");var useHttps=require("use-https");var each=require("each");var is=require("is");var MouseStats=module.exports=integration("MouseStats").assumesPageview().global("msaa").global("MouseStatsVisitorPlaybacks").option("accountNumber","").tag("http",'<script src="http://www2.mousestats.com/js/{{ path }}.js?{{ cache }}">').tag("https",'<script src="https://ssl.mousestats.com/js/{{ path }}.js?{{ cache }}">');MouseStats.prototype.initialize=function(page){var number=this.options.accountNumber;var path=number.slice(0,1)+"/"+number.slice(1,2)+"/"+number;var cache=Math.floor((new Date).getTime()/6e4);var name=useHttps()?"https":"http";this.load(name,{path:path,cache:cache},this.ready)};MouseStats.prototype.loaded=function(){return is.array(window.MouseStatsVisitorPlaybacks)};MouseStats.prototype.identify=function(identify){each(identify.traits(),function(key,value){window.MouseStatsVisitorPlaybacks.customVariable(key,value)})}},{"analytics.js-integration":83,"use-https":85,each:4,is:86}],59:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("__nls");var Navilytics=module.exports=integration("Navilytics").assumesPageview().global("__nls").option("memberId","").option("projectId","").tag('<script src="//www.navilytics.com/nls.js?mid={{ memberId }}&pid={{ projectId }}">');Navilytics.prototype.initialize=function(page){window.__nls=window.__nls||[];this.load(this.ready)};Navilytics.prototype.loaded=function(){return!!(window.__nls&&[].push!=window.__nls.push)};Navilytics.prototype.track=function(track){push("tagRecording",track.event())}},{"analytics.js-integration":83,"global-queue":168}],60:[function(require,module,exports){var integration=require("analytics.js-integration");var https=require("use-https");var tick=require("next-tick");var Olark=module.exports=integration("Olark").assumesPageview().global("olark").option("identify",true).option("page",true).option("siteId","").option("groupId","").option("track",false);Olark.prototype.initialize=function(page){var self=this;this.load(function(){tick(self.ready)});var groupId=this.options.groupId;if(groupId){chat("setOperatorGroup",{group:groupId})}var self=this;box("onExpand",function(){self._open=true});box("onShrink",function(){self._open=false})};Olark.prototype.loaded=function(){return!!window.olark};Olark.prototype.load=function(callback){var el=document.getElementById("olark");window.olark||function(c){var f=window,d=document,l=https()?"https:":"http:",z=c.name,r="load";var nt=function(){f[z]=function(){(a.s=a.s||[]).push(arguments)};var a=f[z]._={},q=c.methods.length;while(q--){(function(n){f[z][n]=function(){f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={0:+new Date};a.P=function(u){a.p[u]=new Date-a.p[0]};function s(){a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){hd="head";return["<",hd,"></",hd,"><",i," onl"+'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if(!m){return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if(/MSIE[ ]+6/.test(navigator.userAgent)){b.src="javascript:false"}b.allowTransparency="true";v[j](b);try{b.contentWindow[g].open()}catch(w){c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try{var t=b.contentWindow[g];t.write(p());t.close()}catch(x){b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()}({loader:"static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]});window.olark.identify(this.options.siteId);callback()};Olark.prototype.page=function(page){if(!this.options.page||!this._open)return;var props=page.properties();var name=page.fullName();if(!name&&!props.url)return;var msg=name?name.toLowerCase()+" page":props.url;chat("sendNotificationToOperator",{body:"looking at "+msg})};Olark.prototype.identify=function(identify){if(!this.options.identify)return;var username=identify.username();var traits=identify.traits();var id=identify.userId();var email=identify.email();var phone=identify.phone();var name=identify.name()||identify.firstName();visitor("updateCustomFields",traits);if(email)visitor("updateEmailAddress",{emailAddress:email});if(phone)visitor("updatePhoneNumber",{phoneNumber:phone});if(name)visitor("updateFullName",{fullName:name});var nickname=name||email||username||id;if(name&&email)nickname+=" ("+email+")";if(nickname)chat("updateVisitorNickname",{snippet:nickname})};Olark.prototype.track=function(track){if(!this.options.track||!this._open)return;chat("sendNotificationToOperator",{body:'visitor triggered "'+track.event()+'"'})};function box(action,value){window.olark("api.box."+action,value)}function visitor(action,value){window.olark("api.visitor."+action,value)}function chat(action,value){window.olark("api.chat."+action,value)}},{"analytics.js-integration":83,"use-https":85,"next-tick":97}],61:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("optimizely");var callback=require("callback");var tick=require("next-tick");var bind=require("bind");var each=require("each");var Optimizely=module.exports=integration("Optimizely").option("variations",true).option("trackNamedPages",true).option("trackCategorizedPages",true);Optimizely.prototype.initialize=function(){if(this.options.variations){var self=this;tick(function(){self.replay()})}this.ready()};Optimizely.prototype.track=function(track){var props=track.properties();if(props.revenue)props.revenue*=100;push("trackEvent",track.event(),props)};Optimizely.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};Optimizely.prototype.replay=function(){if(!window.optimizely)return;var data=window.optimizely.data;if(!data)return;var experiments=data.experiments;var map=data.state.variationNamesMap;var traits={};each(map,function(experimentId,variation){var experiment=experiments[experimentId].name;traits["Experiment: "+experiment]=variation});this.analytics.identify(traits)}},{"analytics.js-integration":83,"global-queue":168,callback:88,"next-tick":97,bind:95,each:4}],62:[function(require,module,exports){var integration=require("analytics.js-integration");var PerfectAudience=module.exports=integration("Perfect Audience").assumesPageview().global("_pa").option("siteId","").tag('<script src="//tag.perfectaudience.com/serve/{{ siteId }}.js">');PerfectAudience.prototype.initialize=function(page){window._pa=window._pa||{};this.load(this.ready)};PerfectAudience.prototype.loaded=function(){return!!(window._pa&&window._pa.track)};PerfectAudience.prototype.track=function(track){window._pa.track(track.event(),track.properties())}},{"analytics.js-integration":83}],63:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_prum");var date=require("load-date");var Pingdom=module.exports=integration("Pingdom").assumesPageview().global("_prum").global("PRUM_EPISODES").option("id","").tag('<script src="//rum-static.pingdom.net/prum.min.js">');Pingdom.prototype.initialize=function(page){window._prum=window._prum||[];push("id",this.options.id);push("mark","firstbyte",date.getTime());var self=this;this.load(this.ready)};Pingdom.prototype.loaded=function(){return!!(window._prum&&window._prum.push!==Array.prototype.push)}},{"analytics.js-integration":83,"global-queue":168,"load-date":169}],64:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_paq");var each=require("each");var Piwik=module.exports=integration("Piwik").global("_paq").option("url",null).option("siteId","").mapping("goals").tag('<script src="{{ url }}/piwik.js">');Piwik.prototype.initialize=function(){window._paq=window._paq||[];push("setSiteId",this.options.siteId);push("setTrackerUrl",this.options.url+"/piwik.php");push("enableLinkTracking");this.load(this.ready)};Piwik.prototype.loaded=function(){return!!(window._paq&&window._paq.push!=[].push)};Piwik.prototype.page=function(page){push("trackPageView")};Piwik.prototype.track=function(track){var goals=this.goals(track.event());var revenue=track.revenue()||0;each(goals,function(goal){push("trackGoal",goal,revenue)})}},{"analytics.js-integration":83,"global-queue":168,each:4}],65:[function(require,module,exports){var integration=require("analytics.js-integration");var convertDates=require("convert-dates");var push=require("global-queue")("_lnq");var alias=require("alias");var Preact=module.exports=integration("Preact").assumesPageview().global("_lnq").option("projectCode","").tag('<script src="//d2bbvl6dq48fa6.cloudfront.net/js/ln-2.4.min.js">');Preact.prototype.initialize=function(page){window._lnq=window._lnq||[];push("_setCode",this.options.projectCode);this.load(this.ready)};Preact.prototype.loaded=function(){return!!(window._lnq&&window._lnq.push!==Array.prototype.push)};Preact.prototype.identify=function(identify){if(!identify.userId())return;var traits=identify.traits({created:"created_at"});traits=convertDates(traits,convertDate);push("_setPersonData",{name:identify.name(),email:identify.email(),uid:identify.userId(),properties:traits})};Preact.prototype.group=function(group){if(!group.groupId())return;push("_setAccount",group.traits())};Preact.prototype.track=function(track){var props=track.properties();var revenue=track.revenue();var event=track.event();var special={name:event};if(revenue){special.revenue=revenue*100;delete props.revenue}if(props.note){special.note=props.note;delete props.note}push("_logEvent",special,props)};function convertDate(date){return Math.floor(date/1e3)}},{"analytics.js-integration":83,"convert-dates":174,"global-queue":168,alias:173}],66:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_kiq");var Facade=require("facade");var Identify=Facade.Identify;var bind=require("bind");var when=require("when");var Qualaroo=module.exports=integration("Qualaroo").assumesPageview().global("_kiq").option("customerId","").option("siteToken","").option("track",false).tag('<script src="//s3.amazonaws.com/ki.js/{{ customerId }}/{{ siteToken }}.js">');Qualaroo.prototype.initialize=function(page){window._kiq=window._kiq||[];var loaded=bind(this,this.loaded);var ready=this.ready;this.load(function(){when(loaded,ready)})};Qualaroo.prototype.loaded=function(){return!!(window._kiq&&window._kiq.push!==Array.prototype.push)};Qualaroo.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();var email=identify.email();if(email)id=email;if(id)push("identify",id);if(traits)push("set",traits)};Qualaroo.prototype.track=function(track){if(!this.options.track)return;var event=track.event();var traits={};traits["Triggered: "+event]=true;this.identify(new Identify({traits:traits}))}},{"analytics.js-integration":83,"global-queue":168,facade:126,bind:95,when:125}],67:[function(require,module,exports){var push=require("global-queue")("_qevents",{wrap:false});var integration=require("analytics.js-integration");var useHttps=require("use-https");var Quantcast=module.exports=integration("Quantcast").assumesPageview().global("_qevents").global("__qc").option("pCode",null).option("advertise",false).tag("http",'<script src="http://edge.quantserve.com/quant.js">').tag("https",'<script src="https://secure.quantserve.com/quant.js">');Quantcast.prototype.initialize=function(page){window._qevents=window._qevents||[];var opts=this.options;var settings={qacct:opts.pCode};var user=this.analytics.user();if(user.id())settings.uid=user.id();if(page){settings.labels=this.labels("page",page.category(),page.name())}push(settings);var name=useHttps()?"https":"http";this.load(name,this.ready)};Quantcast.prototype.loaded=function(){return!!window.__qc};Quantcast.prototype.page=function(page){var category=page.category();var name=page.name();var settings={event:"refresh",labels:this.labels("page",category,name),qacct:this.options.pCode};var user=this.analytics.user();if(user.id())settings.uid=user.id();push(settings)};Quantcast.prototype.identify=function(identify){var id=identify.userId();if(id){window._qevents[0]=window._qevents[0]||{};window._qevents[0].uid=id}};Quantcast.prototype.track=function(track){var name=track.event();var revenue=track.revenue();var settings={event:"click",labels:this.labels("event",name),qacct:this.options.pCode}; var user=this.analytics.user();if(null!=revenue)settings.revenue=revenue+"";if(user.id())settings.uid=user.id();push(settings)};Quantcast.prototype.completedOrder=function(track){var name=track.event();var revenue=track.total();var labels=this.labels("event",name);var category=track.category();if(this.options.advertise&&category){labels+=","+this.labels("pcat",category)}var settings={event:"refresh",labels:labels,revenue:revenue+"",orderid:track.orderId(),qacct:this.options.pCode};push(settings)};Quantcast.prototype.labels=function(type){var args=[].slice.call(arguments,1);var advertise=this.options.advertise;var ret=[];if(advertise&&"page"==type)type="event";if(advertise)type="_fp."+type;for(var i=0;i<args.length;++i){if(null==args[i])continue;var value=String(args[i]);ret.push(value.replace(/,/g,";"))}ret=advertise?ret.join(" "):ret.join(".");return[type,ret].join(".")}},{"global-queue":168,"analytics.js-integration":83,"use-https":85}],68:[function(require,module,exports){var integration=require("analytics.js-integration");var extend=require("extend");var is=require("is");var RollbarIntegration=module.exports=integration("Rollbar").global("Rollbar").option("identify",true).option("accessToken","").option("environment","unknown").option("captureUncaught",true);RollbarIntegration.prototype.initialize=function(page){var _rollbarConfig=this.config={accessToken:this.options.accessToken,captureUncaught:this.options.captureUncaught,payload:{environment:this.options.environment}};(function(a){function b(b){this.shimId=++g,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0===a.console.shimId&&(this.logger=a.console.log)}function c(b,c,d){!d[4]&&a._rollbarWrappedError&&(d[4]=a._rollbarWrappedError,a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function d(c){var d=b;return f(function(){if(this.notifier)return this.notifier[c].apply(this.notifier,arguments);var b=this,e="scope"===c;e&&(b=new d(this));var f=Array.prototype.slice.call(arguments,0),g={shim:b,method:c,args:f,ts:new Date};return a._rollbarShimQueue.push(g),e?b:void 0})}function e(a,b){if(b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b._wrapped||b,c)}}}function f(a,b){return b=b||this.logger,function(){try{return a.apply(this,arguments)}catch(c){b("Rollbar internal error:",c)}}}var g=0;b.init=function(a,d){var g=d.globalAlias||"Rollbar";if("object"==typeof a[g])return a[g];a._rollbarShimQueue=[],a._rollbarWrappedError=null,d=d||{};var h=new b;return f(function(){if(h.configure(d),d.captureUncaught){var b=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);c(h,b,a)};var f,i,j=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];for(f=0;f<j.length;++f)i=j[f],a[i]&&a[i].prototype&&e(h,a[i].prototype)}return a[g]=h,h},h.logger)()},b.prototype.loadFull=function(a,b,c,d,e){var g=f(function(){var a=b.createElement("script"),e=b.getElementsByTagName("script")[0];a.src=d.rollbarJsUrl,a.async=!c,a.onload=h,e.parentNode.insertBefore(a,e)},this.logger),h=f(function(){var b;if(void 0===a._rollbarPayloadQueue){var c,d,f,g;for(b=new Error("rollbar.js did not load");c=a._rollbarShimQueue.shift();)for(f=c.args,g=0;g<f.length;++g)if(d=f[g],"function"==typeof d){d(b);break}}e&&e(b)},this.logger);f(function(){c?g():a.addEventListener?a.addEventListener("load",g,!1):a.attachEvent("onload",g)},this.logger)()},b.prototype.wrap=function(b){if("function"!=typeof b)return b;if(b._isWrap)return b;if(!b._wrapped){b._wrapped=function(){try{return b.apply(this,arguments)}catch(c){throw a._rollbarWrappedError=c,c}},b._wrapped._isWrap=!0;for(var c in b)b.hasOwnProperty(c)&&(b._wrapped[c]=b[c])}return b._wrapped};for(var h="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError".split(","),i=0;i<h.length;++i)b.prototype[h[i]]=d(h[i]);var j="//d37gvrvc0wt4s1.cloudfront.net/js/v1.0/rollbar.min.js";_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||j,b.init(a,_rollbarConfig)})(window,document);this.load(this.ready)};RollbarIntegration.prototype.loaded=function(){return is.object(window.Rollbar)&&null==window.Rollbar.shimId};RollbarIntegration.prototype.load=function(callback){window.Rollbar.loadFull(window,document,true,this.config,callback)};RollbarIntegration.prototype.identify=function(identify){if(!this.options.identify)return;var uid=identify.userId();if(uid===null||uid===undefined)return;var rollbar=window.Rollbar;var person={id:uid};extend(person,identify.traits());rollbar.configure({payload:{person:person}})}},{"analytics.js-integration":83,extend:124,is:86}],69:[function(require,module,exports){var integration=require("analytics.js-integration");var SaaSquatch=module.exports=integration("SaaSquatch").option("tenantAlias","").global("_sqh").tag('<script src="//d2rcp9ak152ke1.cloudfront.net/assets/javascripts/squatch.min.js">');SaaSquatch.prototype.initialize=function(page){window._sqh=window._sqh||[];this.load(this.ready)};SaaSquatch.prototype.loaded=function(){return window._sqh&&window._sqh.push!=[].push};SaaSquatch.prototype.identify=function(identify){var sqh=window._sqh;var accountId=identify.proxy("traits.accountId");var image=identify.proxy("traits.referralImage");var opts=identify.options(this.name);var id=identify.userId();var email=identify.email();if(!(id||email))return;if(this.called)return;var init={tenant_alias:this.options.tenantAlias,first_name:identify.firstName(),last_name:identify.lastName(),user_image:identify.avatar(),email:email,user_id:id};if(accountId)init.account_id=accountId;if(opts.checksum)init.checksum=opts.checksum;if(image)init.fb_share_image=image;sqh.push(["init",init]);this.called=true;this.load()}},{"analytics.js-integration":83}],70:[function(require,module,exports){var integration=require("analytics.js-integration");var is=require("is");var Sentry=module.exports=integration("Sentry").global("Raven").option("config","").tag('<script src="//cdn.ravenjs.com/1.1.10/native/raven.min.js">');Sentry.prototype.initialize=function(){var config=this.options.config;var self=this;this.load(function(){window.Raven.config(config).install();self.ready()})};Sentry.prototype.loaded=function(){return is.object(window.Raven)};Sentry.prototype.identify=function(identify){window.Raven.setUser(identify.traits())}},{"analytics.js-integration":83,is:86}],71:[function(require,module,exports){var integration=require("analytics.js-integration");var is=require("is");var SnapEngage=module.exports=integration("SnapEngage").assumesPageview().global("SnapABug").option("apiKey","").tag('<script src="//commondatastorage.googleapis.com/code.snapengage.com/js/{{ apiKey }}.js">');SnapEngage.prototype.initialize=function(page){this.load(this.ready)};SnapEngage.prototype.loaded=function(){return is.object(window.SnapABug)};SnapEngage.prototype.identify=function(identify){var email=identify.email();if(!email)return;window.SnapABug.setUserEmail(email)}},{"analytics.js-integration":83,is:86}],72:[function(require,module,exports){var integration=require("analytics.js-integration");var bind=require("bind");var when=require("when");var Spinnakr=module.exports=integration("Spinnakr").assumesPageview().global("_spinnakr_site_id").global("_spinnakr").option("siteId","").tag('<script src="//d3ojzyhbolvoi5.cloudfront.net/js/so.js">');Spinnakr.prototype.initialize=function(page){window._spinnakr_site_id=this.options.siteId;var loaded=bind(this,this.loaded);var ready=this.ready;this.load(function(){when(loaded,ready)})};Spinnakr.prototype.loaded=function(){return!!window._spinnakr}},{"analytics.js-integration":83,bind:95,when:125}],73:[function(require,module,exports){var integration=require("analytics.js-integration");var slug=require("slug");var push=require("global-queue")("_tsq");var Tapstream=module.exports=integration("Tapstream").assumesPageview().global("_tsq").option("accountName","").option("trackAllPages",true).option("trackNamedPages",true).option("trackCategorizedPages",true).tag('<script src="//cdn.tapstream.com/static/js/tapstream.js">');Tapstream.prototype.initialize=function(page){window._tsq=window._tsq||[];push("setAccountName",this.options.accountName);this.load(this.ready)};Tapstream.prototype.loaded=function(){return!!(window._tsq&&window._tsq.push!==Array.prototype.push)};Tapstream.prototype.page=function(page){var category=page.category();var opts=this.options;var name=page.fullName();if(opts.trackAllPages){this.track(page.track())}if(name&&opts.trackNamedPages){this.track(page.track(name))}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}};Tapstream.prototype.track=function(track){var props=track.properties();push("fireHit",slug(track.event()),[props.url])}},{"analytics.js-integration":83,slug:93,"global-queue":168}],74:[function(require,module,exports){var integration=require("analytics.js-integration");var alias=require("alias");var clone=require("clone");var Trakio=module.exports=integration("trak.io").assumesPageview().global("trak").option("token","").option("trackNamedPages",true).option("trackCategorizedPages",true).tag('<script src="//d29p64779x43zo.cloudfront.net/v1/trak.io.min.js">');var optionsAliases={initialPageview:"auto_track_page_view"};Trakio.prototype.initialize=function(page){var options=this.options;window.trak=window.trak||[];window.trak.io=window.trak.io||{};window.trak.push=window.trak.push||function(){};window.trak.io.load=window.trak.io.load||function(e){var r=function(e){return function(){window.trak.push([e].concat(Array.prototype.slice.call(arguments,0)))}},i=["initialize","identify","track","alias","channel","source","host","protocol","page_view"];for(var s=0;s<i.length;s++)window.trak.io[i[s]]=r(i[s]);window.trak.io.initialize.apply(window.trak.io,arguments)};window.trak.io.load(options.token,alias(options,optionsAliases));this.load(this.ready)};Trakio.prototype.loaded=function(){return!!(window.trak&&window.trak.loaded)};Trakio.prototype.page=function(page){var category=page.category();var props=page.properties();var name=page.fullName();window.trak.io.page_view(props.path,name||props.title);if(name&&this.options.trackNamedPages){this.track(page.track(name))}if(category&&this.options.trackCategorizedPages){this.track(page.track(category))}};var traitAliases={avatar:"avatar_url",firstName:"first_name",lastName:"last_name"};Trakio.prototype.identify=function(identify){var traits=identify.traits(traitAliases);var id=identify.userId();if(id){window.trak.io.identify(id,traits)}else{window.trak.io.identify(traits)}};Trakio.prototype.track=function(track){window.trak.io.track(track.event(),track.properties())};Trakio.prototype.alias=function(alias){if(!window.trak.io.distinct_id)return;var from=alias.from();var to=alias.to();if(to===window.trak.io.distinct_id())return;if(from){window.trak.io.alias(from,to)}else{window.trak.io.alias(to)}}},{"analytics.js-integration":83,alias:173,clone:172}],75:[function(require,module,exports){var integration=require("analytics.js-integration");var each=require("each");var has=Object.prototype.hasOwnProperty;var TwitterAds=module.exports=integration("Twitter Ads").option("page","").tag('<img src="//analytics.twitter.com/i/adsct?txn_id={{ pixelId }}&p_id=Twitter"/>').mapping("events");TwitterAds.prototype.initialize=function(){this.ready()};TwitterAds.prototype.page=function(page){if(this.options.page){this.load({pixelId:this.options.page})}};TwitterAds.prototype.track=function(track){var events=this.events(track.event());var self=this;each(events,function(pixelId){self.load({pixelId:pixelId})})}},{"analytics.js-integration":83,each:4}],76:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_uc");var Usercycle=module.exports=integration("USERcycle").assumesPageview().global("_uc").option("key","").tag('<script src="//api.usercycle.com/javascripts/track.js">');Usercycle.prototype.initialize=function(page){push("_key",this.options.key);this.load(this.ready)};Usercycle.prototype.loaded=function(){return!!(window._uc&&window._uc.push!==Array.prototype.push)};Usercycle.prototype.identify=function(identify){var traits=identify.traits();var id=identify.userId();if(id)push("uid",id);push("action","came_back",traits)};Usercycle.prototype.track=function(track){push("action",track.event(),track.properties({revenue:"revenue_amount"}))}},{"analytics.js-integration":83,"global-queue":168}],77:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("UserVoice");var convertDates=require("convert-dates");var unix=require("to-unix-timestamp");var alias=require("alias");var clone=require("clone");var UserVoice=module.exports=integration("UserVoice").assumesPageview().global("UserVoice").global("showClassicWidget").option("apiKey","").option("classic",false).option("forumId",null).option("showWidget",true).option("mode","contact").option("accentColor","#448dd6").option("smartvote",true).option("trigger",null).option("triggerPosition","bottom-right").option("triggerColor","#ffffff").option("triggerBackgroundColor","rgba(46, 49, 51, 0.6)").option("classicMode","full").option("primaryColor","#cc6d00").option("linkColor","#007dbf").option("defaultMode","support").option("tabLabel","Feedback & Support").option("tabColor","#cc6d00").option("tabPosition","middle-right").option("tabInverted",false).tag('<script src="//widget.uservoice.com/{{ apiKey }}.js">');UserVoice.on("construct",function(integration){if(!integration.options.classic)return;integration.group=undefined;integration.identify=integration.identifyClassic;integration.initialize=integration.initializeClassic});UserVoice.prototype.initialize=function(page){var options=this.options;var opts=formatOptions(options);push("set",opts);push("autoprompt",{});if(options.showWidget){options.trigger?push("addTrigger",options.trigger,opts):push("addTrigger",opts)}this.load(this.ready)};UserVoice.prototype.loaded=function(){return!!(window.UserVoice&&window.UserVoice.push!==Array.prototype.push)};UserVoice.prototype.identify=function(identify){var traits=identify.traits({created:"created_at"});traits=convertDates(traits,unix);push("identify",traits)};UserVoice.prototype.group=function(group){var traits=group.traits({created:"created_at"});traits=convertDates(traits,unix);push("identify",{account:traits})};UserVoice.prototype.initializeClassic=function(){var options=this.options;window.showClassicWidget=showClassicWidget;if(options.showWidget)showClassicWidget("showTab",formatClassicOptions(options));this.load(this.ready)};UserVoice.prototype.identifyClassic=function(identify){push("setCustomFields",identify.traits())};function formatOptions(options){return alias(options,{forumId:"forum_id",accentColor:"accent_color",smartvote:"smartvote_enabled",triggerColor:"trigger_color",triggerBackgroundColor:"trigger_background_color",triggerPosition:"trigger_position"})}function formatClassicOptions(options){return alias(options,{forumId:"forum_id",classicMode:"mode",primaryColor:"primary_color",tabPosition:"tab_position",tabColor:"tab_color",linkColor:"link_color",defaultMode:"default_mode",tabLabel:"tab_label",tabInverted:"tab_inverted"})}function showClassicWidget(type,options){type=type||"showLightbox";push(type,"classic_widget",options)}},{"analytics.js-integration":83,"global-queue":168,"convert-dates":174,"to-unix-timestamp":181,alias:173,clone:172}],181:[function(require,module,exports){module.exports=toUnixTimestamp;function toUnixTimestamp(date){return Math.floor(date.getTime()/1e3)}},{}],78:[function(require,module,exports){var integration=require("analytics.js-integration");var push=require("global-queue")("_veroq");var cookie=require("component/cookie");var Vero=module.exports=integration("Vero").global("_veroq").option("apiKey","").tag('<script src="//d3qxef4rp70elm.cloudfront.net/m.js">');Vero.prototype.initialize=function(page){if(!cookie("__veroc4"))cookie("__veroc4","[]");push("init",{api_key:this.options.apiKey});this.load(this.ready)};Vero.prototype.loaded=function(){return!!(window._veroq&&window._veroq.push!==Array.prototype.push)};Vero.prototype.page=function(page){push("trackPageview")};Vero.prototype.identify=function(identify){var traits=identify.traits();var email=identify.email();var id=identify.userId();if(!id||!email)return;push("user",traits)};Vero.prototype.track=function(track){push("track",track.event(),track.properties())}},{"analytics.js-integration":83,"global-queue":168,"component/cookie":182}],182:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;module.exports=function(name,value,options){switch(arguments.length){case 3:case 2:return set(name,value,options);case 1:return get(name);default:return all()}};function set(name,value,options){options=options||{};var str=encode(name)+"="+encode(value);if(null==value)options.maxage=-1;if(options.maxage){options.expires=new Date(+new Date+options.maxage)}if(options.path)str+="; path="+options.path;if(options.domain)str+="; domain="+options.domain;if(options.expires)str+="; expires="+options.expires.toGMTString();if(options.secure)str+="; secure";document.cookie=str}function all(){return parse(document.cookie)}function get(name){return all()[name]}function parse(str){var obj={};var pairs=str.split(/ *; */);var pair;if(""==pairs[0])return obj;for(var i=0;i<pairs.length;++i){pair=pairs[i].split("=");obj[decode(pair[0])]=decode(pair[1])}return obj}},{}],79:[function(require,module,exports){var integration=require("analytics.js-integration");var tick=require("next-tick");var each=require("each");var VWO=module.exports=integration("Visual Website Optimizer").option("replay",true);VWO.prototype.initialize=function(){if(this.options.replay)this.replay();this.ready()};VWO.prototype.replay=function(){var analytics=this.analytics;tick(function(){experiments(function(err,traits){if(traits)analytics.identify(traits)})})};function experiments(fn){enqueue(function(){var data={};var ids=window._vwo_exp_ids;if(!ids)return fn();each(ids,function(id){var name=variation(id);if(name)data["Experiment: "+id]=name});fn(null,data)})}function enqueue(fn){window._vis_opt_queue=window._vis_opt_queue||[];window._vis_opt_queue.push(fn)}function variation(id){var experiments=window._vwo_exp;if(!experiments)return null;var experiment=experiments[id];var variationId=experiment.combination_chosen;return variationId?experiment.comb_n[variationId]:null}},{"analytics.js-integration":83,"next-tick":97,each:4}],80:[function(require,module,exports){var integration=require("analytics.js-integration");var useHttps=require("use-https");var WebEngage=module.exports=integration("WebEngage").assumesPageview().global("_weq").global("webengage").option("widgetVersion","4.0").option("licenseCode","").tag("http",'<script src="http://cdn.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">').tag("https",'<script src="https://ssl.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">');WebEngage.prototype.initialize=function(page){var _weq=window._weq=window._weq||{};_weq["webengage.licenseCode"]=this.options.licenseCode;_weq["webengage.widgetVersion"]=this.options.widgetVersion;var name=useHttps()?"https":"http";this.load(name,this.ready)};WebEngage.prototype.loaded=function(){return!!window.webengage}},{"analytics.js-integration":83,"use-https":85}],81:[function(require,module,exports){var integration=require("analytics.js-integration");var snake=require("to-snake-case");var isEmail=require("is-email");var extend=require("extend");var each=require("each");var type=require("type");var Woopra=module.exports=integration("Woopra").global("woopra").option("domain","").option("cookieName","wooTracker").option("cookieDomain",null).option("cookiePath","/").option("ping",true).option("pingInterval",12e3).option("idleTimeout",3e5).option("downloadTracking",true).option("outgoingTracking",true).option("outgoingIgnoreSubdomain",true).option("downloadPause",200).option("outgoingPause",400).option("ignoreQueryUrl",true).option("hideCampaign",false).tag('<script src="//static.woopra.com/js/w.js">');Woopra.prototype.initialize=function(page){(function(){var i,s,z,w=window,d=document,a=arguments,q="script",f=["config","track","identify","visit","push","call"],c=function(){var i,self=this;self._e=[];for(i=0;i<f.length;i++){(function(f){self[f]=function(){self._e.push([f].concat(Array.prototype.slice.call(arguments,0)));return self}})(f[i])}};w._w=w._w||{};for(i=0;i<a.length;i++){w._w[a[i]]=w[a[i]]=w[a[i]]||new c}})("woopra");this.load(this.ready);each(this.options,function(key,value){key=snake(key);if(null==value)return;if(""===value)return;window.woopra.config(key,value)})};Woopra.prototype.loaded=function(){return!!(window.woopra&&window.woopra.loaded)};Woopra.prototype.page=function(page){var props=page.properties();var name=page.fullName();if(name)props.title=name;window.woopra.track("pv",props)};Woopra.prototype.identify=function(identify){var traits=identify.traits();if(identify.name())traits.name=identify.name();window.woopra.identify(traits).push()};Woopra.prototype.track=function(track){window.woopra.track(track.event(),track.properties())}},{"analytics.js-integration":83,"to-snake-case":84,"is-email":163,extend:124,each:4,type:7}],82:[function(require,module,exports){var integration=require("analytics.js-integration");var tick=require("next-tick");var bind=require("bind");var when=require("when");var Yandex=module.exports=integration("Yandex Metrica").assumesPageview().global("yandex_metrika_callbacks").global("Ya").option("counterId",null).option("clickmap",false).option("webvisor",false).tag('<script src="//mc.yandex.ru/metrika/watch.js">');Yandex.prototype.initialize=function(page){var id=this.options.counterId;var clickmap=this.options.clickmap;var webvisor=this.options.webvisor;push(function(){window["yaCounter"+id]=new window.Ya.Metrika({id:id,clickmap:clickmap,webvisor:webvisor})});var loaded=bind(this,this.loaded);var ready=this.ready;this.load(function(){when(loaded,function(){tick(ready)})})};Yandex.prototype.loaded=function(){return!!(window.Ya&&window.Ya.Metrika)};function push(callback){window.yandex_metrika_callbacks=window.yandex_metrika_callbacks||[];window.yandex_metrika_callbacks.push(callback)}},{"analytics.js-integration":83,"next-tick":97,bind:95,when:125}],3:[function(require,module,exports){var after=require("after");var bind=require("bind");var callback=require("callback");var canonical=require("canonical");var clone=require("clone");var cookie=require("./cookie");var debug=require("debug");var defaults=require("defaults");var each=require("each");var Emitter=require("emitter");var group=require("./group");var is=require("is");var isEmail=require("is-email");var isMeta=require("is-meta");var newDate=require("new-date");var on=require("event").bind;var prevent=require("prevent");var querystring=require("querystring");var size=require("object").length;var store=require("./store");var url=require("url");var user=require("./user");var Facade=require("facade");var Identify=Facade.Identify;var Group=Facade.Group;var Alias=Facade.Alias;var Track=Facade.Track;var Page=Facade.Page;exports=module.exports=Analytics;exports.cookie=cookie;exports.store=store;function Analytics(){this.Integrations={};this._integrations={};this._readied=false;this._timeout=300;this._user=user;bind.all(this);var self=this;this.on("initialize",function(settings,options){if(options.initialPageview)self.page()});this.on("initialize",function(){self._parseQuery()})}Emitter(Analytics.prototype);Analytics.prototype.use=function(plugin){plugin(this);return this};Analytics.prototype.addIntegration=function(Integration){var name=Integration.prototype.name;if(!name)throw new TypeError("attempted to add an invalid integration");this.Integrations[name]=Integration;return this};Analytics.prototype.init=Analytics.prototype.initialize=function(settings,options){settings=settings||{};options=options||{};this._options(options);this._readied=false;var self=this;each(settings,function(name){var Integration=self.Integrations[name];if(!Integration)delete settings[name]});each(settings,function(name,opts){var Integration=self.Integrations[name];var integration=new Integration(clone(opts));self.add(integration)});var integrations=this._integrations;user.load();group.load();var ready=after(size(integrations),function(){self._readied=true;self.emit("ready")});each(integrations,function(name,integration){if(options.initialPageview&&integration.options.initialPageview===false){integration.page=after(2,integration.page)}integration.analytics=self;integration.once("ready",ready);integration.initialize()});this.initialized=true;this.emit("initialize",settings,options);return this};Analytics.prototype.add=function(integration){this._integrations[integration.name]=integration;return this};Analytics.prototype.identify=function(id,traits,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(traits))fn=traits,options=null,traits=null;if(is.object(id))options=traits,traits=id,id=user.id();user.identify(id,traits);id=user.id();traits=user.traits();this._invoke("identify",message(Identify,{options:options,traits:traits,userId:id}));this.emit("identify",id,traits,options);this._callback(fn);return this};Analytics.prototype.user=function(){return user};Analytics.prototype.group=function(id,traits,options,fn){if(0===arguments.length)return group;if(is.fn(options))fn=options,options=null;if(is.fn(traits))fn=traits,options=null,traits=null;if(is.object(id))options=traits,traits=id,id=group.id();group.identify(id,traits);id=group.id();traits=group.traits();this._invoke("group",message(Group,{options:options,traits:traits,groupId:id}));this.emit("group",id,traits,options);this._callback(fn);return this};Analytics.prototype.track=function(event,properties,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(properties))fn=properties,options=null,properties=null;this._invoke("track",message(Track,{properties:properties,options:options,event:event}));this.emit("track",event,properties,options);this._callback(fn);return this};Analytics.prototype.trackClick=Analytics.prototype.trackLink=function(links,event,properties){if(!links)return this;if(is.element(links))links=[links];var self=this;each(links,function(el){if(!is.element(el))throw new TypeError("Must pass HTMLElement to `analytics.trackLink`.");on(el,"click",function(e){var ev=is.fn(event)?event(el):event;var props=is.fn(properties)?properties(el):properties;self.track(ev,props);if(el.href&&el.target!=="_blank"&&!isMeta(e)){prevent(e);self._callback(function(){window.location.href=el.href})}})});return this};Analytics.prototype.trackSubmit=Analytics.prototype.trackForm=function(forms,event,properties){if(!forms)return this;if(is.element(forms))forms=[forms];var self=this;each(forms,function(el){if(!is.element(el))throw new TypeError("Must pass HTMLElement to `analytics.trackForm`.");function handler(e){prevent(e);var ev=is.fn(event)?event(el):event;var props=is.fn(properties)?properties(el):properties;self.track(ev,props);self._callback(function(){el.submit()})}var $=window.jQuery||window.Zepto;if($){$(el).submit(handler)}else{on(el,"submit",handler)}});return this};Analytics.prototype.page=function(category,name,properties,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(properties))fn=properties,options=properties=null;if(is.fn(name))fn=name,options=properties=name=null;if(is.object(category))options=name,properties=category,name=category=null;if(is.object(name))options=properties,properties=name,name=null;if(is.string(category)&&!is.string(name))name=category,category=null;var defs={path:canonicalPath(),referrer:document.referrer,title:document.title,search:location.search};if(name)defs.name=name;if(category)defs.category=category;properties=clone(properties)||{};defaults(properties,defs);properties.url=properties.url||canonicalUrl(properties.search);this._invoke("page",message(Page,{properties:properties,category:category,options:options,name:name}));this.emit("page",category,name,properties,options);this._callback(fn);return this};Analytics.prototype.pageview=function(url,options){var properties={};if(url)properties.path=url;this.page(properties);return this};Analytics.prototype.alias=function(to,from,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(from))fn=from,options=null,from=null;if(is.object(from))options=from,from=null;this._invoke("alias",message(Alias,{options:options,from:from,to:to}));this.emit("alias",to,from,options);this._callback(fn);return this};Analytics.prototype.ready=function(fn){if(!is.fn(fn))return this;this._readied?callback.async(fn):this.once("ready",fn);return this};Analytics.prototype.timeout=function(timeout){this._timeout=timeout};Analytics.prototype.debug=function(str){if(0==arguments.length||str){debug.enable("analytics:"+(str||"*"))}else{debug.disable()}};Analytics.prototype._options=function(options){options=options||{};cookie.options(options.cookie);store.options(options.localStorage);user.options(options.user);group.options(options.group);return this};Analytics.prototype._callback=function(fn){callback.async(fn,this._timeout);return this};Analytics.prototype._invoke=function(method,facade){var options=facade.options();this.emit("invoke",facade);each(this._integrations,function(name,integration){if(!facade.enabled(name))return;integration.invoke.call(integration,method,facade)});return this};Analytics.prototype.push=function(args){var method=args.shift();if(!this[method])return;this[method].apply(this,args)};Analytics.prototype._parseQuery=function(){var q=querystring.parse(window.location.search);if(q.ajs_uid)this.identify(q.ajs_uid);if(q.ajs_event)this.track(q.ajs_event);return this};function canonicalPath(){var canon=canonical();if(!canon)return window.location.pathname;var parsed=url.parse(canon);return parsed.pathname}function canonicalUrl(search){var canon=canonical();if(canon)return~canon.indexOf("?")?canon:canon+search;var url=window.location.href;var i=url.indexOf("#");return-1==i?url:url.slice(0,i)}function message(Type,msg){var ctx=msg.options||{};if(ctx.timestamp||ctx.integrations||ctx.context){msg=defaults(ctx,msg);delete msg.options}return new Type(msg)}},{after:105,bind:183,callback:88,canonical:176,clone:89,"./cookie":184,debug:185,defaults:91,each:4,emitter:102,"./group":186,is:86,"is-email":163,"is-meta":187,"new-date":140,event:188,prevent:189,querystring:190,object:175,"./store":191,url:177,"./user":192,facade:126}],183:[function(require,module,exports){try{var bind=require("bind")}catch(e){var bind=require("bind-component")}var bindAll=require("bind-all");module.exports=exports=bind;exports.all=bindAll;exports.methods=bindMethods;function bindMethods(obj,methods){methods=[].slice.call(arguments,1);for(var i=0,method;method=methods[i];i++){obj[method]=bind(obj,obj[method])}return obj}},{bind:95,"bind-all":96}],184:[function(require,module,exports){var debug=require("debug")("analytics.js:cookie");var bind=require("bind");var cookie=require("cookie");var clone=require("clone");var defaults=require("defaults");var json=require("json");var topDomain=require("top-domain");function Cookie(options){this.options(options)}Cookie.prototype.options=function(options){if(arguments.length===0)return this._options;options=options||{};var domain="."+topDomain(window.location.href);this._options=defaults(options,{maxage:31536e6,path:"/",domain:domain}); this.set("ajs:test",true);if(!this.get("ajs:test")){debug("fallback to domain=null");this._options.domain=null}this.remove("ajs:test")};Cookie.prototype.set=function(key,value){try{value=json.stringify(value);cookie(key,value,clone(this._options));return true}catch(e){return false}};Cookie.prototype.get=function(key){try{var value=cookie(key);value=value?json.parse(value):null;return value}catch(e){return null}};Cookie.prototype.remove=function(key){try{cookie(key,null,clone(this._options));return true}catch(e){return false}};module.exports=bind.all(new Cookie);module.exports.Cookie=Cookie},{debug:185,bind:183,cookie:182,clone:89,defaults:91,json:193,"top-domain":194}],185:[function(require,module,exports){if("undefined"==typeof window){module.exports=require("./lib/debug")}else{module.exports=require("./debug")}},{"./lib/debug":195,"./debug":196}],195:[function(require,module,exports){var tty=require("tty");module.exports=debug;var names=[],skips=[];(process.env.DEBUG||"").split(/[\s,]+/).forEach(function(name){name=name.replace("*",".*?");if(name[0]==="-"){skips.push(new RegExp("^"+name.substr(1)+"$"))}else{names.push(new RegExp("^"+name+"$"))}});var colors=[6,2,3,4,5,1];var prev={};var prevColor=0;var isatty=tty.isatty(2);function color(){return colors[prevColor++%colors.length]}function humanize(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"}function debug(name){function disabled(){}disabled.enabled=false;var match=skips.some(function(re){return re.test(name)});if(match)return disabled;match=names.some(function(re){return re.test(name)});if(!match)return disabled;var c=color();function colored(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(prev[name]||curr);prev[name]=curr;fmt=" [9"+c+"m"+name+" "+"[3"+c+"m"+fmt+"[3"+c+"m"+" +"+humanize(ms)+"";console.error.apply(this,arguments)}function plain(fmt){fmt=coerce(fmt);fmt=(new Date).toUTCString()+" "+name+" "+fmt;console.error.apply(this,arguments)}colored.enabled=plain.enabled=true;return isatty||process.env.DEBUG_COLORS?colored:plain}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{}],196:[function(require,module,exports){module.exports=debug;function debug(name){if(!debug.enabled(name))return function(){};return function(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(debug[name]||curr);debug[name]=curr;fmt=name+" "+fmt+" +"+debug.humanize(ms);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];debug.enable=function(name){try{localStorage.debug=name}catch(e){}var split=(name||"").split(/[\s,]+/),len=split.length;for(var i=0;i<len;i++){name=split[i].replace("*",".*?");if(name[0]==="-"){debug.skips.push(new RegExp("^"+name.substr(1)+"$"))}else{debug.names.push(new RegExp("^"+name+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i<len;i++){if(debug.skips[i].test(name)){return false}}for(var i=0,len=debug.names.length;i<len;i++){if(debug.names[i].test(name)){return true}}return false};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],193:[function(require,module,exports){var json=window.JSON||{};var stringify=json.stringify;var parse=json.parse;module.exports=parse&&stringify?JSON:require("json-fallback")},{"json-fallback":197}],197:[function(require,module,exports){(function(){"use strict";var JSON=module.exports={};function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var cx,escapable,gap,indent,meta,rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else if(typeof space==="string"){indent=space}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})()},{}],194:[function(require,module,exports){var parse=require("url").parse;module.exports=domain;var regexp=/[a-z0-9][a-z0-9\-]*[a-z0-9]\.[a-z\.]{2,6}$/i;function domain(url){var host=parse(url).hostname;var match=host.match(regexp);return match?match[0]:""}},{url:177}],186:[function(require,module,exports){var debug=require("debug")("analytics:group");var Entity=require("./entity");var inherit=require("inherit");var bind=require("bind");Group.defaults={persist:true,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}};function Group(options){this.defaults=Group.defaults;this.debug=debug;Entity.call(this,options)}inherit(Group,Entity);module.exports=bind.all(new Group);module.exports.Group=Group},{debug:185,"./entity":198,inherit:199,bind:183}],198:[function(require,module,exports){var traverse=require("isodate-traverse");var defaults=require("defaults");var cookie=require("./cookie");var store=require("./store");var extend=require("extend");var clone=require("clone");module.exports=Entity;function Entity(options){this.protocol=window.location.protocol;this.options(options)}Entity.prototype.storage=function(){return"file:"==this.protocol||"chrome-extension:"==this.protocol?store:cookie};Entity.prototype.options=function(options){if(arguments.length===0)return this._options;options||(options={});defaults(options,this.defaults||{});this._options=options};Entity.prototype.id=function(id){switch(arguments.length){case 0:return this._getId();case 1:return this._setId(id)}};Entity.prototype._getId=function(){var storage=this.storage();var ret=this._options.persist?storage.get(this._options.cookie.key):this._id;return ret===undefined?null:ret};Entity.prototype._setId=function(id){var storage=this.storage();if(this._options.persist){storage.set(this._options.cookie.key,id)}else{this._id=id}};Entity.prototype.properties=Entity.prototype.traits=function(traits){switch(arguments.length){case 0:return this._getTraits();case 1:return this._setTraits(traits)}};Entity.prototype._getTraits=function(){var ret=this._options.persist?store.get(this._options.localStorage.key):this._traits;return ret?traverse(clone(ret)):{}};Entity.prototype._setTraits=function(traits){traits||(traits={});if(this._options.persist){store.set(this._options.localStorage.key,traits)}else{this._traits=traits}};Entity.prototype.identify=function(id,traits){traits||(traits={});var current=this.id();if(current===null||current===id)traits=extend(this.traits(),traits);if(id)this.id(id);this.debug("identify %o, %o",id,traits);this.traits(traits);this.save()};Entity.prototype.save=function(){if(!this._options.persist)return false;cookie.set(this._options.cookie.key,this.id());store.set(this._options.localStorage.key,this.traits());return true};Entity.prototype.logout=function(){this.id(null);this.traits({});cookie.remove(this._options.cookie.key);store.remove(this._options.localStorage.key)};Entity.prototype.reset=function(){this.logout();this.options({})};Entity.prototype.load=function(){this.id(cookie.get(this._options.cookie.key));this.traits(store.get(this._options.localStorage.key))}},{"isodate-traverse":139,defaults:91,"./cookie":184,"./store":191,extend:124,clone:89}],191:[function(require,module,exports){var bind=require("bind");var defaults=require("defaults");var store=require("store.js");function Store(options){this.options(options)}Store.prototype.options=function(options){if(arguments.length===0)return this._options;options=options||{};defaults(options,{enabled:true});this.enabled=options.enabled&&store.enabled;this._options=options};Store.prototype.set=function(key,value){if(!this.enabled)return false;return store.set(key,value)};Store.prototype.get=function(key){if(!this.enabled)return null;return store.get(key)};Store.prototype.remove=function(key){if(!this.enabled)return false;return store.remove(key)};module.exports=bind.all(new Store);module.exports.Store=Store},{bind:183,defaults:91,"store.js":200}],200:[function(require,module,exports){var json=require("json"),store={},win=window,doc=win.document,localStorageName="localStorage",namespace="__storejs__",storage;store.disabled=false;store.set=function(key,value){};store.get=function(key){};store.remove=function(key){};store.clear=function(){};store.transact=function(key,defaultVal,transactionFn){var val=store.get(key);if(transactionFn==null){transactionFn=defaultVal;defaultVal=null}if(typeof val=="undefined"){val=defaultVal||{}}transactionFn(val);store.set(key,val)};store.getAll=function(){};store.serialize=function(value){return json.stringify(value)};store.deserialize=function(value){if(typeof value!="string"){return undefined}try{return json.parse(value)}catch(e){return value||undefined}};function isLocalStorageNameSupported(){try{return localStorageName in win&&win[localStorageName]}catch(err){return false}}if(isLocalStorageNameSupported()){storage=win[localStorageName];store.set=function(key,val){if(val===undefined){return store.remove(key)}storage.setItem(key,store.serialize(val));return val};store.get=function(key){return store.deserialize(storage.getItem(key))};store.remove=function(key){storage.removeItem(key)};store.clear=function(){storage.clear()};store.getAll=function(){var ret={};for(var i=0;i<storage.length;++i){var key=storage.key(i);ret[key]=store.get(key)}return ret}}else if(doc.documentElement.addBehavior){var storageOwner,storageContainer;try{storageContainer=new ActiveXObject("htmlfile");storageContainer.open();storageContainer.write("<s"+"cript>document.w=window</s"+'cript><iframe src="/favicon.ico"></iframe>');storageContainer.close();storageOwner=storageContainer.w.frames[0].document;storage=storageOwner.createElement("div")}catch(e){storage=doc.createElement("div");storageOwner=doc.body}function withIEStorage(storeFunction){return function(){var args=Array.prototype.slice.call(arguments,0);args.unshift(storage);storageOwner.appendChild(storage);storage.addBehavior("#default#userData");storage.load(localStorageName);var result=storeFunction.apply(store,args);storageOwner.removeChild(storage);return result}}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function ieKeyFix(key){return key.replace(forbiddenCharsRegex,"___")}store.set=withIEStorage(function(storage,key,val){key=ieKeyFix(key);if(val===undefined){return store.remove(key)}storage.setAttribute(key,store.serialize(val));storage.save(localStorageName);return val});store.get=withIEStorage(function(storage,key){key=ieKeyFix(key);return store.deserialize(storage.getAttribute(key))});store.remove=withIEStorage(function(storage,key){key=ieKeyFix(key);storage.removeAttribute(key);storage.save(localStorageName)});store.clear=withIEStorage(function(storage){var attributes=storage.XMLDocument.documentElement.attributes;storage.load(localStorageName);for(var i=0,attr;attr=attributes[i];i++){storage.removeAttribute(attr.name)}storage.save(localStorageName)});store.getAll=withIEStorage(function(storage){var attributes=storage.XMLDocument.documentElement.attributes;var ret={};for(var i=0,attr;attr=attributes[i];++i){var key=ieKeyFix(attr.name);ret[attr.name]=store.deserialize(storage.getAttribute(key))}return ret})}try{store.set(namespace,namespace);if(store.get(namespace)!=namespace){store.disabled=true}store.remove(namespace)}catch(e){store.disabled=true}store.enabled=!store.disabled;module.exports=store},{json:193}],199:[function(require,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],187:[function(require,module,exports){module.exports=function isMeta(e){if(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return true;var which=e.which,button=e.button;if(!which&&button!==undefined){return!button&1&&!button&2&&button&4}else if(which===2){return true}return false}},{}],188:[function(require,module,exports){exports.bind=function(el,type,fn,capture){if(el.addEventListener){el.addEventListener(type,fn,capture||false)}else{el.attachEvent("on"+type,fn)}return fn};exports.unbind=function(el,type,fn,capture){if(el.removeEventListener){el.removeEventListener(type,fn,capture||false)}else{el.detachEvent("on"+type,fn)}return fn}},{}],189:[function(require,module,exports){module.exports=function(e){e=e||window.event;return e.preventDefault?e.preventDefault():e.returnValue=false}},{}],190:[function(require,module,exports){var encode=encodeURIComponent;var decode=decodeURIComponent;var trim=require("trim");var type=require("type");exports.parse=function(str){if("string"!=typeof str)return{};str=trim(str);if(""==str)return{};if("?"==str.charAt(0))str=str.slice(1);var obj={};var pairs=str.split("&");for(var i=0;i<pairs.length;i++){var parts=pairs[i].split("=");var key=decode(parts[0]);var m;if(m=/(\w+)\[(\d+)\]/.exec(key)){obj[m[1]]=obj[m[1]]||[];obj[m[1]][m[2]]=decode(parts[1]);continue}obj[parts[0]]=null==parts[1]?"":decode(parts[1])}return obj};exports.stringify=function(obj){if(!obj)return"";var pairs=[];for(var key in obj){var value=obj[key];if("array"==type(value)){for(var i=0;i<value.length;++i){pairs.push(encode(key+"["+i+"]")+"="+encode(value[i]))}continue}pairs.push(encode(key)+"="+encode(obj[key]))}return pairs.join("&")}},{trim:164,type:7}],192:[function(require,module,exports){var debug=require("debug")("analytics:user");var Entity=require("./entity");var inherit=require("inherit");var bind=require("bind");var cookie=require("./cookie");User.defaults={persist:true,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}};function User(options){this.defaults=User.defaults;this.debug=debug;Entity.call(this,options)}inherit(User,Entity);User.prototype.load=function(){if(this._loadOldCookie())return;Entity.prototype.load.call(this)};User.prototype._loadOldCookie=function(){var user=cookie.get(this._options.cookie.oldKey);if(!user)return false;this.id(user.id);this.traits(user.traits);cookie.remove(this._options.cookie.oldKey);return true};module.exports=bind.all(new User);module.exports.User=User},{debug:185,"./entity":198,inherit:199,bind:183,"./cookie":184}],5:[function(require,module,exports){module.exports="2.3.13"},{}]},{},{1:"analytics"});
app/javascript/flavours/glitch/features/ui/components/image_loader.js
vahnj/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; export default class ImageLoader extends React.PureComponent { static propTypes = { alt: PropTypes.string, src: PropTypes.string.isRequired, previewSrc: PropTypes.string.isRequired, width: PropTypes.number, height: PropTypes.number, } static defaultProps = { alt: '', width: null, height: null, }; state = { loading: true, error: false, } removers = []; get canvasContext() { if (!this.canvas) { return null; } this._canvasContext = this._canvasContext || this.canvas.getContext('2d'); return this._canvasContext; } componentDidMount () { this.loadImage(this.props); } componentWillReceiveProps (nextProps) { if (this.props.src !== nextProps.src) { this.loadImage(nextProps); } } loadImage (props) { this.removeEventListeners(); this.setState({ loading: true, error: false }); Promise.all([ this.loadPreviewCanvas(props), this.hasSize() && this.loadOriginalImage(props), ].filter(Boolean)) .then(() => { this.setState({ loading: false, error: false }); this.clearPreviewCanvas(); }) .catch(() => this.setState({ loading: false, error: true })); } loadPreviewCanvas = ({ previewSrc, width, height }) => new Promise((resolve, reject) => { const image = new Image(); const removeEventListeners = () => { image.removeEventListener('error', handleError); image.removeEventListener('load', handleLoad); }; const handleError = () => { removeEventListeners(); reject(); }; const handleLoad = () => { removeEventListeners(); this.canvasContext.drawImage(image, 0, 0, width, height); resolve(); }; image.addEventListener('error', handleError); image.addEventListener('load', handleLoad); image.src = previewSrc; this.removers.push(removeEventListeners); }) clearPreviewCanvas () { const { width, height } = this.canvas; this.canvasContext.clearRect(0, 0, width, height); } loadOriginalImage = ({ src }) => new Promise((resolve, reject) => { const image = new Image(); const removeEventListeners = () => { image.removeEventListener('error', handleError); image.removeEventListener('load', handleLoad); }; const handleError = () => { removeEventListeners(); reject(); }; const handleLoad = () => { removeEventListeners(); resolve(); }; image.addEventListener('error', handleError); image.addEventListener('load', handleLoad); image.src = src; this.removers.push(removeEventListeners); }); removeEventListeners () { this.removers.forEach(listeners => listeners()); this.removers = []; } hasSize () { const { width, height } = this.props; return typeof width === 'number' && typeof height === 'number'; } setCanvasRef = c => { this.canvas = c; } render () { const { alt, src, width, height } = this.props; const { loading } = this.state; const className = classNames('image-loader', { 'image-loader--loading': loading, 'image-loader--amorphous': !this.hasSize(), }); return ( <div className={className}> <canvas className='image-loader__preview-canvas' width={width} height={height} ref={this.setCanvasRef} style={{ opacity: loading ? 1 : 0 }} /> {!loading && ( <img alt={alt} className='image-loader__img' src={src} width={width} height={height} /> )} </div> ); } }
react/components-communicate-through-reflux/src/components/LoadingTracker/LoadingTracker.js
kunukn/sandbox-web
import React from 'react'; import {LOADING_STATES, LOADING_TYPES, LOADING_CONFIG} from '../../utils'; class LoadingTracker extends React.Component { constructor(props) { super(props); this.state = { loadingType: LOADING_TYPES.SHORT, }; } componentDidMount() { setTimeout(() => { this.setState({loadingType: LOADING_TYPES.LONG}) }, LOADING_CONFIG.LONG_LOADING_START_TIME) } render() { const {name, loadingState, ignoreLoadingTracker} = this.props; if (ignoreLoadingTracker) { return React.Children.only(this.props.children); } const isLongLoading = this.state.loadingType === LOADING_TYPES.LONG; const isLoadingState = loadingState === LOADING_STATES.LOADING; const isErrorState = loadingState === LOADING_STATES.LOADINGERROR; if (loadingState) { return ( <div className="loading-tracker"> {isLoadingState && <div className="loading-tracker__overlay"> <div className="loading-tracker__box"> <div className="load-bar"> <div className="load-bar__item"></div> <div className="load-bar__item"></div> </div> <span className="loading-tracker__name">{name} </span> <span className="loading-tracker__message">please wait... {isLongLoading && ' long loading'}</span> </div> </div>} {isErrorState && <div className="loading-tracker__overlay loading-tracker__overlay--is-error"> <div className="loading-tracker__box"> <span className="loading-tracker__name">{name} </span> <span className="loading-tracker__message">Error, please try again later.</span> </div> </div>} {this.props.children} </div> ); } return React.Children.only(this.props.children); } } export default LoadingTracker;
src/routes/search/Search.js
LevelPlayingField/levelplayingfield
/* @flow */ import React from 'react'; import PropTypes from 'prop-types'; import Helmet from 'react-helmet'; import FontAwesomeIcon from '@fortawesome/react-fontawesome'; import { faSearch, faSpinner, faChevronUp, faChevronDown } from '@fortawesome/fontawesome-free-solid'; import cx from 'classnames'; import qs from 'query-string'; import Layout from '../../components/Layout'; import Link from '../../components/Link'; import { Col, Container, Row } from '../../components/Grid'; import s from './Search.scss'; import SearchResult from './SearchResult'; import type { Result } from './Types'; const typeRegex = /\bis:(case|party)\b\s?/; type Props = { query: string, results: Array<Result>, loading: bool, sortBy: string, sortDir: 'ASC' | 'DESC', urlArgs: { [key: string]: string }, page: number, perPage: number, pages: number, updateQuery: (query: string) => void, } type SortableProps = { sortKey: string, urlArgs: { [key: string]: string }, children?: any, }; const Sortable = ({ sortKey, urlArgs: { sortBy = '', sortDir = '', ...urlArgs }, children, ...props }: SortableProps) => { const url = `/search?${qs.stringify({ ...urlArgs, sortBy: sortKey, sortDir: sortBy === sortKey && sortDir === 'DESC' ? 'ASC' : 'DESC', })}`; return ( <Link to={url} {...props} className={s.Sortable}> {children} {sortBy === sortKey ? (<FontAwesomeIcon icon={sortDir === 'DESC' ? faChevronDown : faChevronUp} size='1x'/>) : null} </Link> ); }; class Search extends React.Component { props: Props; state: { USE_CASEPARTY_SELECT: bool }; input: HTMLInputElement; static contextTypes = { history: PropTypes.any.isRequired, }; constructor(props: Props) { super(props); this.state = { USE_CASEPARTY_SELECT: false, }; } componentDidMount() { if (!this.props.query) { this.input.focus(); } } setUrl(type: string) { const { history } = this.context; const query = qs.stringify({ q: `is:${type} ${this.input.value}`, sortBy: this.props.sortBy, sortDir: this.props.sortDir, }); history.push(`/search?${query}`, { search_query: this.input.value, }); } renderThead(type: string) { const { urlArgs } = this.props; if (type === 'case') { return ( <thead> <tr> <th className={s.cell1} style={{ width: '10%' }}> <Sortable sortKey="case_number" urlArgs={urlArgs}>Case</Sortable> </th> <th className={s.cell2}>Plaintiff</th> <th className={s.cell3}>Defendant</th> <th className={s.cell4}/> <th className={s.cell5} style={{ width: '9%' }}> <Sortable sortKey="type_of_disposition" urlArgs={urlArgs}>Disposition</Sortable> </th> <th className={s.cell6} style={{ width: '7%' }}> <Sortable sortKey="filing_date" urlArgs={urlArgs}>Filed</Sortable> </th> </tr> <tr> <th className={s.cell1}> <Sortable sortKey="dispute_type" urlArgs={urlArgs}>Dispute Type</Sortable> </th> <th className={s.cell2}>Plaintiff Counsel</th> <th className={s.cell3}>Defendant Counsel</th> <th className={s.cell4}>Arbitrator</th> <th className={s.cell5}> <Sortable sortKey="prevailing_party" urlArgs={urlArgs}>Awardee</Sortable> </th> <th className={s.cell6}> <Sortable sortKey="close_date" urlArgs={urlArgs}>Closed</Sortable> </th> </tr> </thead> ); } return ( <thead> <tr> <th className={s.cell1} style={{ width: '15%' }}>Type</th> <th className={s.cell2} style={{ width: '35%' }}> <Sortable sortKey="name" urlArgs={urlArgs}>Name</Sortable> </th> <th className={s.cell3} style={{ width: '40%' }}>Firm/Attorneys</th> <th className={s.cell4} style={{ width: '10%' }}> <Sortable sortKey="case_count" urlArgs={urlArgs}>Case Count</Sortable> </th> </tr> </thead> ); } render() { const { query, page, perPage, sortBy, sortDir, pages, results, loading } = this.props; const reMatch = query.match(typeRegex); const type = reMatch == null ? 'case' : reMatch[1]; const parsedQuery = query.replace(typeRegex, ''); const setSearch = (searchType: string) => { this.props.updateQuery(`is:${searchType} ${parsedQuery}`); this.setUrl(searchType); }; return ( <Layout> <Helmet title="Search - Level Playing Field" style={[{ type: 'text/css', cssText: s._getCss() }]} /> <Container> <Row centerMd centerLg> <Col sm={12} md={8} lg={6} className={s.centerText}> {this.state.USE_CASEPARTY_SELECT ? ( <select value={type} className={s.selectField} onChange={e => { this.props.updateQuery( `is:${e.target.value} ${parsedQuery}`); this.setUrl(e.target.value); }} > <option value="case">Cases</option> <option value="party">Parties</option> </select> ) : ( <span> <button className={cx(s.toggleButton, type === 'case' && s.toggleButtonActive)} onClick={() => setSearch('case')} > Case </button> <button className={cx(s.toggleButton, type === 'party' && s.toggleButtonActive)} onClick={() => setSearch('party')} > Party </button> </span> )} <input className={s.searchField} onChange={e => this.props.updateQuery( `is:${type} ${e.target.value}`)} onBlur={() => this.setUrl(type)} onKeyDown={(e: KeyboardEvent) => e.keyCode === 13 && this.setUrl(type)} value={parsedQuery} ref={input => { this.input = input; }} /> <FontAwesomeIcon icon={faSearch} size='lg'/> </Col> </Row> <Row> <Col> <table className={s.table}> {this.renderThead(type)} {loading && ( <tbody className={s.tbodyLoading}> <tr> <td colSpan="6"> Loading... </td> </tr> <tr> <td colSpan="6"> <FontAwesomeIcon icon={faSpinner} size='3x' pulse/> </td> </tr> </tbody> )} {results && results.map((result: Result) => <SearchResult result={result} key={`result_${result.type}_${result.id}`} />, )} </table> </Col> </Row> <Row> <Col> <ul className={s.pagination}> {/* Page 1, if gt page 1 */} <li> {page > 1 ? ( <Link to={`/search?${qs.stringify({ q: query, page: page - 1, sortBy, sortDir, })}`} > Last {perPage} </Link> ) : ( <span>Last {perPage}</span> )} </li> <li><span>Page {page} of {pages}</span></li> <li> {page < pages ? ( <Link to={`/search?${qs.stringify({ q: query, page: page + 1, sortBy, sortDir, })}`} > Next {perPage} </Link> ) : ( <span>Next {perPage}</span> )} </li> </ul> </Col> </Row> </Container> </Layout> ); } } export default Search;
bootstrap/template/Web/src/main/webapp/assets/vendors/flot/jquery.js
yamingd/argo
/*! * jQuery JavaScript Library v1.8.3 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) */ (function( window, undefined ) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, navigator = window.navigator, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Save a reference to some core methods core_push = Array.prototype.push, core_slice = Array.prototype.slice, core_indexOf = Array.prototype.indexOf, core_toString = Object.prototype.toString, core_hasOwn = Object.prototype.hasOwnProperty, core_trim = String.prototype.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Used for matching numbers core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // The ready event handler and self cleanup method DOMContentLoaded = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); } else if ( document.readyState === "complete" ) { // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = ( context && context.nodeType ? context.ownerDocument || context : document ); // scripts is true for back-compat selector = jQuery.parseHTML( match[1], doc, true ); if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { this.attr.call( selector, context, true ); } return jQuery.merge( this, selector ); // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.8.3", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return core_slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( core_slice.apply( this, arguments ), "slice", core_slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ core_toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // scripts (optional): If true, will include scripts passed in the html string parseHTML: function( data, context, scripts ) { var parsed; if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { scripts = context; context = 0; } context = context || document; // Single tag if ( (parsed = rsingleTag.exec( data )) ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); return jQuery.merge( [], (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); }, parseJSON: function( data ) { if ( !data || typeof data !== "string") { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && core_rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var name, i = 0, length = obj.length, isObj = length === undefined || jQuery.isFunction( obj ); if ( args ) { if ( isObj ) { for ( name in obj ) { if ( callback.apply( obj[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( obj[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in obj ) { if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var type, ret = results || []; if ( arr != null ) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 type = jQuery.type( arr ); if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { core_push.call( ret, arr ); } else { jQuery.merge( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexOf ) { return core_indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyGet, pass ) { var exec, bulk = key == null, i = 0, length = elems.length; // Sets many values if ( key && typeof key === "object" ) { for ( i in key ) { jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); } chainable = 1; // Sets one value } else if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = pass === undefined && jQuery.isFunction( value ); if ( bulk ) { // Bulk operations only iterate when executing function values if ( exec ) { exec = fn; fn = function( elem, key, value ) { return exec.call( jQuery( elem ), value ); }; // Otherwise they run against the entire set } else { fn.call( elems, value ); fn = null; } } if ( fn ) { for (; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } } chainable = 1; } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }, now: function() { return ( new Date() ).getTime(); } }); jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.split( core_rspace ), function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Control if a given callback is in the list has: function( fn ) { return jQuery.inArray( fn, list ) > -1; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? function() { var returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } } : newDefer[ action ] ); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] = list.fire deferred[ tuple[0] ] = list.fire; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = core_slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, select, opt, input, fragment, eventName, i, isSupported, clickFn, div = document.createElement("div"); // Setup div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // Support tests won't run in some limited or non-browser environments all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; if ( !all || !a || !all.length ) { return {}; } // First batch of tests select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form (#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: ( document.compatMode === "CSS1Compat" ), // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", clickFn = function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent("onclick"); div.detachEvent( "onclick", clickFn ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; input.setAttribute( "checked", "checked" ); // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute( "name", "t" ); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild( input ); fragment.appendChild( div ); // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } // Run tests that need a body at doc ready jQuery(function() { var container, div, tds, marginDiv, divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; body.insertBefore( container, body.firstChild ); // Construct the test element div = document.createElement("div"); container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; tds = div.getElementsByTagName("td"); tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Check box-sizing and margin behavior div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = ( div.offsetWidth === 4 ); support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = document.createElement("div"); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; div.appendChild( marginDiv ); support.reliableMarginRight = !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); } if ( typeof div.style.zoom !== "undefined" ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerHTML = "<div></div>"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); container.style.zoom = 1; } // Null elements to avoid leaks in IE body.removeChild( container ); container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE fragment.removeChild( div ); all = a = select = opt = input = fragment = div = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, deletedIds: [], // Remove at next major release (1.9/2.0) uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if ( jQuery.support.deleteExpando || cache != cache.window ) { delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { attr = elem.attributes; for ( l = attr.length; i < l; i++ ) { name = attr[i].name; if ( !name.indexOf( "data-" ) ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split( ".", 2 ); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jQuery.access( this, function( value ) { if ( value === undefined ) { data = this.triggerHandler( "getData" + part, [ parts[0] ] ); // Try to fetch any internally stored data first if ( data === undefined && elem ) { data = jQuery.data( elem, key ); data = dataAttr( elem, key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } parts[1] = value; this.each(function() { var self = jQuery( this ); self.triggerHandler( "setData" + part, parts ); jQuery.data( this, key, value ); self.triggerHandler( "changeData" + part, parts ); }); }, null, value, arguments.length > 1, null, false ); }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery.removeData( elem, type + "queue", true ); jQuery.removeData( elem, key, true ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodeHook, boolHook, fixSpecified, rclass = /[\t\r\n]/g, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea|)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var removes, className, elem, c, cl, i, l; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { removes = ( value || "" ).split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { className = (" " + elem.className + " ").replace( rclass, " " ); // loop over each item in the removal list for ( c = 0, cl = removes.length; c < cl; c++ ) { // Remove until there is nothing to remove, while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { className = className.replace( " " + removes[ c ] + " " , " " ); } } elem.className = value ? jQuery.trim( className ) : ""; } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( core_rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val, self = jQuery(this); if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 attrFn: {}, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, isBool, i = 0; if ( value && elem.nodeType === 1 ) { attrNames = value.split( core_rspace ); for ( ; i < attrNames.length; i++ ) { name = attrNames[ i ]; if ( name ) { propName = jQuery.propFix[ name ] || name; isBool = rboolean.test( name ); // See #9699 for explanation of this approach (setting first, then removal) // Do not do this for boolean attributes (see #10870) if ( !isBool ) { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes if ( isBool && propName in elem ) { elem[ propName ] = false; } } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { fixSpecified = { name: true, id: true, coords: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return ( ret.value = value + "" ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, hoverHack = function( events ) { return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim( hoverHack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim( hoverHack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; // Remove matching events for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, "events", true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, type = event.type || event, namespaces = []; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; for ( old = elem; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old === (elem.ownerDocument || document) ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), delegateCount = handlers.delegateCount, args = core_slice.call( arguments ), run_all = !event.exclusive && !event.namespace, special = jQuery.event.special[ event.type ] || {}, handlerQueue = []; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers that should run if there are delegated events // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && !(event.button && event.type === "click") ) { for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { selMatch = {}; matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { selMatch[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( selMatch[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } } // Add the remaining (directly-bound) handlers if ( handlers.length > delegateCount ) { handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); } // Run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; event.currentTarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = matched.matches[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { event.data = handleObj.data; event.handleObj = handleObj; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) event.metaKey = !!event.metaKey; return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "_submit_attached" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "_submit_attached", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "_change_attached", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // && selector != null // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function( window, undefined ) { var cachedruns, assertGetIdNotName, Expr, getText, isXML, contains, compile, sortOrder, hasDuplicate, outermostContext, baseHasDuplicate = true, strundefined = "undefined", expando = ( "sizcache" + Math.random() ).replace( ".", "" ), Token = String, document = window.document, docElem = document.documentElement, dirruns = 0, done = 0, pop = [].pop, push = [].push, slice = [].slice, // Use a stripped-down indexOf if a native one is unavailable indexOf = [].indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Augment a function for special use by Sizzle markFunction = function( fn, value ) { fn[ expando ] = value == null || value; return fn; }, createCache = function() { var cache = {}, keys = []; return markFunction(function( key, value ) { // Only keep the most recent entries if ( keys.push( key ) > Expr.cacheLength ) { delete cache[ keys.shift() ]; } // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) return (cache[ key + " " ] = value); }, cache ); }, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // Regex // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments not in parens/brackets, // then attribute selectors and non-pseudos (denoted by :), // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", // For matchExpr.POS and matchExpr.needsContext pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, rnot = /^:not/, rsibling = /[\x20\t\r\n\f]*[+~]/, rendsWithNot = /:not\($/, rheader = /h\d/i, rinputs = /input|select|textarea|button/i, rbackslash = /\\(?!\\)/g, matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "POS": new RegExp( pos, "i" ), "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) }, // Support // Used for testing something on an element assert = function( fn ) { var div = document.createElement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } }, // Check if getElementsByTagName("*") returns only elements assertTagNameNoComments = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }), // Check if getAttribute returns normalized href attributes assertHrefNotNormalized = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }), // Check if attributes should be retrieved by attribute nodes assertAttributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }), // Check if getElementsByClassName can be trusted assertUsableClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }), // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID assertUsableName = assert(function( div ) { // Inject content div.id = expando + 0; div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; docElem.insertBefore( div, docElem.firstChild ); // Test var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2 document.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 document.getElementsByName( expando + 0 ).length; assertGetIdNotName = !document.getElementById( expando ); // Cleanup docElem.removeChild( div ); return pass; }); // If slice is not available, provide a backup try { slice.call( docElem.childNodes, 0 )[0].nodeType; } catch ( e ) { slice = function( i ) { var elem, results = []; for ( ; (elem = this[i]); i++ ) { results.push( elem ); } return results; }; } function Sizzle( selector, context, results, seed ) { results = results || []; context = context || document; var match, elem, xml, m, nodeType = context.nodeType; if ( !selector || typeof selector !== "string" ) { return results; } if ( nodeType !== 1 && nodeType !== 9 ) { return []; } xml = isXML( context ); if ( !xml && !seed ) { if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); return results; } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); } Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { return Sizzle( expr, null, null, [ elem ] ).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( nodeType ) { if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes } else { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } return ret; }; isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); } : docElem.compareDocumentPosition ? function( a, b ) { return b && !!( a.compareDocumentPosition( b ) & 16 ); } : function( a, b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } return false; }; Sizzle.attr = function( elem, name ) { var val, xml = isXML( elem ); if ( !xml ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( xml || assertAttributes ) { return elem.getAttribute( name ); } val = elem.getAttributeNode( name ); return val ? typeof elem[ name ] === "boolean" ? elem[ name ] ? name : null : val.specified ? val.value : null : null; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, // IE6/7 return a modified href attrHandle: assertHrefNotNormalized ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }, find: { "ID": assertGetIdNotName ? function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } } : function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }, "TAG": assertTagNameNoComments ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { var elem, tmp = [], i = 0; for ( ; (elem = results[i]); i++ ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }, "NAME": assertUsableName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }, "CLASS": assertUsableClassName && function( className, context, xml ) { if ( typeof context.getElementsByClassName !== strundefined && !xml ) { return context.getElementsByClassName( className ); } } }, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( rbackslash, "" ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3 xn-component of xn+y argument ([+-]?\d*n|) 4 sign of xn-component 5 x of xn-component 6 sign of y-component 7 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1] === "nth" ) { // nth-child requires argument if ( !match[2] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); // other types prohibit arguments } else if ( match[2] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var unquoted, excess; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } if ( match[3] ) { match[2] = match[3]; } else if ( (unquoted = match[4]) ) { // Only check arguments that contain a pseudo if ( rpseudo.test(unquoted) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index unquoted = unquoted.slice( 0, excess ); match[0] = match[0].slice( 0, excess ); } match[2] = unquoted; } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "ID": assertGetIdNotName ? function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { return elem.getAttribute("id") === id; }; } : function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === id; }; }, "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ expando ][ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem, context ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.substr( result.length - check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, argument, first, last ) { if ( type === "nth" ) { return function( elem ) { var node, diff, parent = elem.parentNode; if ( first === 1 && last === 0 ) { return true; } if ( parent ) { diff = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { diff++; if ( elem === node ) { break; } } } } // Incorporate the offset (or cast to NaN), then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); }; } return function( elem ) { var node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; /* falls through */ case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") var nodeType; elem = elem.firstChild; while ( elem ) { if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { return false; } elem = elem.nextSibling; } return true; }, "header": function( elem ) { return rheader.test( elem.nodeName ); }, "text": function( elem ) { var type, attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); }, // Input types "radio": createInputPseudo("radio"), "checkbox": createInputPseudo("checkbox"), "file": createInputPseudo("file"), "password": createInputPseudo("password"), "image": createInputPseudo("image"), "submit": createButtonPseudo("submit"), "reset": createButtonPseudo("reset"), "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "focus": function( elem ) { var doc = elem.ownerDocument; return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, "active": function( elem ) { return elem === elem.ownerDocument.activeElement; }, // Positional types "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 0; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 1; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; function siblingCheck( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; } sortOrder = docElem.compareDocumentPosition ? function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4 ) ? -1 : 1; } : function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], i = 1, j = 0; hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ expando ][ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); // Cast descendant combinators to space matched.type = match[0].replace( rtrim, " " ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); matched.type = type; matched.matches = match; } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( !xml ) { var cache, dirkey = dirruns + " " + doneName + " ", cachedkey = dirkey + cachedruns; while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( (cache = elem[ expando ]) === cachedkey ) { return elem.sizset; } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { if ( elem.sizset ) { return elem; } } else { elem[ expando ] = cachedkey; if ( matcher( elem, context, xml ) ) { elem.sizset = true; return elem; } elem.sizset = false; } } } } else { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( matcher( elem, context, xml ) ) { return elem; } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && tokens.join("") ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = superMatcher.el; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++superMatcher.el; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); j++ ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; superMatcher.el = 0; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ expando ][ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed, xml ) { var i, tokens, token, type, find, match = tokenize( selector ), j = match.length; if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().length ); } // Fetch a seed set for right-to-left matching for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( rbackslash, "" ), rsibling.test( tokens[0].type ) && context.parentNode || context, xml )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && tokens.join(""); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, xml, results, rsibling.test( selector ) ); return results; } if ( document.querySelectorAll ) { (function() { var disconnectedMatch, oldSelect = select, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ], // matchesSelector(:active) reports false when true (IE9/Opera 11.5) // A support test would require too much code (would include document ready) // just skip matchesSelector for :active rbuggyMatches = [ ":active" ], matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector; // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here (do not put tests after this one) if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE9 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<p test=''></p>"; if ( div.querySelectorAll("[test^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here (do not put tests after this one) div.innerHTML = "<input type='hidden'/>"; if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push(":enabled", ":disabled"); } }); // rbuggyQSA always contains :focus, so no need for a length check rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); select = function( selector, context, results, seed, xml ) { // Only use querySelectorAll when not filtering, // when this is not xml, // and when no QSA bugs apply if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { var groups, i, old = true, nid = expando, newContext = context, newSelector = context.nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + groups[i].join(""); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, slice.call( newContext.querySelectorAll( newSelector ), 0 ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } return oldSelect( selector, context, results, seed, xml ); }; if ( matches ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead try { matches.call( div, "[test!='']:sizzle" ); rbuggyMatches.push( "!=", pseudos ); } catch ( e ) {} }); // rbuggyMatches always contains :active and :focus, so no need for a length check rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); Sizzle.matchesSelector = function( elem, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyMatches always contains :active, so no need for an existence check if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, null, null, [ elem ] ).length > 0; }; } })(); } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Back-compat function setFilters() {} Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, l, length, n, r, ret, self = this; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } ret = this.pushStack( "", "find", selector ); for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentNode; } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, rnocache = /<(?:script|object|embed|option|style)/i, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rcheckableType = /^(?:checkbox|radio)$/, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], area: [ 1, "<map>", "</map>" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if ( !jQuery.support.htmlSerialize ) { wrapMap._default = [ 1, "X<div>", "</div>" ]; } jQuery.fn.extend({ text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); } }, after: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); } }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return jQuery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName( "*" ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function( value ) { if ( !isDisconnected( this[0] ) ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } if ( typeof value !== "string" ) { value = jQuery( value ).detach(); } return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); } else { jQuery(parent).append( value ); } }); } return this.length ? this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : this; }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { // Flatten any nested arrays args = [].concat.apply( [], args ); var results, first, fragment, iNoClone, i = 0, value = args[0], scripts = [], l = this.length; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { return this.each(function() { jQuery(this).domManip( args, table, callback ); }); } if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); args[0] = value.call( this, i, table ? self.html() : undefined ); self.domManip( args, table, callback ); }); } if ( this[0] ) { results = jQuery.buildFragment( args, this, scripts ); fragment = results.fragment; first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). // Fragments from the fragment cache must always be cloned and never used in place. for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { callback.call( table && jQuery.nodeName( this[i], "table" ) ? findOrAppend( this[i], "tbody" ) : this[i], i === iNoClone ? fragment : jQuery.clone( fragment, true, true ) ); } } // Fix #11809: Avoid leaking memory fragment = first = null; if ( scripts.length ) { jQuery.each( scripts, function( i, elem ) { if ( elem.src ) { if ( jQuery.ajax ) { jQuery.ajax({ url: elem.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.error("no ajax"); } } else { jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } }); } } return this; } }); function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function cloneFixAttributes( src, dest ) { var nodeName; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want if ( dest.clearAttributes ) { dest.clearAttributes(); } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events if ( dest.mergeAttributes ) { dest.mergeAttributes( src ); } nodeName = dest.nodeName.toLowerCase(); if ( nodeName === "object" ) { // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; // IE blanks contents when cloning scripts } else if ( nodeName === "script" && dest.text !== src.text ) { dest.text = src.text; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, context, scripts ) { var fragment, cacheable, cachehit, first = args[ 0 ]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && first.charAt(0) === "<" && !rnocache.test( first ) && (jQuery.support.checkClone || !rchecked.test( first )) && (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { // Mark cacheable and look for a hit cacheable = true; fragment = jQuery.fragments[ first ]; cachehit = fragment !== undefined; } if ( !fragment ) { fragment = context.createDocumentFragment(); jQuery.clean( args, context, fragment, scripts ); // Update the cache, but only store false // unless this is a second parsing of the same content if ( cacheable ) { jQuery.fragments[ first ] = cachehit && fragment; } } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), l = insert.length, parent = this.length === 1 && this[0].parentNode; if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { insert[ original ]( this[0] ); return this; } else { for ( ; i < l; i++ ) { elems = ( i > 0 ? this.clone(true) : this ).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, insert.selector ); } }; }); function getAll( elem ) { if ( typeof elem.getElementsByTagName !== "undefined" ) { return elem.getElementsByTagName( "*" ); } else if ( typeof elem.querySelectorAll !== "undefined" ) { return elem.querySelectorAll( "*" ); } else { return []; } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var srcElements, destElements, i, clone; if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. cloneFixAttributes( elem, clone ); // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll( elem ); destElements = getAll( clone ); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { cloneFixAttributes( srcElements[i], destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { cloneCopyEvent( elem, clone ); if ( deepDataAndEvents ) { srcElements = getAll( elem ); destElements = getAll( clone ); for ( i = 0; srcElements[i]; ++i ) { cloneCopyEvent( srcElements[i], destElements[i] ); } } } srcElements = destElements = null; // Return the cloned set return clone; }, clean: function( elems, context, fragment, scripts ) { var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, safe = context === document && safeFragment, ret = []; // Ensure that context is a document if ( !context || typeof context.createDocumentFragment === "undefined" ) { context = document; } // Use the already-created safe fragment if context permits for ( i = 0; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { elem += ""; } if ( !elem ) { continue; } // Convert html string into DOM nodes if ( typeof elem === "string" ) { if ( !rhtml.test( elem ) ) { elem = context.createTextNode( elem ); } else { // Ensure a safe container in which to render the html safe = safe || createSafeFragment( context ); div = context.createElement("div"); safe.appendChild( div ); // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Go to html and back, then peel off extra wrappers tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; depth = wrap[0]; div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( depth-- ) { div = div.lastChild; } // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> hasBody = rtbody.test(elem); tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !hasBody ? div.childNodes : []; for ( j = tbody.length - 1; j >= 0 ; --j ) { if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { tbody[ j ].parentNode.removeChild( tbody[ j ] ); } } } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); } elem = div.childNodes; // Take out of fragment container (we need a fresh div each time) div.parentNode.removeChild( div ); } } if ( elem.nodeType ) { ret.push( elem ); } else { jQuery.merge( ret, elem ); } } // Fix #11356: Clear elements from safeFragment if ( div ) { elem = div = safe = null; } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !jQuery.support.appendChecked ) { for ( i = 0; (elem = ret[i]) != null; i++ ) { if ( jQuery.nodeName( elem, "input" ) ) { fixDefaultChecked( elem ); } else if ( typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); } } } // Append elements to a provided document fragment if ( fragment ) { // Special handling of each script element handleScript = function( elem ) { // Check if we consider it executable if ( !elem.type || rscriptType.test( elem.type ) ) { // Detach the script and store it in the scripts array (if provided) or the fragment // Return truthy to indicate that it has been handled return scripts ? scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : fragment.appendChild( elem ); } }; for ( i = 0; (elem = ret[i]) != null; i++ ) { // Check if we're done after handling an executable script if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { // Append to fragment and handle embedded scripts fragment.appendChild( elem ); if ( typeof elem.getElementsByTagName !== "undefined" ) { // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); // Splice the scripts into ret after their former ancestor and advance our index beyond them ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); i += jsTags.length; } } } } return ret; }, cleanData: function( elems, /* internal */ acceptData ) { var data, id, elem, type, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } jQuery.deletedIds.push( id ); } } } } } }); // Limit scope pollution from any deprecated API (function() { var matched, browser; // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } jQuery.browser = browser; jQuery.sub = function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), elemdisplay = { BODY: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function isHidden( elem, el ) { elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { var elem, display, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { display = curCSS( elem, "display" ); if ( !values[ index ] && display !== "none" ) { jQuery._data( elem, "olddisplay", display ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function( name, value ) { return jQuery.access( this, function( elem, name, value ) { return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state, fn2 ) { var bool = typeof state === "boolean"; if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { return eventsToggle.apply( this, arguments ); } return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, numeric, extra ) { var val, num, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( numeric || extra !== undefined ) { num = parseFloat( val ); return numeric || jQuery.isNumeric( num ) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.call( elem ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { curCSS = function( elem, name ) { var ret, width, minWidth, maxWidth, computed = window.getComputedStyle( elem, null ), style = elem.style; if ( computed ) { // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed.getPropertyValue( name ) || computed[ name ]; if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if ( document.documentElement.currentStyle ) { curCSS = function( elem, name ) { var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { // we use jQuery.css instead of curCSS here // because of the reliableMarginRight CSS hook! val += jQuery.css( elem, extra + cssExpand[ i ], true ); } // From this point on we use curCSS for maximum performance (relevant in animations) if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } else { // at this point, extra isn't content, so add padding val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { if ( elemdisplay[ nodeName ] ) { return elemdisplay[ nodeName ]; } var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend( document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if ( !iframeDoc || !iframe.createElement ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write("<!doctype html><html><body>"); iframeDoc.close(); } elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); display = curCSS( elem, "display" ); document.body.removeChild( iframe ); } // Store the correct default display elemdisplay[ nodeName ] = display; return display; } jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { return jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }); } else { return getWidthOrHeight( elem, name, extra ); } } }, set: function( elem, value, extra ) { return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" ) : 0 ); } }; }); if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute( "filter" ); // if there there is no filter style applied in a css rule, we are done if ( currentStyle && !currentStyle.filter ) { return; } } // otherwise, set new filter values style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function() { if ( !jQuery.support.reliableMarginRight ) { jQuery.cssHooks.marginRight = { get: function( elem, computed ) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap( elem, { "display": "inline-block" }, function() { if ( computed ) { return curCSS( elem, "marginRight" ); } }); } }; } // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = { get: function( elem, computed ) { if ( computed ) { var ret = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; } } }; }); } }); if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [ value ], expanded = {}; for ( i = 0; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rts = /([?&])_=[^&]*/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), i = 0, length = dataTypes.length; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var selection, list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ); for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already if ( typeof selection === "string" ) { if ( !executeOnly || inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } } jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } // Don't do a request if no elements are being requested if ( !this.length ) { return this; } var selector, type, response, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // Request the remote document jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params, complete: function( jqXHR, status ) { if ( callback ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); } } }).done(function( responseText ) { // Save response for use in complete callback response = arguments; // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append( responseText.replace( rscript, "" ) ) // Locate the specified elements .find( selector ) : // If not, just inject the full result responseText ); }); return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ return this.on( o, f ); }; }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; }); jQuery.extend({ getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { if ( settings ) { // Building a settings object ajaxExtend( target, jQuery.ajaxSettings ); } else { // Extending ajaxSettings settings = target; target = jQuery.ajaxSettings; } ajaxExtend( target, settings ); return target; }, ajaxSettings: { url: ajaxLocation, isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, type: "GET", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": allTypes }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { context: true, url: true } }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // ifModified key ifModifiedKey, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars parts, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events // It's the callbackContext if one was provided in the options // and if it's a DOM node or a jQuery collection globalEventContext = callbackContext !== s && ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { var lname = name.toLowerCase(); name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match === undefined ? null : match; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Cancel the request abort: function( statusText ) { statusText = statusText || strAbort; if ( transport ) { transport.abort( statusText ); } done( 0, statusText ); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ ifModifiedKey ] = modified; } modified = jqXHR.getResponseHeader("Etag"); if ( modified ) { jQuery.etag[ ifModifiedKey ] = modified; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } // Attach deferreds deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { for ( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { tmp = map[ jqXHR.status ]; jqXHR.always( tmp ); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter ifModifiedKey = s.url; // Add anti-cache in url if needed if ( s.cache === false ) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { ifModifiedKey = ifModifiedKey || s.url; if ( jQuery.lastModified[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); } if ( jQuery.etag[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); } } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout( function(){ jqXHR.abort( "timeout" ); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } return jqXHR; }, // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ], converters = {}, i = 0; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split(" "); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.splice( i--, 0, current ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s["throws"] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; } var oldCallbacks = [], rquestion = /\?/, rjsonp = /(=)\?(?=&|$)|\?\?/, nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, data = s.data, url = s.url, hasCallback = s.jsonp !== false, replaceInUrl = hasCallback && rjsonp.test( url ), replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( data ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; overwritten = window[ callbackName ]; // Insert callback into url or form data if ( replaceInUrl ) { s.url = url.replace( rjsonp, "$1" + callbackName ); } else if ( replaceInData ) { s.data = data.replace( rjsonp, "$1" + callbackName ); } else if ( hasCallback ) { s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement( "script" ); script.async = "async"; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } // Dereference the script script = undefined; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( 0, 1 ); } } }; } }); var xhrCallbacks, // #5280: Internet Explorer will keep connections alive if we don't abort on unload xhrOnUnloadAbort = window.ActiveXObject ? function() { // Abort all pending requests for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( 0, 1 ); } } : false, xhrId = 0; // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function() { return !this.isLocal && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; // Determine support properties (function( xhr ) { jQuery.extend( jQuery.support, { ajax: !!xhr, cors: !!xhr && ( "withCredentials" in xhr ) }); })( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { jQuery.ajaxTransport(function( s ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !s.crossDomain || jQuery.support.cors ) { var callback; return { send: function( headers, complete ) { // Get a new xhr var handle, i, xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if ( s.username ) { xhr.open( s.type, s.url, s.async, s.username, s.password ); } else { xhr.open( s.type, s.url, s.async ); } // Apply custom fields if provided if ( s.xhrFields ) { for ( i in s.xhrFields ) { xhr[ i ] = s.xhrFields[ i ]; } } // Override mime type if needed if ( s.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( s.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !s.crossDomain && !headers["X-Requested-With"] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } } catch( _ ) {} // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( s.hasContent && s.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responseHeaders, responses, xml; // Firefox throws exceptions when accessing properties // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Only called once callback = undefined; // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; if ( xhrOnUnloadAbort ) { delete xhrCallbacks[ handle ]; } } // If it's an abort if ( isAbort ) { // Abort it manually if needed if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { status = xhr.status; responseHeaders = xhr.getAllResponseHeaders(); responses = {}; xml = xhr.responseXML; // Construct response list if ( xml && xml.documentElement /* #4958 */ ) { responses.xml = xml; } // When requesting binary data, IE6-9 will throw an exception // on any attempt to access responseText (#11426) try { responses.text = xhr.responseText; } catch( e ) { } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && s.isLocal && !s.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } } catch( firefoxAccessException ) { if ( !isAbort ) { complete( -1, firefoxAccessException ); } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, responseHeaders ); } }; if ( !s.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback, 0 ); } else { handle = ++xhrId; if ( xhrOnUnloadAbort ) { // Create the active xhrs callbacks list if needed // and attach the unload handler if ( !xhrCallbacks ) { xhrCallbacks = {}; jQuery( window ).unload( xhrOnUnloadAbort ); } // Add to list of active xhrs callbacks xhrCallbacks[ handle ] = callback; } xhr.onreadystatechange = callback; } }, abort: function() { if ( callback ) { callback(0,1); } } }; } }); } var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [function( prop, value ) { var end, unit, tween = this.createTween( prop, value ), parts = rfxnum.exec( value ), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20; if ( parts ) { end = +parts[2]; unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); // We need to compute starting value if ( unit !== "px" && start ) { // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant start = jQuery.css( tween.elem, prop, true ) || end || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style( tween.elem, prop, start + unit ); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; } return tween; }] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function() { fxNow = undefined; }, 0 ); return ( fxNow = jQuery.now() ); } function createTweens( animation, props ) { jQuery.each( props, function( prop, value ) { var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( collection[ index ].call( animation, prop, value ) ) { // we're done with this property return; } } }); } function Animation( elem, properties, options ) { var result, index = 0, tweenerIndex = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { // don't match elem in the :animated selector delete tick.elem; }), tick = function() { var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end, easing ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // resolve when we played the last frame // otherwise, reject if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } createTweens( animation, props ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { anim: animation, queue: animation.opts.queue, elem: elem }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); function defaultPrefilter( elem, props, opts ) { var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden( elem ); // handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { // doing this makes sure that the complete handler will be called // before this completes anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } // height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated if ( jQuery.css( elem, "display" ) === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { anim.done(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( index in props ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } handled.push( index ); } } length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } // store state if its toggle - enables .stop().toggle() to "reverse" if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery.removeData( elem, "fxshow", true ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( index = 0 ; index < length ; index++ ) { prop = handled[ index ]; tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } } function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } // passing any value as a 4th parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css( tween.elem, tween.prop, false, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" || // special check for .toggle( handler, handler, ... ) ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { // show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations resolve immediately if ( empty ) { anim.stop( true ); } }; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); } }); // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p*Math.PI ) / 2; } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { if ( timer() && jQuery.timers.push( timer ) && !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.interval = 13; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } if ( (body = doc.body) === elem ) { return jQuery.offset.bodyOffset( elem ); } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if ( typeof elem.getBoundingClientRect !== "undefined" ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); clientTop = docElem.clientTop || body.clientTop || 0; clientLeft = docElem.clientLeft || body.clientLeft || 0; scrollTop = win.pageYOffset || docElem.scrollTop; scrollLeft = win.pageXOffset || docElem.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; }; jQuery.offset = { bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, setOffset: function( elem, options, i ) { var position = jQuery.css( elem, "position" ); // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } var curElem = jQuery( elem ), curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ position: function() { if ( !this[0] ) { return; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent || document.body; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return jQuery.access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return jQuery.access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, value, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } })( window );
frontend/node_modules/recharts/demo/component/RadarChart.js
justdotJS/rowboat
import React, { Component } from 'react'; import { Surface, Radar, RadarChart, PolarGrid, Legend, Tooltip, PolarAngleAxis, PolarRadiusAxis, ResponsiveContainer, LabelList, Label } from 'recharts'; import DemoRadarItem from './DemoRadarItem'; import { changeNumberOfData } from './utils'; const data = [ { subject: 'Math', A: 120, B: 110 }, { subject: 'Chinese', A: 98, B: 130 }, { subject: 'English', A: 86, B: 130 }, { subject: 'Geography', A: 99, B: 100 }, { subject: 'Physics', A: 85, B: 90 }, { subject: 'History', A: 65, B: 85 }, ]; const initilaState = { data }; export default class Demo extends Component { static displayName = 'RadarChartDemo'; constructor() { super(); this.state = initilaState; this.handleChangeData = this.handleChangeData.bind(this); } handleChangeData() { this.setState(() => _.mapValues(initilaState, changeNumberOfData)); } handleMouseEnter(props) { console.log(props); } render() { const { data } = this.state; return ( <div> <a href="javascript: void(0);" className="btn update" onClick={this.handleChangeData} > change data </a> <br/> <p>A simple RadarChart</p> <RadarChart cx={300} cy={250} outerRadius={150} width={600} height={500} data={data}> <PolarGrid /> <PolarAngleAxis dataKey="subject" /> <Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6} /> </RadarChart> <p>A RadarChart of two students' score</p> <RadarChart cx={300} cy={250} outerRadius={150} width={600} height={500} data={data} > <PolarGrid /> <Tooltip /> <Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6} onMouseEnter={this.handleMouseEnter} /> <Radar name="Lily" dataKey="B" stroke="#82ca9d" fill="#82ca9d" fillOpacity={0.6} animationBegin={180} /> <Legend /> <PolarRadiusAxis domain={[0, 150]} label="score"/> </RadarChart> <p>RadarChart wrapped by ResponsiveContainer</p> <div style={{ width: '100%', height: '100%' }}> <ResponsiveContainer> <RadarChart data={data}> <PolarGrid /> <PolarAngleAxis dataKey="subject" /> <PolarRadiusAxis /> <Tooltip /> <Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6}> <LabelList /> </Radar> </RadarChart> </ResponsiveContainer> </div> </div> ); } }
app/containers/HomePage/index.js
codermango/BetCalculator
/* * HomePage * * This is the first thing users see of our App, at the '/' route */ import React from 'react'; import { connect } from 'react-redux'; import { RaisedButton, Dialog, FloatingActionButton } from 'material-ui'; import ContentAdd from 'material-ui/svg-icons/content/add'; import ContentRemove from 'material-ui/svg-icons/content/remove'; // import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import { createStructuredSelector } from 'reselect'; import BetTable from 'components/BetTable'; import styles from './styles.css'; import { fetchData, amountChange, horseChange, commissionChange, resultChange, calculateDividends, addRow, removeRow, } from './actions'; import { selectBetData, selectDividends, selectIsInputValid, } from './selectors'; export class HomePage extends React.Component { constructor(props) { super(props); this.state = { showResult: false, }; this.betTableAmountChange = this.betTableAmountChange.bind(this); this.betTableHorseChange = this.betTableHorseChange.bind(this); this.betTableCommissionChange = this.betTableCommissionChange.bind(this); this.betTableResultChange = this.betTableResultChange.bind(this); this.calculateClick = this.calculateClick.bind(this); this.handleClose = this.handleClose.bind(this); this.addButtonClick = this.addButtonClick.bind(this); this.removeButtonClick = this.removeButtonClick.bind(this); } componentDidMount() { if (!this.props.betData.get('data')) { this.props.fetchBetData(); } } betTableAmountChange(data, rowIndex, betType) { this.props.amountChange(data, rowIndex, betType); } betTableHorseChange(data, rowIndex, betType, horseIndex) { this.props.horseChange(data, rowIndex, betType, horseIndex); } betTableCommissionChange(data, betType) { this.props.commissionChange(data, betType); } betTableResultChange(data, index) { this.props.resultChange(data, index); } calculateClick() { this.props.calculateDividends(); this.setState({ showResult: true }); } handleClose() { this.setState({ showResult: false }); } addButtonClick() { this.props.addRow(); } removeButtonClick() { this.props.removeRow(); } render() { const { betData, dividendsData } = this.props; let showMsg = ''; if (!this.props.isInputValid.get('data')) { showMsg = ( <div>There is something wrong with input, please check!</div> ); } else if (betData.get('data')) { showMsg = ( <div> <div>Win - Runner{betData.get('data').resultData[0]} - ${dividendsData.get('w')}</div> <div>Place - Runner{betData.get('data').resultData[0]} - ${dividendsData.get('p') ? dividendsData.get('p')[0] : ''}</div> <div>Place - Runner{betData.get('data').resultData[1]} - ${dividendsData.get('p') ? dividendsData.get('p')[1] : ''}</div> <div>Place - Runner{betData.get('data').resultData[2]} - ${dividendsData.get('p') ? dividendsData.get('p')[2] : ''}</div> <div>Exact - Runner{betData.get('data').resultData[0]},{betData.get('data').resultData[1]} - ${dividendsData.get('e')}</div> <div>Quinella - Runner{betData.get('data').resultData[0]},{betData.get('data').resultData[1]} - ${dividendsData.get('q')}</div> </div> ); } return ( <div className={styles.homePage}> <div className={styles.betTable}> {betData.get('data') ? <BetTable amountChange={this.betTableAmountChange} horseChange={this.betTableHorseChange} commissionChange={this.betTableCommissionChange} resultChange={this.betTableResultChange} data={betData.get('data')} /> : '' } </div> <div className={styles.button}> <div className={styles.buttonSection}> <FloatingActionButton onClick={this.addButtonClick}> <ContentAdd /> </FloatingActionButton> <FloatingActionButton onClick={this.removeButtonClick}> <ContentRemove /> </FloatingActionButton> </div> <div> <RaisedButton label="Calculate" onClick={this.calculateClick} /> </div> </div> {betData.get('data') ? <Dialog title="Dividends" modal={false} open={this.state.showResult} onRequestClose={this.handleClose} > {showMsg} </Dialog> : '' } </div> ); } } HomePage.propTypes = { betData: React.PropTypes.object, dividendsData: React.PropTypes.object, isInputValid: React.PropTypes.object, fetchBetData: React.PropTypes.func, amountChange: React.PropTypes.func, horseChange: React.PropTypes.func, commissionChange: React.PropTypes.func, resultChange: React.PropTypes.func, calculateDividends: React.PropTypes.func, addRow: React.PropTypes.func, removeRow: React.PropTypes.func, }; function mapDispatchToProps(dispatch) { return { fetchBetData: () => dispatch(fetchData()), amountChange: (data, rowIndex, betType) => dispatch(amountChange(data, rowIndex, betType)), horseChange: (data, rowIndex, betType, horseIndex) => dispatch(horseChange(data, rowIndex, betType, horseIndex)), commissionChange: (data, betType) => dispatch(commissionChange(data, betType)), resultChange: (data, index) => dispatch(resultChange(data, index)), calculateDividends: () => dispatch(calculateDividends()), addRow: () => dispatch(addRow()), removeRow: () => dispatch(removeRow()), dispatch, }; } const mapStateToProps = createStructuredSelector({ betData: selectBetData(), dividendsData: selectDividends(), isInputValid: selectIsInputValid(), }); // Wrap the component to inject dispatch and state into it export default connect(mapStateToProps, mapDispatchToProps)(HomePage);
ajax/libs/primereact/7.0.0-rc.1/overlaypanel/overlaypanel.esm.js
cdnjs/cdnjs
import React, { Component } from 'react'; import { UniqueComponentId, ConnectedOverlayScrollHandler, DomHandler, OverlayService, ZIndexUtils, Ripple, classNames, CSSTransition, Portal } from 'primereact/core'; 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 _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 OverlayPanel = /*#__PURE__*/function (_Component) { _inherits(OverlayPanel, _Component); var _super = _createSuper(OverlayPanel); function OverlayPanel(props) { var _this; _classCallCheck(this, OverlayPanel); _this = _super.call(this, props); _this.state = { visible: false }; _this.onCloseClick = _this.onCloseClick.bind(_assertThisInitialized(_this)); _this.onPanelClick = _this.onPanelClick.bind(_assertThisInitialized(_this)); _this.onEnter = _this.onEnter.bind(_assertThisInitialized(_this)); _this.onEntered = _this.onEntered.bind(_assertThisInitialized(_this)); _this.onExit = _this.onExit.bind(_assertThisInitialized(_this)); _this.onExited = _this.onExited.bind(_assertThisInitialized(_this)); _this.attributeSelector = UniqueComponentId(); _this.overlayRef = /*#__PURE__*/React.createRef(); return _this; } _createClass(OverlayPanel, [{ key: "bindDocumentClickListener", value: function bindDocumentClickListener() { var _this2 = this; if (!this.documentClickListener && this.props.dismissable) { this.documentClickListener = function (event) { if (!_this2.isPanelClicked && _this2.isOutsideClicked(event.target)) { _this2.hide(); } _this2.isPanelClicked = false; }; document.addEventListener('click', this.documentClickListener); } } }, { key: "unbindDocumentClickListener", value: function unbindDocumentClickListener() { if (this.documentClickListener) { document.removeEventListener('click', this.documentClickListener); this.documentClickListener = null; } } }, { key: "bindScrollListener", value: function bindScrollListener() { var _this3 = this; if (!this.scrollHandler) { this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, function () { if (_this3.state.visible) { _this3.hide(); } }); } this.scrollHandler.bindScrollListener(); } }, { key: "unbindScrollListener", value: function unbindScrollListener() { if (this.scrollHandler) { this.scrollHandler.unbindScrollListener(); } } }, { key: "bindResizeListener", value: function bindResizeListener() { var _this4 = this; if (!this.resizeListener) { this.resizeListener = function () { if (_this4.state.visible && !DomHandler.isAndroid()) { _this4.hide(); } }; window.addEventListener('resize', this.resizeListener); } } }, { key: "unbindResizeListener", value: function unbindResizeListener() { if (this.resizeListener) { window.removeEventListener('resize', this.resizeListener); this.resizeListener = null; } } }, { key: "isOutsideClicked", value: function isOutsideClicked(target) { return this.overlayRef && this.overlayRef.current && !(this.overlayRef.current.isSameNode(target) || this.overlayRef.current.contains(target)); } }, { key: "hasTargetChanged", value: function hasTargetChanged(event, target) { return this.target != null && this.target !== (target || event.currentTarget || event.target); } }, { key: "onCloseClick", value: function onCloseClick(event) { this.hide(); event.preventDefault(); } }, { key: "onPanelClick", value: function onPanelClick(event) { this.isPanelClicked = true; OverlayService.emit('overlay-click', { originalEvent: event, target: this.target }); } }, { key: "onContentClick", value: function onContentClick() { this.isPanelClicked = true; } }, { key: "toggle", value: function toggle(event, target) { var _this5 = this; if (this.state.visible) { this.hide(); if (this.hasTargetChanged(event, target)) { this.target = target || event.currentTarget || event.target; setTimeout(function () { _this5.show(event, _this5.target); }, 200); } } else { this.show(event, target); } } }, { key: "show", value: function show(event, target) { var _this6 = this; this.target = target || event.currentTarget || event.target; if (this.state.visible) { this.align(); } else { this.setState({ visible: true }, function () { _this6.overlayEventListener = function (e) { if (!_this6.isOutsideClicked(e.target)) { _this6.isPanelClicked = true; } }; OverlayService.on('overlay-click', _this6.overlayEventListener); }); } } }, { key: "hide", value: function hide() { var _this7 = this; this.setState({ visible: false }, function () { OverlayService.off('overlay-click', _this7.overlayEventListener); _this7.overlayEventListener = null; }); } }, { key: "onEnter", value: function onEnter() { ZIndexUtils.set('overlay', this.overlayRef.current); this.overlayRef.current.setAttribute(this.attributeSelector, ''); this.align(); } }, { key: "onEntered", value: function onEntered() { this.bindDocumentClickListener(); this.bindScrollListener(); this.bindResizeListener(); this.props.onShow && this.props.onShow(); } }, { key: "onExit", value: function onExit() { this.unbindDocumentClickListener(); this.unbindScrollListener(); this.unbindResizeListener(); } }, { key: "onExited", value: function onExited() { ZIndexUtils.clear(this.overlayRef.current); this.props.onHide && this.props.onHide(); } }, { key: "align", value: function align() { if (this.target) { DomHandler.absolutePosition(this.overlayRef.current, this.target); var containerOffset = DomHandler.getOffset(this.overlayRef.current); var targetOffset = DomHandler.getOffset(this.target); var arrowLeft = 0; if (containerOffset.left < targetOffset.left) { arrowLeft = targetOffset.left - containerOffset.left; } this.overlayRef.current.style.setProperty('--overlayArrowLeft', "".concat(arrowLeft, "px")); if (containerOffset.top < targetOffset.top) { DomHandler.addClass(this.overlayRef.current, 'p-overlaypanel-flipped'); } } } }, { key: "createStyle", value: function createStyle() { if (!this.styleElement) { this.styleElement = document.createElement('style'); document.head.appendChild(this.styleElement); var innerHTML = ''; for (var breakpoint in this.props.breakpoints) { innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-overlaypanel[").concat(this.attributeSelector, "] {\n width: ").concat(this.props.breakpoints[breakpoint], " !important;\n }\n }\n "); } this.styleElement.innerHTML = innerHTML; } } }, { key: "componentDidMount", value: function componentDidMount() { if (this.props.breakpoints) { this.createStyle(); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.unbindDocumentClickListener(); this.unbindResizeListener(); if (this.scrollHandler) { this.scrollHandler.destroy(); this.scrollHandler = null; } if (this.styleElement) { document.head.removeChild(this.styleElement); this.styleElement = null; } if (this.overlayEventListener) { OverlayService.off('overlay-click', this.overlayEventListener); this.overlayEventListener = null; } ZIndexUtils.clear(this.overlayRef.current); } }, { key: "renderCloseIcon", value: function renderCloseIcon() { if (this.props.showCloseIcon) { return /*#__PURE__*/React.createElement("button", { type: "button", className: "p-overlaypanel-close p-link", onClick: this.onCloseClick, "aria-label": this.props.ariaCloseLabel }, /*#__PURE__*/React.createElement("span", { className: "p-overlaypanel-close-icon pi pi-times" }), /*#__PURE__*/React.createElement(Ripple, null)); } return null; } }, { key: "renderElement", value: function renderElement() { var className = classNames('p-overlaypanel p-component', this.props.className); var closeIcon = this.renderCloseIcon(); return /*#__PURE__*/React.createElement(CSSTransition, { nodeRef: this.overlayRef, classNames: "p-overlaypanel", in: this.state.visible, timeout: { enter: 120, exit: 100 }, options: this.props.transitionOptions, unmountOnExit: true, onEnter: this.onEnter, onEntered: this.onEntered, onExit: this.onExit, onExited: this.onExited }, /*#__PURE__*/React.createElement("div", { ref: this.overlayRef, id: this.props.id, className: className, style: this.props.style, onClick: this.onPanelClick }, /*#__PURE__*/React.createElement("div", { className: "p-overlaypanel-content", onClick: this.onContentClick, onMouseDown: this.onContentClick }, this.props.children), closeIcon)); } }, { key: "render", value: function render() { var element = this.renderElement(); return /*#__PURE__*/React.createElement(Portal, { element: element, appendTo: this.props.appendTo }); } }]); return OverlayPanel; }(Component); _defineProperty(OverlayPanel, "defaultProps", { id: null, dismissable: true, showCloseIcon: false, style: null, className: null, appendTo: null, breakpoints: null, ariaCloseLabel: 'close', transitionOptions: null, onShow: null, onHide: null }); export { OverlayPanel };
src/components/ChatBox/ChatBox.js
renesansz/react-chat
import React from 'react'; import ChatBoxControls from './ChatBoxControls/ChatBoxControls'; import ChatBoxCard from './ChatBoxCard/ChatBoxCard'; import './ChatBox.css'; class ChatBox extends React.Component { render() { const messages = this.props.messages.map((message) => <ChatBoxCard key={ message.id } author={ message.author } isUserAuthor={ (this.props.user === message.author) ? true : false } message={ message.content } /> ); return ( <div className="ChatBox"> <div className="content"> <h4>Chat Box</h4> <div className="messages"> { messages } </div> <ChatBoxControls sendMessage={ this.props.sendMessage } isLoggedIn={ (this.props.user) ? true : false } /> </div> </div> ); }; } export default ChatBox;
src/components/FeedPhoto.js
adamfaryna/flickr-public-gallery
/* * Copyright (C) 2017 Adam Faryna <[email protected]> * * Distributed under terms of the BSD 2-Clause license. */ import React from 'react'; import PropTypes from 'prop-types'; const FeedPhoto = ({ title, author, photoLink, authorLink }) => ( <div className='feed-item__feed-photo'> <div src={photoLink} className='feed-item__feed-photo__img' style={{ backgroundImage: `url(${photoLink})`}} /> <a href={photoLink} className='feed-item__feed-photo__title'>{title}</a> <span>&nbsp;by&nbsp;</span> <a href={authorLink} className='feed-item__feed-photo__author'>{author}</a> </div> ); FeedPhoto.propTypes = { title: PropTypes.string.isRequired, author: PropTypes.string.isRequired, photoLink: PropTypes.string.isRequired, authorLink: PropTypes.string.isRequired }; export default FeedPhoto;
src/svg-icons/image/nature-people.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageNaturePeople = (props) => ( <SvgIcon {...props}> <path d="M22.17 9.17c0-3.87-3.13-7-7-7s-7 3.13-7 7c0 3.47 2.52 6.34 5.83 6.89V20H6v-3h1v-4c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v4h1v5h16v-2h-3v-3.88c3.47-.41 6.17-3.36 6.17-6.95zM4.5 11c.83 0 1.5-.67 1.5-1.5S5.33 8 4.5 8 3 8.67 3 9.5 3.67 11 4.5 11z"/> </SvgIcon> ); ImageNaturePeople = pure(ImageNaturePeople); ImageNaturePeople.displayName = 'ImageNaturePeople'; ImageNaturePeople.muiName = 'SvgIcon'; export default ImageNaturePeople;
docs/src/HomePage.js
Cellule/react-bootstrap
import React from 'react'; import NavMain from './NavMain'; import PageFooter from './PageFooter'; import Grid from '../../src/Grid'; import Alert from '../../src/Alert'; import Glyphicon from '../../src/Glyphicon'; export default class HomePage extends React.Component{ render() { return ( <div> <NavMain activePage="home" /> <main className="bs-docs-masthead" id="content" role="main"> <div className="container"> <span className="bs-docs-booticon bs-docs-booticon-lg bs-docs-booticon-outline"></span> <p className="lead">The most popular front-end framework, rebuilt for React.</p> </div> </main> <Grid> <Alert bsStyle='danger'> <Glyphicon glyph='warning-sign' /> The project is under active development, and APIs will change. Check out the <a href='https://github.com/react-bootstrap/react-bootstrap/wiki#100-roadmap'>1.0.0 Roadmap</a> and <a href='https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md'>Contributing Guidelines</a> to see where you can help out. Prior to the 1.0.0 release, breaking changes should result in a Minor version bump. </Alert> </Grid> <PageFooter /> </div> ); } }
ajax/libs/vkui/4.29.0/components/ActionSheet/ActionSheetDropdownDesktop.min.js
cdnjs/cdnjs
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","toggleRef","closing","popupDirection","onClose","className","style"];import{createScopedElement}from"../../lib/jsxRuntime";import*as React from"react";import{getClassName}from"../../helpers/getClassName";import{classNames}from"../../lib/classNames";import{useDOM}from"../../lib/dom";import{usePlatform}from"../../hooks/usePlatform";import{useEffectDev}from"../../hooks/useEffectDev";import{useAdaptivity}from"../../hooks/useAdaptivity";import{isRefObject}from"../../lib/isRefObject";import{warnOnce}from"../../lib/warnOnce";import{useEventListener}from"../../hooks/useEventListener";import{FocusTrap}from"../FocusTrap/FocusTrap";import{Popper}from"../Popper/Popper";var warn=warnOnce("ActionSheet");function getEl(e){return e&&"current"in e?e.current:e}var ActionSheetDropdownDesktop=function(e){var t=e.children,o=e.toggleRef,r=(e.closing,e.popupDirection),s=e.onClose,n=e.className,i=e.style,e=_objectWithoutProperties(e,_excluded),c=useDOM().document,a=usePlatform(),p=useAdaptivity().sizeY,u=React.useRef(null),l=(useEffectDev(function(){getEl(o)||warn("toggleRef not passed","error")},[o]),React.useMemo(function(){return"top"===r||"function"==typeof r&&"top"===r(u)},[r,u])),m=useEventListener("click",function(e){var t=null==u?void 0:u.current;t&&!t.contains(e.target)&&null!=s&&s()}),f=(React.useEffect(function(){setTimeout(function(){m.add(c.body)})},[m,c]),React.useCallback(function(e){return e.stopPropagation()},[])),d=React.useMemo(function(){return isRefObject(o)?o:{current:o}},[o]);return createScopedElement(Popper,{targetRef:d,offsetDistance:0,placement:l?"top-end":"bottom-end",vkuiClass:classNames(getClassName("ActionSheet",a),"ActionSheet--desktop","ActionSheet--sizeY-".concat(p)),className:n,style:i,getRef:u,forcePortal:!1},createScopedElement(FocusTrap,_extends({onClose:s},e,{onClick:f}),t))};export{ActionSheetDropdownDesktop};
react-fundamentals-es6/lessons/12-composable/main.js
3mundi/React-Bible
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; ReactDOM.render(<App />, document.getElementById('app'));
ajax/libs/react-router/3.0.3/ReactRouter.min.js
tonytomov/cdnjs
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactRouter=t(require("react")):e.ReactRouter=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.createMemoryHistory=t.hashHistory=t.browserHistory=t.applyRouterMiddleware=t.formatPattern=t.useRouterHistory=t.match=t.routerShape=t.locationShape=t.RouterContext=t.createRoutes=t.Route=t.Redirect=t.IndexRoute=t.IndexRedirect=t.withRouter=t.IndexLink=t.Link=t.Router=void 0;var o=n(3);Object.defineProperty(t,"createRoutes",{enumerable:!0,get:function(){return o.createRoutes}});var u=n(14);Object.defineProperty(t,"locationShape",{enumerable:!0,get:function(){return u.locationShape}}),Object.defineProperty(t,"routerShape",{enumerable:!0,get:function(){return u.routerShape}});var a=n(6);Object.defineProperty(t,"formatPattern",{enumerable:!0,get:function(){return a.formatPattern}});var i=n(35),c=r(i),s=n(20),f=r(s),l=n(31),d=r(l),p=n(46),h=r(p),v=n(32),y=r(v),m=n(33),g=r(m),b=n(22),_=r(b),O=n(34),P=r(O),R=n(15),w=r(R),x=n(44),E=r(x),C=n(27),j=r(C),M=n(37),L=r(M),A=n(38),S=r(A),k=n(42),q=r(k),T=n(24),U=r(T);t.Router=c.default,t.Link=f.default,t.IndexLink=d.default,t.withRouter=h.default,t.IndexRedirect=y.default,t.IndexRoute=g.default,t.Redirect=_.default,t.Route=P.default,t.RouterContext=w.default,t.match=E.default,t.useRouterHistory=j.default,t.applyRouterMiddleware=L.default,t.browserHistory=S.default,t.hashHistory=q.default,t.createMemoryHistory=U.default},function(e,t,n){"use strict";var r=function(e,t,n,r,o,u,a,i){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,u,a,i],f=0;c=new Error(t.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=r},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return null==e||d.default.isValidElement(e)}function u(e){return o(e)||Array.isArray(e)&&e.every(o)}function a(e,t){return f({},e,t)}function i(e){var t=e.type,n=a(t.defaultProps,e.props);if(n.children){var r=c(n.children,n);r.length&&(n.childRoutes=r),delete n.children}return n}function c(e,t){var n=[];return d.default.Children.forEach(e,function(e){if(d.default.isValidElement(e))if(e.type.createRouteFromReactElement){var r=e.type.createRouteFromReactElement(e,t);r&&n.push(r)}else n.push(i(e))}),n}function s(e){return u(e)?e=c(e):e&&!Array.isArray(e)&&(e=[e]),e}t.__esModule=!0;var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.isReactChildren=u,t.createRouteFromReactElement=i,t.createRoutesFromReactChildren=c,t.createRoutes=s;var l=n(2),d=r(l)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.createPath=t.parsePath=t.getQueryStringValueFromPath=t.stripQueryStringValueFromPath=t.addQueryStringValueToPath=void 0;var o=n(5),u=(r(o),t.addQueryStringValueToPath=function(e,t,n){var r=a(e),o=r.pathname,u=r.search,c=r.hash;return i({pathname:o,search:u+(u.indexOf("?")===-1?"?":"&")+t+"="+n,hash:c})},t.stripQueryStringValueFromPath=function(e,t){var n=a(e),r=n.pathname,o=n.search,u=n.hash;return i({pathname:r,search:o.replace(new RegExp("([?&])"+t+"=[a-zA-Z0-9]+(&?)"),function(e,t,n){return"?"===t?t:n}),hash:u})},t.getQueryStringValueFromPath=function(e,t){var n=a(e),r=n.search,o=r.match(new RegExp("[?&]"+t+"=([a-zA-Z0-9]+)"));return o&&o[1]},function(e){var t=e.match(/^(https?:)?\/\/[^\/]*/);return null==t?e:e.substring(t[0].length)}),a=t.parsePath=function(e){var t=u(e),n="",r="",o=t.indexOf("#");o!==-1&&(r=t.substring(o),t=t.substring(0,o));var a=t.indexOf("?");return a!==-1&&(n=t.substring(a),t=t.substring(0,a)),""===t&&(t="/"),{pathname:t,search:n,hash:r}},i=t.createPath=function(e){if(null==e||"string"==typeof e)return e;var t=e.basename,n=e.pathname,r=e.search,o=e.hash,u=(t||"")+n;return r&&"?"!==r&&(u+=r),o&&(u+=o),u}},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u(e){for(var t="",n=[],r=[],u=void 0,a=0,i=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)|\\\(|\\\)/g;u=i.exec(e);)u.index!==a&&(r.push(e.slice(a,u.index)),t+=o(e.slice(a,u.index))),u[1]?(t+="([^/]+)",n.push(u[1])):"**"===u[0]?(t+="(.*)",n.push("splat")):"*"===u[0]?(t+="(.*?)",n.push("splat")):"("===u[0]?t+="(?:":")"===u[0]?t+=")?":"\\("===u[0]?t+="\\(":"\\)"===u[0]&&(t+="\\)"),r.push(u[0]),a=i.lastIndex;return a!==e.length&&(r.push(e.slice(a,e.length)),t+=o(e.slice(a,e.length))),{pattern:e,regexpSource:t,paramNames:n,tokens:r}}function a(e){return p[e]||(p[e]=u(e)),p[e]}function i(e,t){"/"!==e.charAt(0)&&(e="/"+e);var n=a(e),r=n.regexpSource,o=n.paramNames,u=n.tokens;"/"!==e.charAt(e.length-1)&&(r+="/?"),"*"===u[u.length-1]&&(r+="$");var i=t.match(new RegExp("^"+r,"i"));if(null==i)return null;var c=i[0],s=t.substr(c.length);if(s){if("/"!==c.charAt(c.length-1))return null;s="/"+s}return{remainingPathname:s,paramNames:o,paramValues:i.slice(1).map(function(e){return e&&decodeURIComponent(e)})}}function c(e){return a(e).paramNames}function s(e,t){var n=i(e,t);if(!n)return null;var r=n.paramNames,o=n.paramValues,u={};return r.forEach(function(e,t){u[e]=o[t]}),u}function f(e,t){t=t||{};for(var n=a(e),r=n.tokens,o=0,u="",i=0,c=[],s=void 0,f=void 0,l=void 0,p=0,h=r.length;p<h;++p)if(s=r[p],"*"===s||"**"===s)l=Array.isArray(t.splat)?t.splat[i++]:t.splat,null!=l||o>0?void 0:(0,d.default)(!1),null!=l&&(u+=encodeURI(l));else if("("===s)c[o]="",o+=1;else if(")"===s){var v=c.pop();o-=1,o?c[o-1]+=v:u+=v}else if("\\("===s)u+="(";else if("\\)"===s)u+=")";else if(":"===s.charAt(0))if(f=s.substring(1),l=t[f],null!=l||o>0?void 0:(0,d.default)(!1),null==l){if(o){c[o-1]="";for(var y=r.indexOf(s),m=r.slice(y,r.length),g=-1,b=0;b<m.length;b++)if(")"==m[b]){g=b;break}g>0?void 0:(0,d.default)(!1),p=y+g-1}}else o?c[o-1]+=encodeURIComponent(l):u+=encodeURIComponent(l);else o?c[o-1]+=s:u+=s;return o<=0?void 0:(0,d.default)(!1),u.replace(/\/+/g,"/")}t.__esModule=!0,t.compilePattern=a,t.matchPattern=i,t.getParamNames=c,t.getParams=s,t.formatPattern=f;var l=n(1),d=r(l),p=Object.create(null)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(t.indexOf("deprecated")!==-1){if(c[t])return;c[t]=!0}t="[react-router] "+t;for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];i.default.apply(void 0,[e,t].concat(r))}function u(){c={}}t.__esModule=!0,t.default=o,t._resetWarned=u;var a=n(5),i=r(a),c={}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.locationsAreEqual=t.statesAreEqual=t.createLocation=t.createQuery=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(1),i=r(a),c=n(5),s=(r(c),n(4)),f=n(10),l=(t.createQuery=function(e){return u(Object.create(null),e)},t.createLocation=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.POP,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r="string"==typeof e?(0,s.parsePath)(e):e,o=r.pathname||"/",u=r.search||"",a=r.hash||"",i=r.state;return{pathname:o,search:u,hash:a,state:i,action:t,key:n}},function(e){return"[object Date]"===Object.prototype.toString.call(e)}),d=t.statesAreEqual=function e(t,n){if(t===n)return!0;var r="undefined"==typeof t?"undefined":o(t),u="undefined"==typeof n?"undefined":o(n);if(r!==u)return!1;if("function"===r?(0,i.default)(!1):void 0,"object"===r){if(l(t)&&l(n)?(0,i.default)(!1):void 0,!Array.isArray(t)){var a=Object.keys(t),c=Object.keys(n);return a.length===c.length&&a.every(function(r){return e(t[r],n[r])})}return Array.isArray(n)&&t.length===n.length&&t.every(function(t,r){return e(t,n[r])})}return!1};t.locationsAreEqual=function(e,t){return e.key===t.key&&e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&d(e.state,t.state)}},function(e,t,n){"use strict";function r(e,t,n){if(e[t])return new Error("<"+n+'> should not have a "'+t+'" prop')}t.__esModule=!0,t.routes=t.route=t.components=t.component=t.history=void 0,t.falsy=r;var o=n(2),u=o.PropTypes.func,a=o.PropTypes.object,i=o.PropTypes.arrayOf,c=o.PropTypes.oneOfType,s=o.PropTypes.element,f=o.PropTypes.shape,l=o.PropTypes.string,d=(t.history=f({listen:u.isRequired,push:u.isRequired,replace:u.isRequired,go:u.isRequired,goBack:u.isRequired,goForward:u.isRequired}),t.component=c([u,l])),p=(t.components=c([d,a]),t.route=c([a,s]));t.routes=c([p,i(p)])},function(e,t){"use strict";t.__esModule=!0;t.PUSH="PUSH",t.REPLACE="REPLACE",t.POP="POP"},function(e,t){"use strict";t.__esModule=!0;t.addEventListener=function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},t.removeEventListener=function(e,t,n){return e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},t.supportsHistory=function(){var e=window.navigator.userAgent;return(e.indexOf("Android 2.")===-1&&e.indexOf("Android 4.0")===-1||e.indexOf("Mobile Safari")===-1||e.indexOf("Chrome")!==-1||e.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)},t.supportsGoWithoutReloadUsingHash=function(){return window.navigator.userAgent.indexOf("Firefox")===-1},t.supportsPopstateOnHashchange=function(){return window.navigator.userAgent.indexOf("Trident")===-1},t.isExtraneousPopstateEvent=function(e){return void 0===e.state&&navigator.userAgent.indexOf("CriOS")===-1}},function(e,t){"use strict";function n(e,t,n){function r(){return a=!0,i?void(s=[].concat(Array.prototype.slice.call(arguments))):void n.apply(this,arguments)}function o(){if(!a&&(c=!0,!i)){for(i=!0;!a&&u<e&&c;)c=!1,t.call(this,u++,o,r);return i=!1,a?void n.apply(this,s):void(u>=e&&c&&(a=!0,n()))}}var u=0,a=!1,i=!1,c=!1,s=void 0;o()}function r(e,t,n){function r(e,t,r){a||(t?(a=!0,n(t)):(u[e]=r,a=++i===o,a&&n(null,u)))}var o=e.length,u=[];if(0===o)return n(null,u);var a=!1,i=0;e.forEach(function(e,n){t(e,n,function(e,t){r(n,e,t)})})}t.__esModule=!0,t.loopAsync=n,t.mapAsync=r},function(e,t,n){"use strict";function r(e){return"@@contextSubscriber/"+e}function o(e){var t,n,o=r(e),u=o+"/listeners",a=o+"/eventIndex",c=o+"/subscribe";return n={childContextTypes:(t={},t[o]=i.isRequired,t),getChildContext:function(){var e;return e={},e[o]={eventIndex:this[a],subscribe:this[c]},e},componentWillMount:function(){this[u]=[],this[a]=0},componentWillReceiveProps:function(){this[a]++},componentDidUpdate:function(){var e=this;this[u].forEach(function(t){return t(e[a])})}},n[c]=function(e){var t=this;return this[u].push(e),function(){t[u]=t[u].filter(function(t){return t!==e})}},n}function u(e){var t,n,o=r(e),u=o+"/lastRenderedEventIndex",a=o+"/handleContextUpdate",c=o+"/unsubscribe";return n={contextTypes:(t={},t[o]=i,t),getInitialState:function(){var e;return this.context[o]?(e={},e[u]=this.context[o].eventIndex,e):{}},componentDidMount:function(){this.context[o]&&(this[c]=this.context[o].subscribe(this[a]))},componentWillReceiveProps:function(){var e;this.context[o]&&this.setState((e={},e[u]=this.context[o].eventIndex,e))},componentWillUnmount:function(){this[c]&&(this[c](),this[c]=null)}},n[a]=function(e){if(e!==this.state[u]){var t;this.setState((t={},t[u]=e,t))}},n}t.__esModule=!0,t.ContextProvider=o,t.ContextSubscriber=u;var a=n(2),i=a.PropTypes.shape({subscribe:a.PropTypes.func.isRequired,eventIndex:a.PropTypes.number.isRequired})},function(e,t,n){"use strict";t.__esModule=!0,t.locationShape=t.routerShape=void 0;var r=n(2),o=r.PropTypes.func,u=r.PropTypes.object,a=r.PropTypes.shape,i=r.PropTypes.string;t.routerShape=a({push:o.isRequired,replace:o.isRequired,go:o.isRequired,goBack:o.isRequired,goForward:o.isRequired,setRouteLeaveHook:o.isRequired,isActive:o.isRequired}),t.locationShape=a({pathname:i.isRequired,search:i.isRequired,state:u,action:i.isRequired,key:i})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=n(1),i=r(a),c=n(2),s=r(c),f=n(41),l=r(f),d=n(13),p=n(3),h=s.default.PropTypes,v=h.array,y=h.func,m=h.object,g=s.default.createClass({displayName:"RouterContext",mixins:[(0,d.ContextProvider)("router")],propTypes:{router:m.isRequired,location:m.isRequired,routes:v.isRequired,params:m.isRequired,components:v.isRequired,createElement:y.isRequired},getDefaultProps:function(){return{createElement:s.default.createElement}},childContextTypes:{router:m.isRequired},getChildContext:function(){return{router:this.props.router}},createElement:function(e,t){return null==e?null:this.props.createElement(e,t)},render:function(){var e=this,t=this.props,n=t.location,r=t.routes,a=t.params,c=t.components,f=t.router,d=null;return c&&(d=c.reduceRight(function(t,i,c){if(null==i)return t;var s=r[c],d=(0,l.default)(s,a),h={location:n,params:a,route:s,router:f,routeParams:d,routes:r};if((0,p.isReactChildren)(t))h.children=t;else if(t)for(var v in t)Object.prototype.hasOwnProperty.call(t,v)&&(h[v]=t[v]);if("object"===("undefined"==typeof i?"undefined":u(i))){var y={};for(var m in i)Object.prototype.hasOwnProperty.call(i,m)&&(y[m]=e.createElement(i[m],o({key:m},h)));return y}return e.createElement(i,h)},d)),null===d||d===!1||s.default.isValidElement(d)?void 0:(0,i.default)(!1),d}});t.default=g},function(e,t,n){"use strict";t.__esModule=!0,t.go=t.replaceLocation=t.pushLocation=t.startListener=t.getUserConfirmation=t.getCurrentLocation=void 0;var r=n(8),o=n(11),u=n(28),a=n(4),i=n(17),c="popstate",s="hashchange",f=i.canUseDOM&&!(0,o.supportsPopstateOnHashchange)(),l=function(e){var t=e&&e.key;return(0,r.createLocation)({pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,state:t?(0,u.readState)(t):void 0},void 0,t)},d=t.getCurrentLocation=function(){var e=void 0;try{e=window.history.state||{}}catch(t){e={}}return l(e)},p=(t.getUserConfirmation=function(e,t){return t(window.confirm(e))},t.startListener=function(e){var t=function(t){(0,o.isExtraneousPopstateEvent)(t)||e(l(t.state))};(0,o.addEventListener)(window,c,t);var n=function(){return e(d())};return f&&(0,o.addEventListener)(window,s,n),function(){(0,o.removeEventListener)(window,c,t),f&&(0,o.removeEventListener)(window,s,n)}},function(e,t){var n=e.state,r=e.key;void 0!==n&&(0,u.saveState)(r,n),t({key:r},(0,a.createPath)(e))});t.pushLocation=function(e){return p(e,function(e,t){return window.history.pushState(e,null,t)})},t.replaceLocation=function(e){return p(e,function(e,t){return window.history.replaceState(e,null,t)})},t.go=function(e){e&&window.history.go(e)}},function(e,t){"use strict";t.__esModule=!0;t.canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(47),u=n(4),a=n(19),i=r(a),c=n(10),s=n(8),f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getCurrentLocation,n=e.getUserConfirmation,r=e.pushLocation,a=e.replaceLocation,f=e.go,l=e.keyLength,d=void 0,p=void 0,h=[],v=[],y=[],m=function(){return p&&p.action===c.POP?y.indexOf(p.key):d?y.indexOf(d.key):-1},g=function(e){var t=m();d=e,d.action===c.PUSH?y=[].concat(y.slice(0,t+1),[d.key]):d.action===c.REPLACE&&(y[t]=d.key),v.forEach(function(e){return e(d)})},b=function(e){return h.push(e),function(){return h=h.filter(function(t){return t!==e})}},_=function(e){return v.push(e),function(){return v=v.filter(function(t){return t!==e})}},O=function(e,t){(0,o.loopAsync)(h.length,function(t,n,r){(0,i.default)(h[t],e,function(e){return null!=e?r(e):n()})},function(e){n&&"string"==typeof e?n(e,function(e){return t(e!==!1)}):t(e!==!1)})},P=function(e){d&&(0,s.locationsAreEqual)(d,e)||p&&(0,s.locationsAreEqual)(p,e)||(p=e,O(e,function(t){if(p===e)if(p=null,t){if(e.action===c.PUSH){var n=(0,u.createPath)(d),o=(0,u.createPath)(e);o===n&&(0,s.statesAreEqual)(d.state,e.state)&&(e.action=c.REPLACE)}e.action===c.POP?g(e):e.action===c.PUSH?r(e)!==!1&&g(e):e.action===c.REPLACE&&a(e)!==!1&&g(e)}else if(d&&e.action===c.POP){var i=y.indexOf(d.key),l=y.indexOf(e.key);i!==-1&&l!==-1&&f(i-l)}}))},R=function(e){return P(M(e,c.PUSH))},w=function(e){return P(M(e,c.REPLACE))},x=function(){return f(-1)},E=function(){return f(1)},C=function(){return Math.random().toString(36).substr(2,l||6)},j=function(e){return(0,u.createPath)(e)},M=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C();return(0,s.createLocation)(e,t,n)};return{getCurrentLocation:t,listenBefore:b,listen:_,transitionTo:P,push:R,replace:w,go:f,goBack:x,goForward:E,createKey:C,createPath:u.createPath,createHref:j,createLocation:M}};t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(5),u=(r(o),function(e,t,n){var r=e(t,n);e.length<2&&n(r)});t.default=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(e){return 0===e.button}function a(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function i(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function c(e,t){return"function"==typeof e?e(t.location):e}t.__esModule=!0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=n(2),l=r(f),d=n(1),p=r(d),h=n(14),v=n(13),y=l.default.PropTypes,m=y.bool,g=y.object,b=y.string,_=y.func,O=y.oneOfType,P=l.default.createClass({displayName:"Link",mixins:[(0,v.ContextSubscriber)("router")],contextTypes:{router:h.routerShape},propTypes:{to:O([b,g,_]),activeStyle:g,activeClassName:b,onlyActiveOnIndex:m.isRequired,onClick:_,target:b},getDefaultProps:function(){return{onlyActiveOnIndex:!1,style:{}}},handleClick:function(e){if(this.props.onClick&&this.props.onClick(e),!e.defaultPrevented){var t=this.context.router;t?void 0:(0,p.default)(!1),!a(e)&&u(e)&&(this.props.target||(e.preventDefault(),t.push(c(this.props.to,t))))}},render:function(){var e=this.props,t=e.to,n=e.activeClassName,r=e.activeStyle,u=e.onlyActiveOnIndex,a=o(e,["to","activeClassName","activeStyle","onlyActiveOnIndex"]),f=this.context.router;if(f){if(!t)return l.default.createElement("a",a);var d=c(t,f);a.href=f.createHref(d),(n||null!=r&&!i(r))&&f.isActive(d,u)&&(n&&(a.className?a.className+=" "+n:a.className=n),r&&(a.style=s({},a.style,r)))}return l.default.createElement("a",s({},a,{onClick:this.handleClick}))}});t.default=P},function(e,t){"use strict";function n(e){return e&&"function"==typeof e.then}t.__esModule=!0,t.isPromise=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(2),u=r(o),a=n(1),i=r(a),c=n(3),s=n(6),f=n(9),l=u.default.PropTypes,d=l.string,p=l.object,h=u.default.createClass({displayName:"Redirect",statics:{createRouteFromReactElement:function(e){var t=(0,c.createRouteFromReactElement)(e);return t.from&&(t.path=t.from),t.onEnter=function(e,n){var r=e.location,o=e.params,u=void 0;if("/"===t.to.charAt(0))u=(0,s.formatPattern)(t.to,o);else if(t.to){var a=e.routes.indexOf(t),i=h.getRoutePattern(e.routes,a-1),c=i.replace(/\/*$/,"/")+t.to;u=(0,s.formatPattern)(c,o)}else u=r.pathname;n({pathname:u,query:t.query||r.query,state:t.state||r.state})},t},getRoutePattern:function(e,t){for(var n="",r=t;r>=0;r--){var o=e[r],u=o.path||"";if(n=u.replace(/\/*$/,"/")+n,0===u.indexOf("/"))break}return"/"+n}},propTypes:{path:d,from:d,to:d.isRequired,query:p,state:p,onEnter:f.falsy,children:f.falsy},render:function(){(0,i.default)(!1)}});t.default=h},function(e,t){"use strict";function n(e,t,n){var u=o({},e,{setRouteLeaveHook:t.listenBeforeLeavingRoute,isActive:t.isActive});return r(u,n)}function r(e,t){var n=t.location,r=t.params,o=t.routes;return e.location=n,e.params=r,e.routes=o,e}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.createRouterObject=n,t.assignRouterState=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=(0,f.default)(e),n=function(){return t},r=(0,a.default)((0,c.default)(n))(e);return r}t.__esModule=!0,t.default=o;var u=n(30),a=r(u),i=n(29),c=r(i),s=n(52),f=r(s)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=void 0;return i&&(t=(0,a.default)(e)()),t}t.__esModule=!0,t.default=o;var u=n(27),a=r(u),i=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function u(e,t){function n(t,n){return t=e.createLocation(t),(0,d.default)(t,n,b.location,b.routes,b.params)}function r(e,n){_&&_.location===e?u(_,n):(0,y.default)(t,e,function(t,r){t?n(t):r?u(a({},r,{location:e}),n):n()})}function u(e,t){function n(n,o){return n||o?r(n,o):void(0,h.default)(e,function(n,r){n?t(n):t(null,null,b=a({},e,{components:r}))})}function r(e,n){e?t(e):t(null,n)}var o=(0,s.default)(b,e),u=o.leaveRoutes,i=o.changeRoutes,c=o.enterRoutes;(0,f.runLeaveHooks)(u,b),u.filter(function(e){return c.indexOf(e)===-1}).forEach(v),(0,f.runChangeHooks)(i,b,e,function(t,o){return t||o?r(t,o):void(0,f.runEnterHooks)(c,e,n)})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.__id__||t&&(e.__id__=O++)}function c(e){return e.map(function(e){return P[i(e)]}).filter(function(e){return e})}function l(e,n){(0,y.default)(t,e,function(t,r){if(null==r)return void n();_=a({},r,{location:e});for(var o=c((0,s.default)(b,_).leaveRoutes),u=void 0,i=0,f=o.length;null==u&&i<f;++i)u=o[i](e);n(u)})}function p(){if(b.routes){for(var e=c(b.routes),t=void 0,n=0,r=e.length;"string"!=typeof t&&n<r;++n)t=e[n]();return t}}function v(e){var t=i(e);t&&(delete P[t],o(P)||(R&&(R(),R=null),w&&(w(),w=null)))}function m(t,n){var r=!o(P),u=i(t,!0);return P[u]=n,r&&(R=e.listenBefore(l),e.listenBeforeUnload&&(w=e.listenBeforeUnload(p))),function(){v(t)}}function g(t){function n(n){b.location===n?t(null,b):r(n,function(n,r,o){n?t(n):r?e.replace(r):o&&t(null,o)})}var o=e.listen(n);return b.location?t(null,b):n(e.getCurrentLocation()),o}var b={},_=void 0,O=1,P=Object.create(null),R=void 0,w=void 0;return{isActive:n,match:r,listenBeforeLeavingRoute:m,listen:g}}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=u;var i=n(7),c=(r(i),n(39)),s=r(c),f=n(36),l=n(43),d=r(l),p=n(40),h=r(p),v=n(45),y=r(v)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return function(t){var n=(0,a.default)((0,c.default)(e))(t);return n}}t.__esModule=!0,t.default=o;var u=n(30),a=r(u),i=n(29),c=r(i)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.readState=t.saveState=void 0;var o=n(5),u=(r(o),{QuotaExceededError:!0,QUOTA_EXCEEDED_ERR:!0}),a={SecurityError:!0},i="@@History/",c=function(e){return i+e};t.saveState=function(e,t){if(window.sessionStorage)try{null==t?window.sessionStorage.removeItem(c(e)):window.sessionStorage.setItem(c(e),JSON.stringify(t))}catch(e){if(a[e.name])return;if(u[e.name]&&0===window.sessionStorage.length)return;throw e}},t.readState=function(e){var t=void 0;try{t=window.sessionStorage.getItem(c(e))}catch(e){if(a[e.name])return}if(t)try{return JSON.parse(t)}catch(e){}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(19),a=r(u),i=n(4),c=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(t),r=t.basename,u=function(e){return e?(r&&null==e.basename&&(0===e.pathname.toLowerCase().indexOf(r.toLowerCase())?(e.pathname=e.pathname.substring(r.length),e.basename=r,""===e.pathname&&(e.pathname="/")):e.basename=""),e):e},c=function(e){if(!r)return e;var t="string"==typeof e?(0,i.parsePath)(e):e,n=t.pathname,u="/"===r.slice(-1)?r:r+"/",a="/"===n.charAt(0)?n.slice(1):n,c=u+a;return o({},t,{pathname:c})},s=function(){return u(n.getCurrentLocation())},f=function(e){return n.listenBefore(function(t,n){return(0,a.default)(e,u(t),n)})},l=function(e){return n.listen(function(t){return e(u(t))})},d=function(e){return n.push(c(e))},p=function(e){return n.replace(c(e))},h=function(e){return n.createPath(c(e))},v=function(e){return n.createHref(c(e))},y=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return u(n.createLocation.apply(n,[c(e)].concat(r)))};return o({},n,{getCurrentLocation:s,listenBefore:f,listen:l,push:d,replace:p,createPath:h,createHref:v,createLocation:y})}};t.default=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(55),a=n(19),i=r(a),c=n(8),s=n(4),f=function(e){return(0,u.stringify)(e).replace(/%20/g,"+")},l=u.parse,d=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(t),r=t.stringifyQuery,u=t.parseQueryString;"function"!=typeof r&&(r=f),"function"!=typeof u&&(u=l);var a=function(e){return e?(null==e.query&&(e.query=u(e.search.substring(1))),e):e},d=function(e,t){if(null==t)return e;var n="string"==typeof e?(0,s.parsePath)(e):e,u=r(t),a=u?"?"+u:"";return o({},n,{search:a})},p=function(){return a(n.getCurrentLocation())},h=function(e){return n.listenBefore(function(t,n){return(0,i.default)(e,a(t),n)})},v=function(e){return n.listen(function(t){return e(a(t))})},y=function(e){return n.push(d(e,e.query))},m=function(e){return n.replace(d(e,e.query))},g=function(e){return n.createPath(d(e,e.query))},b=function(e){return n.createHref(d(e,e.query))},_=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];var u=n.createLocation.apply(n,[d(e,e.query)].concat(r));return e.query&&(u.query=(0,c.createQuery)(e.query)),a(u)};return o({},n,{getCurrentLocation:p,listenBefore:h,listen:v,push:y,replace:m,createPath:g,createHref:b,createLocation:_})}};t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(2),a=r(u),i=n(20),c=r(i),s=a.default.createClass({displayName:"IndexLink",render:function(){return a.default.createElement(c.default,o({},this.props,{onlyActiveOnIndex:!0}))}});t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(2),u=r(o),a=n(7),i=(r(a),n(1)),c=r(i),s=n(22),f=r(s),l=n(9),d=u.default.PropTypes,p=d.string,h=d.object,v=u.default.createClass({displayName:"IndexRedirect",statics:{createRouteFromReactElement:function(e,t){t&&(t.indexRoute=f.default.createRouteFromReactElement(e))}},propTypes:{to:p.isRequired,query:h,state:h,onEnter:l.falsy,children:l.falsy},render:function(){(0,c.default)(!1)}});t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(2),u=r(o),a=n(7),i=(r(a),n(1)),c=r(i),s=n(3),f=n(9),l=u.default.PropTypes.func,d=u.default.createClass({displayName:"IndexRoute",statics:{createRouteFromReactElement:function(e,t){t&&(t.indexRoute=(0,s.createRouteFromReactElement)(e))}},propTypes:{path:f.falsy,component:f.component,components:f.components,getComponent:l,getComponents:l},render:function(){(0,c.default)(!1)}});t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(2),u=r(o),a=n(1),i=r(a),c=n(3),s=n(9),f=u.default.PropTypes,l=f.string,d=f.func,p=u.default.createClass({displayName:"Route",statics:{createRouteFromReactElement:c.createRouteFromReactElement},propTypes:{path:l,component:s.component,components:s.components,getComponent:d,getComponents:d},render:function(){(0,i.default)(!1)}});t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(1),i=r(a),c=n(2),s=r(c),f=n(26),l=r(f),d=n(9),p=n(15),h=r(p),v=n(3),y=n(23),m=n(7),g=(r(m),s.default.PropTypes),b=g.func,_=g.object,O={history:_,children:d.routes,routes:d.routes,render:b,createElement:b,onError:b,onUpdate:b,matchContext:_},P=s.default.createClass({displayName:"Router",propTypes:O,getDefaultProps:function(){return{render:function(e){return s.default.createElement(h.default,e)}}},getInitialState:function(){return{location:null,routes:null,params:null,components:null}},handleError:function(e){if(!this.props.onError)throw e;this.props.onError.call(this,e)},createRouterObject:function(e){var t=this.props.matchContext;if(t)return t.router;var n=this.props.history;return(0,y.createRouterObject)(n,this.transitionManager,e)},createTransitionManager:function(){var e=this.props.matchContext;if(e)return e.transitionManager;var t=this.props.history,n=this.props,r=n.routes,o=n.children;return t.getCurrentLocation?void 0:(0,i.default)(!1),(0,l.default)(t,(0,v.createRoutes)(r||o))},componentWillMount:function(){var e=this;this.transitionManager=this.createTransitionManager(),this.router=this.createRouterObject(this.state),this._unlisten=this.transitionManager.listen(function(t,n){t?e.handleError(t):((0,y.assignRouterState)(e.router,n),e.setState(n,e.props.onUpdate))})},componentWillReceiveProps:function(e){},componentWillUnmount:function(){this._unlisten&&this._unlisten()},render:function e(){var t=this.state,n=t.location,r=t.routes,a=t.params,i=t.components,c=this.props,s=c.createElement,e=c.render,f=o(c,["createElement","render"]);return null==n?null:(Object.keys(O).forEach(function(e){return delete f[e]}),e(u({},f,{router:this.router,location:n,routes:r,params:a,components:i,createElement:s})))}});t.default=P},function(e,t,n){"use strict";function r(e,t){ if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n,r){var o=e.length<n,u=function(){for(var n=arguments.length,r=Array(n),u=0;u<n;u++)r[u]=arguments[u];if(e.apply(t,r),o){var a=r[r.length-1];a()}};return r.add(u),u}function u(e){return e.reduce(function(e,t){return t.onEnter&&e.push(o(t.onEnter,t,3,p)),e},[])}function a(e){return e.reduce(function(e,t){return t.onChange&&e.push(o(t.onChange,t,4,h)),e},[])}function i(e,t,n){function r(e){o=e}if(!e)return void n();var o=void 0;(0,l.loopAsync)(e,function(e,n,u){t(e,r,function(e){e||o?u(e,o):n()})},n)}function c(e,t,n){p.clear();var r=u(e);return i(r.length,function(e,n,o){var u=function(){p.has(r[e])&&(o.apply(void 0,arguments),p.remove(r[e]))};r[e](t,n,u)},n)}function s(e,t,n,r){h.clear();var o=a(e);return i(o.length,function(e,r,u){var a=function(){h.has(o[e])&&(u.apply(void 0,arguments),h.remove(o[e]))};o[e](t,n,r,a)},r)}function f(e,t){for(var n=0,r=e.length;n<r;++n)e[n].onLeave&&e[n].onLeave.call(e[n],t)}t.__esModule=!0,t.runEnterHooks=c,t.runChangeHooks=s,t.runLeaveHooks=f;var l=n(12),d=function e(){var t=this;r(this,e),this.hooks=[],this.add=function(e){return t.hooks.push(e)},this.remove=function(e){return t.hooks=t.hooks.filter(function(t){return t!==e})},this.has=function(e){return t.hooks.indexOf(e)!==-1},this.clear=function(){return t.hooks=[]}},p=new d,h=new d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(2),a=r(u),i=n(15),c=r(i),s=n(7);r(s);t.default=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.map(function(e){return e.renderRouterContext}).filter(Boolean),i=t.map(function(e){return e.renderRouteComponent}).filter(Boolean),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.createElement;return function(t,n){return i.reduceRight(function(e,t){return t(e,n)},e(t,n))}};return function(e){return r.reduceRight(function(t,n){return n(t,e)},a.default.createElement(c.default,o({},e,{createElement:s(e.createElement)})))}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(50),u=r(o),a=n(25),i=r(a);t.default=(0,i.default)(u.default)},function(e,t,n){"use strict";function r(e,t,n){if(!e.path)return!1;var r=(0,u.getParamNames)(e.path);return r.some(function(e){return t.params[e]!==n.params[e]})}function o(e,t){var n=e&&e.routes,o=t.routes,u=void 0,a=void 0,i=void 0;if(n){var c=!1;u=n.filter(function(n){if(c)return!0;var u=o.indexOf(n)===-1||r(n,e,t);return u&&(c=!0),u}),u.reverse(),i=[],a=[],o.forEach(function(e){var t=n.indexOf(e)===-1,r=u.indexOf(e)!==-1;t||r?i.push(e):a.push(e)})}else u=[],a=[],i=o;return{leaveRoutes:u,changeRoutes:a,enterRoutes:i}}t.__esModule=!0;var u=n(6);t.default=o},function(e,t,n){"use strict";function r(e,t,n){if(t.component||t.components)return void n(null,t.component||t.components);var r=t.getComponent||t.getComponents;if(r){var o=r.call(t,e,n);(0,a.isPromise)(o)&&o.then(function(e){return n(null,e)},n)}else n()}function o(e,t){(0,u.mapAsync)(e.routes,function(t,n,o){r(e,t,o)},t)}t.__esModule=!0;var u=n(12),a=n(21);t.default=o},function(e,t,n){"use strict";function r(e,t){var n={};return e.path?((0,o.getParamNames)(e.path).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}),n):n}t.__esModule=!0;var o=n(6);t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(51),u=r(o),a=n(25),i=r(a);t.default=(0,i.default)(u.default)},function(e,t,n){"use strict";function r(e,t){if(e==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every(function(e,n){return r(e,t[n])});if("object"===("undefined"==typeof e?"undefined":c(e))){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n]){if(void 0!==t[n])return!1}else{if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!r(e[n],t[n]))return!1}return!0}return String(e)===String(t)}function o(e,t){return"/"!==t.charAt(0)&&(t="/"+t),"/"!==e.charAt(e.length-1)&&(e+="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t===e}function u(e,t,n){for(var r=e,o=[],u=[],a=0,i=t.length;a<i;++a){var c=t[a],f=c.path||"";if("/"===f.charAt(0)&&(r=e,o=[],u=[]),null!==r&&f){var l=(0,s.matchPattern)(f,r);if(l?(r=l.remainingPathname,o=[].concat(o,l.paramNames),u=[].concat(u,l.paramValues)):r=null,""===r)return o.every(function(e,t){return String(u[t])===String(n[e])})}}return!1}function a(e,t){return null==t?null==e:null==e||r(e,t)}function i(e,t,n,r,i){var c=e.pathname,s=e.query;return null!=n&&("/"!==c.charAt(0)&&(c="/"+c),!!(o(c,n.pathname)||!t&&u(c,r,i))&&a(s,n.query))}t.__esModule=!0;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=i;var s=n(6)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(e,t){var n=e.history,r=e.routes,u=e.location,c=o(e,["history","routes","location"]);n||u?void 0:(0,s.default)(!1),n=n?n:(0,l.default)(c);var f=(0,p.default)(n,(0,h.createRoutes)(r));u=u?n.createLocation(u):n.getCurrentLocation(),f.match(u,function(e,r,o){var u=void 0;if(o){var c=(0,v.createRouterObject)(n,f,o);u=a({},o,{router:c,matchContext:{transitionManager:f,router:c}})}t(e,r&&n.createLocation(r,i.REPLACE),u)})}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(10),c=n(1),s=r(c),f=n(24),l=r(f),d=n(26),p=r(d),h=n(3),v=n(23);t.default=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n,r,o){if(e.childRoutes)return[null,e.childRoutes];if(!e.getChildRoutes)return[];var u=!0,a=void 0,c={location:t,params:i(n,r)},s=e.getChildRoutes(c,function(e,t){return t=!e&&(0,v.createRoutes)(t),u?void(a=[e,t]):void o(e,t)});return(0,d.isPromise)(s)&&s.then(function(e){return o(null,(0,v.createRoutes)(e))},o),u=!1,a}function u(e,t,n,r,a){if(e.indexRoute)a(null,e.indexRoute);else if(e.getIndexRoute){var c={location:t,params:i(n,r)},s=e.getIndexRoute(c,function(e,t){a(e,!e&&(0,v.createRoutes)(t)[0])});(0,d.isPromise)(s)&&s.then(function(e){return a(null,(0,v.createRoutes)(e)[0])},a)}else if(e.childRoutes||e.getChildRoutes){var f=function(e,o){if(e)return void a(e);var i=o.filter(function(e){return!e.path});(0,l.loopAsync)(i.length,function(e,o,a){u(i[e],t,n,r,function(t,n){if(t||n){var r=[i[e]].concat(Array.isArray(n)?n:[n]);a(t,r)}else o()})},function(e,t){a(null,t)})},p=o(e,t,n,r,f);p&&f.apply(void 0,p)}else a()}function a(e,t,n){return t.reduce(function(e,t,r){var o=n&&n[r];return Array.isArray(e[t])?e[t].push(o):t in e?e[t]=[e[t],o]:e[t]=o,e},e)}function i(e,t){return a({},e,t)}function c(e,t,n,r,a,c){var f=e.path||"";if("/"===f.charAt(0)&&(n=t.pathname,r=[],a=[]),null!==n&&f){try{var l=(0,p.matchPattern)(f,n);l?(n=l.remainingPathname,r=[].concat(r,l.paramNames),a=[].concat(a,l.paramValues)):n=null}catch(e){c(e)}if(""===n){var d={routes:[e],params:i(r,a)};return void u(e,t,r,a,function(e,t){if(e)c(e);else{if(Array.isArray(t)){var n;(n=d.routes).push.apply(n,t)}else t&&d.routes.push(t);c(null,d)}})}}if(null!=n||e.childRoutes){var h=function(o,u){o?c(o):u?s(u,t,function(t,n){t?c(t):n?(n.routes.unshift(e),c(null,n)):c()},n,r,a):c()},v=o(e,t,r,a,h);v&&h.apply(void 0,v)}else c()}function s(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];void 0===r&&("/"!==t.pathname.charAt(0)&&(t=f({},t,{pathname:"/"+t.pathname})),r=t.pathname),(0,l.loopAsync)(e.length,function(n,a,i){c(e[n],t,r,o,u,function(e,t){e||t?i(e,t):a()})},n)}t.__esModule=!0;var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=s;var l=n(12),d=n(21),p=n(6),h=n(7),v=(r(h),n(3))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.displayName||e.name||"Component"}function u(e,t){var n=t&&t.withRef,r=f.default.createClass({displayName:"WithRouter",mixins:[(0,p.ContextSubscriber)("router")],contextTypes:{router:h.routerShape},propTypes:{router:h.routerShape},getWrappedInstance:function(){return n?void 0:(0,c.default)(!1),this.wrappedInstance},render:function(){var t=this,r=this.props.router||this.context.router;if(!r)return f.default.createElement(e,this.props);var o=r.params,u=r.location,i=r.routes,c=a({},this.props,{router:r,params:o,location:u,routes:i});return n&&(c.ref=function(e){t.wrappedInstance=e}),f.default.createElement(e,c)}});return r.displayName="withRouter("+o(e)+")",r.WrappedComponent=e,(0,d.default)(r,e)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=u;var i=n(1),c=r(i),s=n(2),f=r(s),l=n(53),d=r(l),p=n(13),h=n(14)},function(e,t){"use strict";t.__esModule=!0;t.loopAsync=function(e,t,n){var r=0,o=!1,u=!1,a=!1,i=void 0,c=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o=!0,u?void(i=t):void n.apply(void 0,t)},s=function s(){if(!o&&(a=!0,!u)){for(u=!0;!o&&r<e&&a;)a=!1,t(r++,s,c);return u=!1,o?void n.apply(void 0,i):void(r>=e&&a&&(o=!0,n()))}};s()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.replaceLocation=t.pushLocation=t.startListener=t.getCurrentLocation=t.go=t.getUserConfirmation=void 0;var o=n(16);Object.defineProperty(t,"getUserConfirmation",{enumerable:!0,get:function(){return o.getUserConfirmation}}),Object.defineProperty(t,"go",{enumerable:!0,get:function(){return o.go}});var u=n(5),a=(r(u),n(8)),i=n(11),c=n(28),s=n(4),f="hashchange",l=function(){var e=window.location.href,t=e.indexOf("#");return t===-1?"":e.substring(t+1)},d=function(e){return window.location.hash=e},p=function(e){var t=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,t>=0?t:0)+"#"+e)},h=t.getCurrentLocation=function(e,t){var n=e.decodePath(l()),r=(0,s.getQueryStringValueFromPath)(n,t),o=void 0;r&&(n=(0,s.stripQueryStringValueFromPath)(n,t),o=(0,c.readState)(r));var u=(0,s.parsePath)(n);return u.state=o,(0,a.createLocation)(u,void 0,r)},v=void 0,y=(t.startListener=function(e,t,n){var r=function(){var r=l(),o=t.encodePath(r);if(r!==o)p(o);else{var u=h(t,n);if(v&&u.key&&v.key===u.key)return;v=u,e(u)}},o=l(),u=t.encodePath(o);return o!==u&&p(u),(0,i.addEventListener)(window,f,r),function(){return(0,i.removeEventListener)(window,f,r)}},function(e,t,n,r){var o=e.state,u=e.key,a=t.encodePath((0,s.createPath)(e));void 0!==o&&(a=(0,s.addQueryStringValueToPath)(a,n,u),(0,c.saveState)(u,o)),v=e,r(a)});t.pushLocation=function(e,t,n){return y(e,t,n,function(e){l()!==e&&d(e)})},t.replaceLocation=function(e,t,n){return y(e,t,n,function(e){l()!==e&&p(e)})}},function(e,t,n){"use strict";t.__esModule=!0,t.replaceLocation=t.pushLocation=t.getCurrentLocation=t.go=t.getUserConfirmation=void 0;var r=n(16);Object.defineProperty(t,"getUserConfirmation",{enumerable:!0,get:function(){return r.getUserConfirmation}}),Object.defineProperty(t,"go",{enumerable:!0,get:function(){return r.go}});var o=n(8),u=n(4);t.getCurrentLocation=function(){return(0,o.createLocation)(window.location)},t.pushLocation=function(e){return window.location.href=(0,u.createPath)(e),!1},t.replaceLocation=function(e){return window.location.replace((0,u.createPath)(e)),!1}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(1),i=o(a),c=n(17),s=n(16),f=r(s),l=n(49),d=r(l),p=n(11),h=n(18),v=o(h),y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c.canUseDOM?void 0:(0,i.default)(!1);var t=e.forceRefresh||!(0,p.supportsHistory)(),n=t?d:f,r=n.getUserConfirmation,o=n.getCurrentLocation,a=n.pushLocation,s=n.replaceLocation,l=n.go,h=(0,v.default)(u({getUserConfirmation:r},e,{getCurrentLocation:o,pushLocation:a,replaceLocation:s,go:l})),y=0,m=void 0,g=function(e,t){1===++y&&(m=f.startListener(h.transitionTo));var n=t?h.listenBefore(e):h.listen(e);return function(){n(),0===--y&&m()}},b=function(e){return g(e,!0)},_=function(e){return g(e,!1)};return u({},h,{listenBefore:b,listen:_})};t.default=y},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(5),i=(o(a),n(1)),c=o(i),s=n(17),f=n(11),l=n(48),d=r(l),p=n(18),h=o(p),v="_k",y=function(e){return"/"===e.charAt(0)?e:"/"+e},m={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!"+e},decodePath:function(e){return"!"===e.charAt(0)?e.substring(1):e}},noslash:{encodePath:function(e){return"/"===e.charAt(0)?e.substring(1):e},decodePath:y},slash:{encodePath:y,decodePath:y}},g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s.canUseDOM?void 0:(0,c.default)(!1);var t=e.queryKey,n=e.hashType;"string"!=typeof t&&(t=v),null==n&&(n="slash"),n in m||(n="slash");var r=m[n],o=d.getUserConfirmation,a=function(){return d.getCurrentLocation(r,t)},i=function(e){return d.pushLocation(e,r,t)},l=function(e){return d.replaceLocation(e,r,t)},p=(0,h.default)(u({getUserConfirmation:o},e,{getCurrentLocation:a,pushLocation:i,replaceLocation:l,go:d.go})),y=0,g=void 0,b=function(e,n){1===++y&&(g=d.startListener(p.transitionTo,r,t));var o=n?p.listenBefore(e):p.listen(e);return function(){o(),0===--y&&g()}},_=function(e){return b(e,!0)},O=function(e){return b(e,!1)},P=((0,f.supportsGoWithoutReloadUsingHash)(),function(e){p.go(e)}),R=function(e){return"#"+r.encodePath(p.createHref(e))};return u({},p,{listenBefore:_,listen:O,go:P,createHref:R})};t.default=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(5),a=(r(u),n(1)),i=r(a),c=n(8),s=n(4),f=n(18),l=r(f),d=n(10),p=function(e){return e.filter(function(e){return e.state}).reduce(function(e,t){return e[t.key]=t.state,e},{})},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Array.isArray(e)?e={entries:e}:"string"==typeof e&&(e={entries:[e]});var t=function(){var e=v[y],t=(0,s.createPath)(e),n=void 0,r=void 0;e.key&&(n=e.key,r=b(n));var u=(0,s.parsePath)(t);return(0,c.createLocation)(o({},u,{state:r}),void 0,n)},n=function(e){var t=y+e;return t>=0&&t<v.length},r=function(e){if(e&&n(e)){y+=e;var r=t();f.transitionTo(o({},r,{action:d.POP}))}},u=function(e){y+=1,y<v.length&&v.splice(y),v.push(e),g(e.key,e.state)},a=function(e){v[y]=e,g(e.key,e.state)},f=(0,l.default)(o({},e,{getCurrentLocation:t,pushLocation:u,replaceLocation:a,go:r})),h=e,v=h.entries,y=h.current;"string"==typeof v?v=[v]:Array.isArray(v)||(v=["/"]),v=v.map(function(e){return(0,c.createLocation)(e)}),null==y?y=v.length-1:y>=0&&y<v.length?void 0:(0,i.default)(!1);var m=p(v),g=function(e,t){return m[e]=t},b=function(e){return m[e]};return o({},f,{canGo:n})};t.default=h},function(e,t){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;e.exports=function(e,t,u){if("string"!=typeof t){var a=Object.getOwnPropertyNames(t);o&&(a=a.concat(Object.getOwnPropertySymbols(t)));for(var i=0;i<a.length;++i)if(!(n[a[i]]||r[a[i]]||u&&u[a[i]]))try{e[a[i]]=t[a[i]]}catch(e){}}return e}},function(e,t){/* object-assign (c) Sindre Sorhus @license MIT */ "use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,i,c=n(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var f in r)u.call(r,f)&&(c[f]=r[f]);if(o){i=o(r);for(var l=0;l<i.length;l++)a.call(r,i[l])&&(c[i[l]]=r[i[l]])}}return c}},function(e,t,n){"use strict";function r(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[u(t,e),"[",r,"]"].join(""):[u(t,e),"[",u(r,e),"]=",u(n,e)].join("")};case"bracket":return function(t,n){return null===n?u(t,e):[u(t,e),"[]=",u(n,e)].join("")};default:return function(t,n){return null===n?u(t,e):[u(t,e),"=",u(n,e)].join("")}}}function o(e){var t;switch(e.arrayFormat){case"index":return function(e,n,r){return t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),void(r[e][t[1]]=n)):void(r[e]=n)};case"bracket":return function(e,n,r){return t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t&&void 0!==r[e]?void(r[e]=[].concat(r[e],n)):void(r[e]=n)};default:return function(e,t,n){return void 0===n[e]?void(n[e]=t):void(n[e]=[].concat(n[e],t))}}}function u(e,t){return t.encode?t.strict?i(e):encodeURIComponent(e):e}function a(e){return Array.isArray(e)?e.sort():"object"==typeof e?a(Object.keys(e)).sort(function(e,t){return Number(e)-Number(t)}).map(function(t){return e[t]}):e}var i=n(56),c=n(54);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e,t){t=c({arrayFormat:"none"},t);var n=o(t),r=Object.create(null);return"string"!=typeof e?r:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var t=e.replace(/\+/g," ").split("="),o=t.shift(),u=t.length>0?t.join("="):void 0;u=void 0===u?null:decodeURIComponent(u),n(decodeURIComponent(o),u,r)}),Object.keys(r).sort().reduce(function(e,t){var n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=a(n):e[t]=n,e},Object.create(null))):r},t.stringify=function(e,t){var n={encode:!0,strict:!0,arrayFormat:"none"};t=c(n,t);var o=r(t);return e?Object.keys(e).sort().map(function(n){var r=e[n];if(void 0===r)return"";if(null===r)return u(n,t);if(Array.isArray(r)){var a=[];return r.slice().forEach(function(e){void 0!==e&&a.push(o(n,e,a.length))}),a.join("&")}return u(n,t)+"="+u(r,t)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}}])});
server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js
lbndev/sonarqube
/* * SonarQube * Copyright (C) 2009-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; import Select from 'react-select'; import { translate } from '../../../helpers/l10n'; export default class ProfileRow extends React.Component { static propTypes = { profile: React.PropTypes.object.isRequired, possibleProfiles: React.PropTypes.array.isRequired, onChangeProfile: React.PropTypes.func.isRequired }; state = { loading: false }; shouldComponentUpdate(nextProps, nextState) { return shallowCompare(this, nextProps, nextState); } componentWillUpdate(nextProps) { if (nextProps.profile !== this.props.profile) { this.setState({ loading: false }); } } handleChange(option) { if (this.props.profile.key !== option.value) { this.setState({ loading: true }); this.props.onChangeProfile(this.props.profile.key, option.value); } } renderProfileName(profileOption) { if (profileOption.isDefault) { return ( <span> <strong>{translate('default')}</strong> {': '} {profileOption.label} </span> ); } return profileOption.label; } renderProfileSelect() { const { profile, possibleProfiles } = this.props; const options = possibleProfiles.map(profile => ({ value: profile.key, label: profile.name, isDefault: profile.isDefault })); return ( <Select options={options} valueRenderer={this.renderProfileName} optionRenderer={this.renderProfileName} value={profile.key} clearable={false} style={{ width: 300 }} disabled={this.state.loading} onChange={this.handleChange.bind(this)} /> ); } render() { const { profile } = this.props; return ( <tr data-key={profile.language}> <td className="thin nowrap">{profile.languageName}</td> <td className="thin nowrap">{this.renderProfileSelect()}</td> <td> {this.state.loading && <i className="spinner" />} </td> </tr> ); } }
src/server.js
CSE-437/WebServer
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import 'babel-core/polyfill'; import path from 'path'; import express from 'express'; import React from 'react'; import ReactDOM from 'react-dom/server'; import Router from './routes'; import Html from './components/Html'; import assets from './assets'; import { port } from './config'; import morgan from 'morgan'; import cookieParser from 'cookie-parser'; import bodyParser from 'body-parser'; import session from 'express-session'; var ParseStore = require('connect-parse')(session); import Parse from 'parse/node'; Parse.initialize(process.env.APP_ID || "AnkiHubParse"); Parse.serverURL = process.env.SERVER_URL || "https://ankihubparse2.herokuapp.com/parse"; var io = require('socket.io')(server); const server = global.server = express(); import timeout from 'connect-timeout'; // // Register Node.js middleware // ----------------------------------------------------------------------------- server.use(morgan('dev'));//log every request to console server.use(cookieParser()); //read cookies for authentication server.use(bodyParser.json({limit: '50mb'})); server.use(bodyParser.urlencoded({limit:'50mb',extended: true})); //Connects to the sessions table of our database server.use(session({ secret:process.env.SESSION_SECRET || 'ankilove', store: new ParseStore({ client: Parse }), resave: true, saveUninitialized: true })); server.use(express.static(path.join(__dirname, 'public'))); // // Register API middleware // ----------------------------------------------------------------------------- server.use('/api/content', require('./api/content')); server.use('/api/users', require('./api/users/UserRouter')); server.use('/api/decks', require('./api/decks/DeckRouter')); server.use('/api/cards', require('./api/cards/CardRouter')); server.use('/api/transactions', require('./api/transactions/TransactionRouter')); // // Register server-side rendering middleware // ----------------------------------------------------------------------------- server.get('*', async (req, res, next) => { try { let statusCode = 200; const data = { title: '', description: '', css: '', body: '', entry: assets.main.js }; const css = []; const context = { insertCss: styles => css.push(styles._getCss()), onSetTitle: value => data.title = value, onSetMeta: (key, value) => data[key] = value, onPageNotFound: () => statusCode = 404, }; await Router.dispatch({ path: req.path, query: req.query, context }, (state, component) => { data.body = ReactDOM.renderToString(component); data.css = css.join(''); }); const html = ReactDOM.renderToStaticMarkup(<Html {...data} />); res.status(statusCode).send('<!doctype html>\n' + html); } catch (err) { next(err); } }); //Instantiate Socket IO var onlineUsers = 0;//TODO get rid of when done testing io.sockets.on('connection', function(socket){ onlineUsers++; io.sockets.emit('onlineUsers', {onlineUsers: onlineUsers}); socket.on('disconnect', function(){ onlineUsers--; io.sockets.emit('onlineUsers', {onlineUsers: onlineUsers}); }); }); // // Launch the server // ----------------------------------------------------------------------------- server.listen(port, () => { /* eslint-disable no-console */ console.log(`The server is running at http://localhost:${port}/`); });
node_modules/react-router/es/withRouter.js
NickingMeSpace/questionnaire
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; }; import invariant from 'invariant'; import React from 'react'; import createReactClass from 'create-react-class'; import hoistStatics from 'hoist-non-react-statics'; import { ContextSubscriber } from './ContextUtils'; import { routerShape } from './PropTypes'; function getDisplayName(WrappedComponent) { return WrappedComponent.displayName || WrappedComponent.name || 'Component'; } export default function withRouter(WrappedComponent, options) { var withRef = options && options.withRef; var WithRouter = createReactClass({ displayName: 'WithRouter', mixins: [ContextSubscriber('router')], contextTypes: { router: routerShape }, propTypes: { router: routerShape }, getWrappedInstance: function getWrappedInstance() { !withRef ? process.env.NODE_ENV !== 'production' ? invariant(false, 'To access the wrapped instance, you need to specify ' + '`{ withRef: true }` as the second argument of the withRouter() call.') : invariant(false) : void 0; return this.wrappedInstance; }, render: function render() { var _this = this; var router = this.props.router || this.context.router; if (!router) { return React.createElement(WrappedComponent, this.props); } var params = router.params, location = router.location, routes = router.routes; var props = _extends({}, this.props, { router: router, params: params, location: location, routes: routes }); if (withRef) { props.ref = function (c) { _this.wrappedInstance = c; }; } return React.createElement(WrappedComponent, props); } }); WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')'; WithRouter.WrappedComponent = WrappedComponent; return hoistStatics(WithRouter, WrappedComponent); }
todomvc/test/components/Header.spec.js
samlatif-uk/redux-tdd-hw
import expect from 'expect' import React from 'react' import TestUtils from 'react-addons-test-utils' import Header from '../../components/Header' import TodoTextInput from '../../components/TodoTextInput' function setup() { const props = { addTodo: expect.createSpy() } const renderer = TestUtils.createRenderer() renderer.render(<Header {...props} />) const output = renderer.getRenderOutput() return { props: props, output: output, renderer: renderer } } describe('components', () => { describe('Header', () => { it('should render correctly', () => { const { output } = setup() expect(output.type).toBe('header') expect(output.props.className).toBe('header') const [ h1, input ] = output.props.children expect(h1.type).toBe('h1') expect(h1.props.children).toBe('todos') expect(input.type).toBe(TodoTextInput) expect(input.props.newTodo).toBe(true) expect(input.props.placeholder).toBe('What needs to be done?') }) it('should call addTodo if length of text is greater than 0', () => { const { output, props } = setup() const input = output.props.children[1] input.props.onSave('') expect(props.addTodo.calls.length).toBe(0) input.props.onSave('Use Redux') expect(props.addTodo.calls.length).toBe(1) }) }) })
src/Fade.js
pandoraui/react-bootstrap
import React from 'react'; import Transition from 'react-overlays/lib/Transition'; import CustomPropTypes from './utils/CustomPropTypes'; import deprecationWarning from './utils/deprecationWarning'; class Fade extends React.Component { render() { let timeout = this.props.timeout || this.props.duration; return ( <Transition {...this.props} timeout={timeout} className="fade" enteredClassName="in" enteringClassName="in" > {this.props.children} </Transition> ); } } // Explicitly copied from Transition for doc generation. // TODO: Remove duplication once #977 is resolved. Fade.propTypes = { /** * Show the component; triggers the fade in or fade out animation */ in: React.PropTypes.bool, /** * Unmount the component (remove it from the DOM) when it is faded out */ unmountOnExit: React.PropTypes.bool, /** * Run the fade in animation when the component mounts, if it is initially * shown */ transitionAppear: React.PropTypes.bool, /** * Duration of the fade animation in milliseconds, to ensure that finishing * callbacks are fired even if the original browser transition end events are * canceled */ timeout: React.PropTypes.number, /** * duration * @private */ duration: CustomPropTypes.all([ React.PropTypes.number, (props)=> { if (props.duration != null) { deprecationWarning('Fade `duration`', 'the `timeout` prop'); } return null; } ]), /** * Callback fired before the component fades in */ onEnter: React.PropTypes.func, /** * Callback fired after the component starts to fade in */ onEntering: React.PropTypes.func, /** * Callback fired after the has component faded in */ onEntered: React.PropTypes.func, /** * Callback fired before the component fades out */ onExit: React.PropTypes.func, /** * Callback fired after the component starts to fade out */ onExiting: React.PropTypes.func, /** * Callback fired after the component has faded out */ onExited: React.PropTypes.func }; Fade.defaultProps = { in: false, timeout: 300, unmountOnExit: false, transitionAppear: false }; export default Fade;
packages/material-ui-icons/src/SentimentVerySatisfiedRounded.js
Kagami/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M8.88 9.94l.53.53c.29.29.77.29 1.06 0 .29-.29.29-.77 0-1.06l-.88-.88a.9959.9959 0 0 0-1.41 0l-.89.88c-.29.29-.29.77 0 1.06.29.29.77.29 1.06 0l.53-.53zM12 17.5c2.03 0 3.8-1.11 4.75-2.75.19-.33-.05-.75-.44-.75H7.69c-.38 0-.63.42-.44.75.95 1.64 2.72 2.75 4.75 2.75zM13.53 10.47c.29.29.77.29 1.06 0l.53-.53.53.53c.29.29.77.29 1.06 0 .29-.29.29-.77 0-1.06l-.88-.88a.9959.9959 0 0 0-1.41 0l-.88.88c-.3.29-.3.77-.01 1.06z" /><path d="M11.99 2C6.47 2 2 6.47 2 12s4.47 10 9.99 10S22 17.53 22 12 17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" /></g></React.Fragment> , 'SentimentVerySatisfiedRounded');
src/App.spec.js
SteveHoggNZ/react-transform-boilerplate-tape-tests
import React from 'react'; import ReactDOM from 'react-dom'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import sd from 'skin-deep'; import $ from 'jquery'; import { render } from 'react-dom'; import { App, Counter } from './App'; import { NICE, SUPER_NICE } from './colors'; import test from 'tape'; test('App is choice-as', (assert) => { let expected, actual; const counters = [ {increment: 20, color: NICE}, {increment: 30, color: SUPER_NICE} ]; const shallowRenderer = ReactTestUtils.createRenderer(); let component = shallowRenderer.render(<App counters={counters}/>); let node = ReactDOM.findDOMNode(component); expected = 'Counter (10): 10'; setTimeout(() => { actual = $(node).find('h1:first').text(); assert.equal(actual, expected, `Expected '${expected}' and got '${actual}'`); shallowRenderer.unmount(); assert.end(); }, 1000); }); test('Component is choice-as', (assert) => { let expected, actual; let increment = 10, color = NICE; const shallowRenderer = ReactTestUtils.createRenderer(); let component = shallowRenderer.render(<Counter increment={increment} color={color}/>); let node = ReactDOM.findDOMNode(component); expected = 'Counter (10): 1'; setTimeout(() => { actual = $(node).find('h1:first').text(); assert.equal(actual, expected, `Expected '${expected}' and got '${actual}'`); shallowRenderer.unmount(); assert.end(); }, 1000); }); test('Counter has correct values', (assert) => { assert.equal(1,1,'OK'); assert.end(); //let vdom, instance, expected, actual; // //// TODO ////assert.plan(3); // //let counters = [ // {increment: 20, color: NICE}, // {increment: 30, color: SUPER_NICE} //]; // //const tree = sd.shallowRender(React.createElement(App, {counters: counters})); // //instance = tree.getMountedInstance(); //vdom = tree.getRenderOutput(); // //vdom.props.children.filter((child) => { // console.warn(child); // console.warn(TestUtils.isElementOfType(child, Counter)); //}); // //sd.shallowRender.unmount(); //const temp = vdom.props.children[0]; //const temp2 = vdom.props.children[1]; //console.warn(temp.props); //console.warn(temp2.props); // //console.error(instance); //assert.equal(1,1,'OK'); //assert.end(); // //var shallowRenderer = TestUtils.createRenderer(); //shallowRenderer.render(<App/>); //var component2 = shallowRenderer.getRenderOutput(); // //let expected = 'MyApp'; //let actual = component2.props.className; //assert.equal(actual, expected, // `Expected '${expected}' and got '${actual}'`); // //var component = TestUtils.renderIntoDocument(<App counters={counters}/>); // //// Find the DOM element for the created component. //var node = ReactDOM.findDOMNode(component); // //expected = 'Counter (10): 0'; //actual = $(node).find('h1:first').text(); // //assert.equal(actual, expected, // `Expected '${expected}' and got '${actual}'`); // //expected = 'Counter (10): 10'; //setTimeout(() => { // actual = $(node).find('h1:first').text(); // // assert.equal(actual, expected, // `Expected '${expected}' and got '${actual}'`); // // //ReactDOM.unmountComponentAtNode(component); //}, 1000); });
app/components/dataSet/DataSetValuesChart.js
sheldhur/Vector
// @flow import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { NoDataAlert, ProgressAlert } from '../widgets/ChartAlert'; import LineChart from '../chart/LineChart'; import TitleCurrentTime from '../main/TitleCurrentTime'; import * as mainActions from '../../actions/main'; import * as dataSetActions from '../../actions/dataSet'; import * as app from '../../constants/app'; import * as prepareData from '../../utils/prepareData'; class DataSetValuesChart extends Component { prepareDataForChart = (dataSet, dataSetValue) => { const colorGroup = app.DATA_SET_COLOR; if (dataSet === undefined) { return []; } const chartGroups = {}; if (dataSet && dataSet.status === app.DATASET_ENABLED) { const dataSetLine = { name: dataSet.name, si: dataSet.si, format: '%(name)s: %(y).5g %(si)s', style: { stroke: colorGroup[1 % colorGroup.length], strokeWidth: 1, ...dataSet.style }, points: dataSetValue ? dataSetValue.map((dataSetValue) => ({ x: dataSetValue.time, y: !dataSet.badValue || Math.abs(dataSetValue.value) < dataSet.badValue ? dataSetValue.value : null })) : [] }; if (chartGroups[dataSet.axisGroup] === undefined) { chartGroups[dataSet.axisGroup] = { si: null, lines: [], }; } chartGroups[dataSet.axisGroup].lines.push(dataSetLine); chartGroups[dataSet.axisGroup].si = chartGroups[dataSet.axisGroup].si || dataSetLine.si; } return Object.values(chartGroups); }; render() { const { dataSetId, isLoading, isError, progress, dataSets, dataSetValues } = this.props; const chartLines = prepareData.dataSetsForChart(dataSets, dataSetValues, (dataSet) => dataSet.id == dataSetId); let container = null; if (isLoading || isError) { container = (<ProgressAlert text={progress.title} percent={progress.value} error={isError} onContextMenu={this.handlerContextMenu} />); } if (!container) { container = ( <div style={{ width: this.props.width, height: this.props.height }} onContextMenu={this.handlerContextMenu}> <LineChart width={this.props.width} height={this.props.height} data={chartLines} tooltipDelay={100} antiAliasing={this.props.antiAliasing} emptyMessage={<NoDataAlert onContextMenu={this.handlerContextMenu} />} > <TitleCurrentTime /> </LineChart> </div> ); } return container; } } DataSetValuesChart.propTypes = { width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), }; DataSetValuesChart.defaultProps = { width: '100%', height: '100%', }; function mapStateToProps(state) { return { progress: state.dataSet.progress, isLoading: state.dataSet.isLoading, isError: state.dataSet.isError, dataSets: state.dataSet.dataSets, dataSetValues: state.dataSet.dataSetValues, antiAliasing: state.main.settings.appAntiAliasing, }; } function mapDispatchToProps(dispatch) { return { mainActions: bindActionCreators(mainActions, dispatch), dataSetActions: bindActionCreators(dataSetActions, dispatch) }; } export default connect(mapStateToProps, mapDispatchToProps)(DataSetValuesChart);
fields/types/number/NumberField.js
codevlabs/keystone
import React from 'react'; import Field from '../Field'; import { FormInput } from 'elemental'; module.exports = Field.create({ displayName: 'NumberField', valueChanged (event) { var newValue = event.target.value; if (/^-?\d*\.?\d*$/.test(newValue)) { this.props.onChange({ path: this.props.path, value: newValue, }); } }, renderField () { return ( <FormInput name={this.props.path} ref="focusTarget" value={this.props.value} onChange={this.valueChanged} autoComplete="off" /> ); } });
fields/components/columns/InvalidColumn.js
tony2cssc/keystone
import React from 'react'; import ItemsTableCell from '../../../admin/client/components/ItemsTable/ItemsTableCell'; import ItemsTableValue from '../../../admin/client/components/ItemsTable/ItemsTableValue'; var InvalidColumn = React.createClass({ displayName: 'InvalidColumn', propTypes: { col: React.PropTypes.object, }, renderValue () { return ( <ItemsTableValue field={this.props.col.type}> (Invalid Type: {this.props.col.type}) </ItemsTableValue> ); }, render () { return ( <ItemsTableCell> {this.renderValue()} </ItemsTableCell> ); }, }); module.exports = InvalidColumn;
ajax/libs/react-localstorage/0.2.5/react-localstorage.js
cdnjs/cdnjs
'use strict'; var React = require('react'); var invariant = require('react/lib/invariant'); var warn = require('react/lib/warning'); var hasLocalStorage = 'localStorage' in global; var ls, testKey; if (hasLocalStorage) { testKey = 'react-localstorage.mixin.test-key'; try { // Access to global `localStorage` property must be guarded as it // fails under iOS private session mode. ls = global.localStorage; ls.setItem(testKey, 'foo'); ls.removeItem(testKey); } catch (e) { hasLocalStorage = false; } } // Warn if localStorage cannot be found or accessed. if (process.browser) { warn( hasLocalStorage, 'localStorage not found. Component state will not be stored to localStorage.' ); } var Mixin = module.exports = { /** * Error checking. On update, ensure that the last state stored in localStorage is equal * to the state on the component. We skip the check the first time around as state is left * alone until mount to keep server rendering working. * * If it is not consistent, we know that someone else is modifying localStorage out from under us, so we throw * an error. * * There are a lot of ways this can happen, so it is worth throwing the error. */ componentDidUpdate: function(prevProps, prevState) { if (!hasLocalStorage || !this.__stateLoadedFromLS) return; var key = getLocalStorageKey(this); var prevStoredState = ls.getItem(key); if (prevStoredState && process.env.NODE_ENV !== "production") { invariant( prevStoredState === JSON.stringify(getSyncState(this, prevState)), 'While component ' + getDisplayName(this) + ' was saving state to localStorage, ' + 'the localStorage entry was modified by another actor. This can happen when multiple ' + 'components are using the same localStorage key. Set the property `localStorageKey` ' + 'on ' + getDisplayName(this) + '.' ); } ls.setItem(key, JSON.stringify(getSyncState(this, this.state))); }, /** * Load data. * This seems odd to do this on componentDidMount, but it prevents server checksum errors. * This is because the server has no way to know what is in your localStorage. So instead * of breaking the checksum and causing a full rerender, we instead change the component after mount * for an efficient diff. */ componentDidMount: function () { if (!hasLocalStorage) return; var me = this; loadStateFromLocalStorage(this, function() { // After setting state, mirror back to localstorage. // This prevents invariants if the developer has changed the initial state of the component. ls.setItem(getLocalStorageKey(me), JSON.stringify(getSyncState(me, me.state))); }); } }; function loadStateFromLocalStorage(component, cb) { if (!ls) return; var key = getLocalStorageKey(component); var settingState = false; try { var storedState = JSON.parse(ls.getItem(key)); if (storedState) { settingState = true; component.setState(storedState, done); } } catch(e) { if (console) console.warn("Unable to load state for", getDisplayName(component), "from localStorage."); } // If we didn't set state, run the callback right away. if (!settingState) done(); function done() { // Flag this component as loaded. component.__stateLoadedFromLS = true; cb(); } } function getDisplayName(component) { // at least, we cannot get displayname // via this.displayname in react 0.12 return component.displayName || component.constructor.displayName; } function getLocalStorageKey(component) { if (component.getLocalStorageKey) { return component.getLocalStorageKey(); } return component.props.localStorageKey || getDisplayName(component) || 'react-localstorage'; } function getStateFilterKeys(component) { if (component.getStateFilterKeys) { return typeof component.getStateFilterKeys() === 'string' ? [component.getStateFilterKeys()] : component.getStateFilterKeys(); } return typeof component.props.stateFilterKeys === 'string' ? [component.props.stateFilterKeys] : component.props.stateFilterKeys; } /** * Filters state to only save keys defined in stateFilterKeys. * If stateFilterKeys is not set, returns full state. */ function getSyncState(component, state) { var stateFilterKeys = getStateFilterKeys(component); if (!stateFilterKeys) return state; var result = {}; stateFilterKeys.forEach(function(sk) { for (var key in state) { if (state.hasOwnProperty(key) && sk === key) result[key] = state[key]; } }); return result; }
src/shared/SimpleAccordion/SimpleAccordion.js
AusDTO/dto-digitalmarketplace-frontend
import React from 'react'; import Icon from '../Icon'; import styles from './SimpleAccordion.css'; // eslint-disable-line no-unused-vars const SimpleAccordion = ({title, children, show = true}) => { if (!show) { return null; } return ( <details styleName="styles.details"> <summary><span>{title}</span> <Icon value="chevron-accordion" size={10}/></summary> <div>{children}</div> </details> ) }; export default SimpleAccordion;
src/components/Footer/Footer.js
max-gram/react-saga-universal
import React from 'react' import PropTypes from 'prop-types' import css from './Footer.css' const Footer = (props) => { return ( <footer className={css.mainFooter}> <div> Fork me on <a href="https://github.com/max-gram/react-saga-universal">Github</a> </div> </footer> ) } Footer.propTypes = { // propName: PropTypes.string.isRequired, } export default Footer
src/components/Viewer/components/Controls/index.js
jacobwindsor/pathway-presenter
import React from 'react'; import IconButton from 'material-ui/IconButton'; import ArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; import ArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; import NavigationFullscreen from 'material-ui/svg-icons/navigation/fullscreen'; import NavigationFullscreenExit from 'material-ui/svg-icons/navigation/fullscreen-exit'; import PropTypes from 'prop-types'; import './index.css'; const Controls = props => { return ( <div className="viewer-controls"> <div className="left"> <IconButton onTouchTap={props.handleToggleFullScreen} className="fullscreen" > {props.isFullScreen ? <NavigationFullscreen /> : <NavigationFullscreenExit />} </IconButton> </div> <div className="right"> <IconButton className="backward" onTouchTap={props.onBackward}> <ArrowBack /> </IconButton> <IconButton className="forward" onTouchTap={props.onForward}> <ArrowForward /> </IconButton> </div> </div> ); }; Controls.propTypes = { onBackward: PropTypes.func.isRequired, onForward: PropTypes.func.isRequired, handleToggleFullScreen: PropTypes.func.isRequired, isFullScreen: PropTypes.bool.isRequired }; export default Controls;
frontend/modules/list/components/ListHeader.js
RyanNoelk/OpenEats
"use strict"; import React from 'react' import classNames from 'classnames' import PropTypes from 'prop-types' import { injectIntl, defineMessages } from 'react-intl' import { ENTER_KEY, ESCAPE_KEY } from '../constants/ListStatus' class ListHeader extends React.Component { constructor(props) { super(props); this.state = { title: this.props.list.title || '', editing: false, }; } componentWillReceiveProps(nextProps) { this.setState({ title: nextProps.list.title, editing: false, }); } handleDelete = (message) => { if (confirm(message)) { this.props.removeList(this.props.list.id) } }; handleEdit = () => { this.setState({editing: true}); }; handleChange = (event) => { if (this.state.editing) { this.setState({title: event.target.value}); } }; handleKeyDown = (event) => { if (event.which === ESCAPE_KEY) { this.setState({ title: this.props.list.title, editing: false, }); } else if (event.which === ENTER_KEY) { this.handleSubmit(event); } }; handleSubmit = () => { let val = this.state.title.trim(); if (val) { this.props.updateList(this.props.list.id, val); this.setState({ title: val, editing: false, }); } else { this.setState({ title: this.props.list.title, editing: false, }); } }; render() { const { formatMessage } = this.props.intl; const messages = defineMessages({ confirmDelete: { id: 'list_header.confirm_delete', description: 'Are you sure you want to delete this list?', defaultMessage: 'Are you sure you want to delete this list?', }, }); return ( <div className={classNames({ editing: this.state.editing, "list-header": true })}> <div className="view"> <label onDoubleClick={ this.handleEdit }> { this.state.title } </label> <button className="destroy" onClick={() => this.handleDelete(formatMessage(messages.confirmDelete)) } /> </div> <input ref="editField" className="edit" value={ this.state.title } onBlur={ this.handleSubmit } onChange={ this.handleChange } onKeyDown={ this.handleKeyDown } /> </div> ) } } ListHeader.propTypes = { list: PropTypes.shape({ id: PropTypes.number.isRequired, title: PropTypes.string.isRequired, item_count: PropTypes.number.isRequired }).isRequired, removeList: PropTypes.func.isRequired, updateList: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; export default injectIntl(ListHeader)
ajax/libs/react-bootstrap-table/3.3.8/react-bootstrap-table.min.js
wout/cdnjs
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactBootstrapTable=t(require("react"),require("react-dom")):e.ReactBootstrapTable=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.SizePerPageDropDown=t.ButtonGroup=t.SearchField=t.ClearSearchButton=t.ExportCSVButton=t.ShowSelectedOnlyButton=t.DeleteButton=t.InsertButton=t.InsertModalFooter=t.InsertModalBody=t.InsertModalHeader=t.TableHeaderColumn=t.BootstrapTable=void 0;var n=r(184),a=o(n),s=r(193),i=o(s),l=r(63),u=o(l),p=r(61),c=o(p),f=r(62),d=o(f),h=r(60),_=o(h),y=r(58),b=o(y),v=r(59),T=o(v),m=r(65),E=o(m),g=r(57),O=o(g),C=r(64),P=o(C),w=r(204),R=o(w),S=r(56),A=o(S);"undefined"!=typeof window&&(window.BootstrapTable=a.default,window.TableHeaderColumn=i.default,window.InsertModalHeader=u.default,window.InsertModalBody=c.default,window.InsertModalFooter=d.default,window.InsertButton=_.default,window.DeleteButton=b.default,window.ShowSelectedOnlyButton=E.default,window.ExportCSVButton=T.default,window.ClearSearchButton=O.default,window.SearchField=P.default,window.ButtonGroup=R.default,window.SizePerPageDropDown=A.default),t.BootstrapTable=a.default,t.TableHeaderColumn=i.default,t.InsertModalHeader=u.default,t.InsertModalBody=c.default,t.InsertModalFooter=d.default,t.InsertButton=_.default,t.DeleteButton=b.default,t.ShowSelectedOnlyButton=E.default,t.ExportCSVButton=T.default,t.ClearSearchButton=O.default,t.SearchField=P.default,t.ButtonGroup=R.default,t.SizePerPageDropDown=A.default;(function(){"undefined"==typeof __REACT_HOT_LOADER__})()},function(t,r){t.exports=e},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={SORT_DESC:"desc",SORT_ASC:"asc",AWAIT_BEFORE_CELL_EDIT:1,SIZE_PER_PAGE:10,NEXT_PAGE:">",NEXT_PAGE_TITLE:"next page",LAST_PAGE:">>",LAST_PAGE_TITLE:"last page",PRE_PAGE:"<",PRE_PAGE_TITLE:"previous page",FIRST_PAGE:"<<",FIRST_PAGE_TITLE:"first page",PAGE_START_INDEX:1,ROW_SELECT_BG_COLOR:"",ROW_SELECT_NONE:"none",ROW_SELECT_SINGLE:"radio",ROW_SELECT_MULTI:"checkbox",CELL_EDIT_NONE:"none",CELL_EDIT_CLICK:"click",CELL_EDIT_DBCLICK:"dbclick",SIZE_PER_PAGE_LIST:[10,25,30,50],PAGINATION_SIZE:5,PAGINATION_POS_TOP:"top",PAGINATION_POS_BOTTOM:"bottom",PAGINATION_POS_BOTH:"both",NO_DATA_TEXT:"There is no data to display",SHOW_ONLY_SELECT:"Show Selected Only",SHOW_ALL:"Show All",EXPORT_CSV_TEXT:"Export to CSV",INSERT_BTN_TEXT:"New",DELETE_BTN_TEXT:"Delete",SAVE_BTN_TEXT:"Save",CLOSE_BTN_TEXT:"Close",FILTER_DELAY:500,SCROLL_TOP:"Top",SCROLL_BOTTOM:"Bottom",FILTER_TYPE:{TEXT:"TextFilter",REGEX:"RegexFilter",SELECT:"SelectFilter",NUMBER:"NumberFilter",DATE:"DateFilter",CUSTOM:"CustomFilter"},FILTER_COND_EQ:"eq",FILTER_COND_LIKE:"like",EXPAND_BY_ROW:"row",EXPAND_BY_COL:"column",CANCEL_TOASTR:"Pressed ESC can cancel",REMOTE_SORT:"sort",REMOTE_PAGE:"pagination",REMOTE_CELL_EDIT:"cellEdit",REMOTE_INSERT_ROW:"insertRow",REMOTE_DROP_ROW:"dropRow",REMOTE_FILTER:"filter",REMOTE_SEARCH:"search",REMOTE_EXPORT_CSV:"exportCSV"};r.REMOTE={},r.REMOTE[r.REMOTE_SORT]=!1,r.REMOTE[r.REMOTE_PAGE]=!1,r.REMOTE[r.REMOTE_CELL_EDIT]=!1,r.REMOTE[r.REMOTE_INSERT_ROW]=!1,r.REMOTE[r.REMOTE_DROP_ROW]=!1,r.REMOTE[r.REMOTE_FILTER]=!1,r.REMOTE[r.REMOTE_SEARCH]=!1,r.REMOTE[r.REMOTE_EXPORT_CSV]=!1;var o=r;t.default=o;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(r,"CONST_VAR","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Const.js"),__REACT_HOT_LOADER__.register(o,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Const.js"))})()},function(e,t,r){var o,n;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var n=typeof o;if("string"===n||"number"===n)e.push(o);else if(Array.isArray(o))e.push(r.apply(null,o));else if("object"===n)for(var s in o)a.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(o=[],n=function(){return r}.apply(t,o),!(void 0!==n&&(e.exports=n)))}()},function(e,t,r){var o=r(39),n="object"==typeof self&&self&&self.Object===Object&&self,a=o||n||Function("return this")();e.exports=a},function(e,t){var r=Array.isArray;e.exports=r},function(e,r){e.exports=t},function(e,t,r){function o(e,t){var r=a(e,t);return n(r)?r:void 0}var n=r(94),a=r(120);e.exports=o},function(e,t,r){function o(e){return null==e?void 0===e?l:i:(e=Object(e),u&&u in e?a(e):s(e))}var n=r(10),a=r(118),s=r(149),i="[object Null]",l="[object Undefined]",u=n?n.toStringTag:void 0;e.exports=o},function(e,t){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},function(e,t,r){var o=r(4),n=o.Symbol;e.exports=n},function(e,t,r){function o(e,t,r,o){var s=!r;r||(r={});for(var i=-1,l=t.length;++i<l;){var u=t[i],p=o?o(r[u],e[u],u,r,e):void 0;void 0===p&&(p=e[u]),s?a(r,u,p):n(r,u,p)}return r}var n=r(35),a=r(36);e.exports=o},function(e,t){function r(e){return null!=e&&"object"==typeof e}e.exports=r},function(e,t,r){function o(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}var n=r(134),a=r(135),s=r(136),i=r(137),l=r(138);o.prototype.clear=n,o.prototype.delete=a,o.prototype.get=s,o.prototype.has=i,o.prototype.set=l,e.exports=o},function(e,t,r){function o(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}var n=r(45);e.exports=o},function(e,t,r){function o(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}var n=r(132);e.exports=o},function(e,t,r){var o=r(7),n=o(Object,"create");e.exports=n},function(e,t,r){function o(e){return"symbol"==typeof e||a(e)&&n(e)==s}var n=r(8),a=r(12),s="[object Symbol]";e.exports=o},function(e,t,r){function o(e){return s(e)?n(e):a(e)}var n=r(33),a=r(96),s=r(28);e.exports=o},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),a=o(n),s=r(2),i=o(s),l=r(3),u=o(l),p={renderReactSortCaret:function(e){var t=(0,u.default)("order",{dropup:e===i.default.SORT_ASC});return a.default.createElement("span",{className:t},a.default.createElement("span",{className:"caret",style:{margin:"10px 5px"}}))},getScrollBarWidth:function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var r=e.getBoundingClientRect().width;t.style.overflow="scroll";var o=e.getBoundingClientRect().width;return r===o&&(o=t.clientWidth),document.body.removeChild(t),r-o},canUseDOM:function(){return"undefined"!=typeof window&&"undefined"!=typeof window.document},getNormalizedPage:function(e,t){e=this.getFirstPage(e),void 0===t&&(t=e);var r=Math.abs(i.default.PAGE_START_INDEX-e);return t+r},getFirstPage:function(e){return void 0!==e?e:i.default.PAGE_START_INDEX},renderColGroup:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=null,n=null,s=t.mode===i.default.ROW_SELECT_SINGLE||t.mode===i.default.ROW_SELECT_MULTI;if(s){var l={width:t.columnWidth||"30px",minWidth:t.columnWidth||"30px"};t.hideSelectColumn||(o=a.default.createElement("col",{key:"select-col",style:l}))}if(r.expandColumnVisible){var u={width:r.columnWidth||30,minWidth:r.columnWidth||30};n=a.default.createElement("col",{key:"expand-col",style:u})}var p=e.map(function(e,t){var r={display:e.hidden?"none":null};if(e.width){var o=isNaN(e.width)?e.width:e.width+"px";r.width=o,r.minWidth=o}return a.default.createElement("col",{style:r,key:t,className:e.className})});return a.default.createElement("colgroup",null,r.expandColumnVisible&&r.expandColumnBeforeSelectColumn&&n,o,r.expandColumnVisible&&!r.expandColumnBeforeSelectColumn&&n,p)}};t.default=p;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(p,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/util.js")})()},function(e,t,r){var o=r(7),n=r(4),a=o(n,"Map");e.exports=a},function(e,t){function r(e,t){for(var r=-1,o=null==e?0:e.length,n=Array(o);++r<o;)n[r]=t(e[r],r,e);return n}e.exports=r},function(e,t){function r(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}e.exports=r},function(e,t,r){function o(e,t){return n(e)?e:a(e,t)?[e]:s(i(e))}var n=r(5),a=r(131),s=r(161),i=r(175);e.exports=o},function(e,t,r){function o(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}var n=r(78);e.exports=o},function(e,t,r){var o=r(27),n=r(51),a=Object.getOwnPropertySymbols,s=a?o(a,Object):n;e.exports=s},function(e,t){function r(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||o;return e===r}var o=Object.prototype;e.exports=r},function(e,t){function r(e,t){return function(r){return e(t(r))}}e.exports=r},function(e,t,r){function o(e){return null!=e&&a(e.length)&&!n(e)}var n=r(48),a=r(49);e.exports=o},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function n(e){if(p===setTimeout)return setTimeout(e,0);if((p===r||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function a(e){if(c===clearTimeout)return clearTimeout(e);if((c===o||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function s(){_&&d&&(_=!1,d.length?h=d.concat(h):y=-1,h.length&&i())}function i(){if(!_){var e=n(s);_=!0;for(var t=h.length;t;){for(d=h,h=[];++y<t;)d&&d[y].run();y=-1,t=h.length}d=null,_=!1,a(e)}}function l(e,t){this.fun=e,this.array=t}function u(){}var p,c,f=e.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:r}catch(e){p=r}try{c="function"==typeof clearTimeout?clearTimeout:o}catch(e){c=o}}();var d,h=[],_=!1,y=-1;f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new l(e,t)),1!==h.length||_||n(i)},l.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.jQuery=t.animation=void 0;var a=r(1),s=o(a),i=r(52),l=o(i),u=r(3),p=o(u),c=r(69),f=o(c),d=r(70),h=o(d),_={displayName:"ToastMessage",getDefaultProps:function(){var e={error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"};return{className:"toast",iconClassNames:e,titleClassName:"toast-title",messageClassName:"toast-message",tapToDismiss:!0,closeButton:!1}},handleOnClick:function(e){this.props.handleOnClick(e),this.props.tapToDismiss&&this.hideToast(!0)},_handle_close_button_click:function(e){e.stopPropagation(),this.hideToast(!0)},_handle_remove:function(){this.props.handleRemove(this.props.toastId)},_render_close_button:function(){return!!this.props.closeButton&&s.default.createElement("button",{className:"toast-close-button",role:"button",onClick:this._handle_close_button_click,dangerouslySetInnerHTML:{__html:"&times;"}})},_render_title_element:function(){return!!this.props.title&&s.default.createElement("div",{className:this.props.titleClassName},this.props.title)},_render_message_element:function(){return!!this.props.message&&s.default.createElement("div",{className:this.props.messageClassName},this.props.message)},render:function(){var e=this.props.iconClassName||this.props.iconClassNames[this.props.type];return s.default.createElement("div",{className:(0,p.default)(this.props.className,e),style:this.props.style,onClick:this.handleOnClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},this._render_close_button(),this._render_title_element(),this._render_message_element())}},y=t.animation=s.default.createClass((0,l.default)(_,{displayName:{$set:"ToastMessage.animation"},mixins:{$set:[f.default]}})),b=t.jQuery=s.default.createClass((0,l.default)(_,{displayName:{$set:"ToastMessage.jQuery"},mixins:{$set:[h.default]}}));_.handleMouseEnter=n,_.handleMouseLeave=n,_.hideToast=n;var v=s.default.createClass(_);v.animation=y,v.jQuery=b,t.default=v},function(e,t,r){function o(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}var n=r(139),a=r(140),s=r(141),i=r(142),l=r(143);o.prototype.clear=n,o.prototype.delete=a,o.prototype.get=s,o.prototype.has=i,o.prototype.set=l,e.exports=o},function(e,t,r){function o(e,t){var r=s(e),o=!r&&a(e),p=!r&&!o&&i(e),f=!r&&!o&&!p&&u(e),d=r||o||p||f,h=d?n(e.length,String):[],_=h.length;for(var y in e)!t&&!c.call(e,y)||d&&("length"==y||p&&("offset"==y||"parent"==y)||f&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||l(y,_))||h.push(y);return h}var n=r(100),a=r(46),s=r(5),i=r(47),l=r(130),u=r(167),p=Object.prototype,c=p.hasOwnProperty;e.exports=o},function(e,t){function r(e,t,r,o){var n=-1,a=null==e?0:e.length;for(o&&a&&(r=e[++n]);++n<a;)r=t(r,e[n],n,e);return r}e.exports=r},function(e,t,r){function o(e,t,r){var o=e[t];i.call(e,t)&&a(o,r)&&(void 0!==r||t in e)||n(e,t,r)}var n=r(36),a=r(45),s=Object.prototype,i=s.hasOwnProperty;e.exports=o},function(e,t,r){function o(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var n=r(38);e.exports=o},function(e,t,r){function o(e,t,r){var o=t(e);return a(e)?o:n(o,r(e))}var n=r(22),a=r(5);e.exports=o},function(e,t,r){var o=r(7),n=function(){try{var e=o(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=n},function(e,t){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(t,function(){return this}())},function(e,t,r){function o(e){return n(e,s,a)}var n=r(37),a=r(42),s=r(50);e.exports=o},function(e,t,r){var o=r(27),n=o(Object.getPrototypeOf,Object);e.exports=n},function(e,t,r){var o=r(22),n=r(41),a=r(25),s=r(51),i=Object.getOwnPropertySymbols,l=i?function(e){for(var t=[];e;)o(t,a(e)),e=n(e);return t}:s;e.exports=l},function(e,t,r){function o(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-a?"-0":t}var n=r(17),a=1/0;e.exports=o},function(e,t){function r(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var o=Function.prototype,n=o.toString;e.exports=r},function(e,t){function r(e,t){return e===t||e!==e&&t!==t}e.exports=r},function(e,t,r){var o=r(92),n=r(12),a=Object.prototype,s=a.hasOwnProperty,i=a.propertyIsEnumerable,l=o(function(){return arguments}())?o:function(e){return n(e)&&s.call(e,"callee")&&!i.call(e,"callee")};e.exports=l},function(e,t,r){(function(e){var o=r(4),n=r(171),a="object"==typeof t&&t&&!t.nodeType&&t,s=a&&"object"==typeof e&&e&&!e.nodeType&&e,i=s&&s.exports===a,l=i?o.Buffer:void 0,u=l?l.isBuffer:void 0,p=u||n;e.exports=p}).call(t,r(29)(e))},function(e,t,r){function o(e){if(!a(e))return!1;var t=n(e);return t==i||t==l||t==s||t==u}var n=r(8),a=r(9),s="[object AsyncFunction]",i="[object Function]",l="[object GeneratorFunction]",u="[object Proxy]";e.exports=o},function(e,t){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}var o=9007199254740991;e.exports=r},function(e,t,r){function o(e){return s(e)?n(e,!0):a(e)}var n=r(33),a=r(97),s=r(28);e.exports=o},function(e,t){function r(){return[]}e.exports=r},function(e,t,r){e.exports=r(180)},function(e,t){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=r(1),i=o(s),l=function(e,t,r,o,s,l){if(e===!0||e===!1&&l||"string"==typeof e){var u=e?"text":e;return i.default.createElement("input",a({},t,{type:u,defaultValue:s,className:(o||"")+" form-control editor edit-text"}))}if(!e){var p=e?"text":e;return i.default.createElement("input",a({},t,{type:p,defaultValue:s,disabled:"disabled",className:(o||"")+" form-control editor edit-text"}))}if(e&&(void 0===e.type||null===e.type||""===e.type.trim())){var c=e?"text":e;return i.default.createElement("input",a({},t,{type:c,defaultValue:s,className:(o||"")+" form-control editor edit-text"}))}if(e.type)if(e.style&&(t.style=e.style),t.className=(o||"")+" form-control editor edit-"+e.type+(e.className?" "+e.className:""),"select"===e.type){var f=function(){var o=[],l=e.options,u=l.values,p=l.textKey,c=l.valueKey;return Array.isArray(u)&&!function(){var e=void 0,t=void 0;o=u.map(function(o,a){return"object"===("undefined"==typeof o?"undefined":n(o))?(e=p?o[p]:o.text,t=c?o[c]:o.value):(e=r?r(o):o,t=o),i.default.createElement("option",{key:"option"+a,value:t},e)})}(),{v:i.default.createElement("select",a({},t,{defaultValue:s}),o)}}();if("object"===("undefined"==typeof f?"undefined":n(f)))return f.v}else{if("textarea"!==e.type){if("checkbox"===e.type){var d="true:false";e.options&&e.options.values&&(d=e.options.values),t.className=t.className.replace("form-control",""),t.className+=" checkbox pull-right";var h=!(!s||s.toString()!==d.split(":")[0]);return i.default.createElement("input",a({},t,{type:"checkbox",value:d,defaultChecked:h}))}return"datetime"===e.type?i.default.createElement("input",a({},t,{type:"datetime-local",defaultValue:s})):i.default.createElement("input",a({},t,{type:e.type,defaultValue:s}))}var _=function(){e.cols&&(t.cols=e.cols),e.rows&&(t.rows=e.rows);var r=void 0,o=t.onKeyDown;return o&&(t.onKeyDown=function(e){13!==e.keyCode&&o(e)},r=i.default.createElement("button",{className:"btn btn-info btn-xs textarea-save-btn",onClick:o},"save")),{v:i.default.createElement("div",null,i.default.createElement("textarea",a({},t,{defaultValue:s})),r)}}();if("object"===("undefined"==typeof _?"undefined":n(_)))return _.v}return i.default.createElement("input",a({},t,{type:"text",className:(o||"")+" form-control editor edit-text"}))},u=l;t.default=u;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(l,"editor","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Editor.js"),__REACT_HOT_LOADER__.register(u,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Editor.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(71),c=u.default.createFactory(p.ToastMessage.animation),f=function(e){function t(){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),i(t,[{key:"notice",value:function(e,t,r){this.refs.toastr[e](t,r,{mode:"single",timeOut:5e3,extendedTimeOut:1e3,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut"})}},{key:"render",value:function(){return u.default.createElement(p.ToastContainer,{ref:"toastr",toastMessageFactory:c,id:"toast-container",className:"toast-top-right"})}}]),t}(l.Component),d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(c,"ToastrMessageFactory","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Notification.js"),__REACT_HOT_LOADER__.register(f,"Notification","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Notification.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Notification.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p="react-bs-table-sizePerPage-dropdown",c=function(e){function t(){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),i(t,[{key:"render",value:function(){var e=this.props,t=e.open,r=e.hidden,o=e.onClick,n=e.options,a=e.className,s=e.variation,i=e.btnContextual,l=e.currSizePerPage,c=t?"open":"",f={visibility:r?"hidden":"visible"};return u.default.createElement("span",{style:f,className:s+" "+c+" "+a+" "+p},u.default.createElement("button",{className:"btn "+i+" dropdown-toggle",id:"pageDropDown","data-toggle":"dropdown","aria-expanded":t,onClick:o},l,u.default.createElement("span",null," ",u.default.createElement("span",{className:"caret"}))),u.default.createElement("ul",{className:"dropdown-menu",role:"menu","aria-labelledby":"pageDropDown"},n))}}]),t}(l.Component);c.propTypes={open:l.PropTypes.bool,hidden:l.PropTypes.bool,btnContextual:l.PropTypes.string,currSizePerPage:l.PropTypes.string,options:l.PropTypes.array,variation:l.PropTypes.oneOf(["dropdown","dropup"]),className:l.PropTypes.string,onClick:l.PropTypes.func},c.defaultProps={open:!1,hidden:!1,btnContextual:"btn-default",variation:"dropdown",className:""};var f=c;t.default=f;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(p,"sizePerPageDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/SizePerPageDropDown.js"),__REACT_HOT_LOADER__.register(c,"SizePerPageDropDown","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/SizePerPageDropDown.js"),__REACT_HOT_LOADER__.register(f,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/SizePerPageDropDown.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f="react-bs-table-search-clear-btn",d=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.btnContextual,r=e.className,o=e.onClick,a=e.btnText,s=e.children,i=n(e,["btnContextual","className","onClick","btnText","children"]),u=s||c.default.createElement("span",null,a);return c.default.createElement("button",l({ref:"btn",className:"btn "+t+" "+r+" "+f,type:"button",onClick:o},i),u)}}]),t}(p.Component);d.propTypes={btnContextual:p.PropTypes.string,className:p.PropTypes.string,btnText:p.PropTypes.string,onClick:p.PropTypes.func},d.defaultProps={btnContextual:"btn-default",className:"",btnText:"Clear",onClick:void 0};var h=d;t.default=h;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"clearBtnDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ClearSearchButton.js"),__REACT_HOT_LOADER__.register(d,"ClearSearchButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ClearSearchButton.js"),__REACT_HOT_LOADER__.register(h,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ClearSearchButton.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(2),d=o(f),h="react-bs-table-del-btn",_=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.btnContextual,r=e.className,o=e.onClick,a=e.btnGlyphicon,s=e.btnText,i=e.children,u=n(e,["btnContextual","className","onClick","btnGlyphicon","btnText","children"]),p=i||c.default.createElement("span",null,c.default.createElement("i",{className:"glyphicon "+a})," ",s);return c.default.createElement("button",l({type:"button",className:"btn "+t+" "+h+" "+r,onClick:o},u),p)}}]),t}(p.Component);_.propTypes={btnText:p.PropTypes.string,btnContextual:p.PropTypes.string,className:p.PropTypes.string,onClick:p.PropTypes.func,btnGlyphicon:p.PropTypes.string},_.defaultProps={btnText:d.default.DELETE_BTN_TEXT,btnContextual:"btn-warning",className:"",onClick:void 0,btnGlyphicon:"glyphicon-trash"};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"deleteBtnDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/DeleteButton.js"),__REACT_HOT_LOADER__.register(_,"DeleteButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/DeleteButton.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/DeleteButton.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(2),d=o(f),h="react-bs-table-csv-btn",_=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.btnContextual,r=e.className,o=e.onClick,a=e.btnGlyphicon,s=e.btnText,i=e.children,u=n(e,["btnContextual","className","onClick","btnGlyphicon","btnText","children"]),p=i||c.default.createElement("span",null,c.default.createElement("i",{className:"glyphicon "+a})," ",s);return c.default.createElement("button",l({type:"button",className:"btn "+t+" "+h+" "+r+" hidden-print",onClick:o},u),p)}}]),t}(p.Component);_.propTypes={btnText:p.PropTypes.string,btnContextual:p.PropTypes.string,className:p.PropTypes.string,onClick:p.PropTypes.func,btnGlyphicon:p.PropTypes.string},_.defaultProps={btnText:d.default.EXPORT_CSV_TEXT,btnContextual:"btn-success",className:"",onClick:void 0,btnGlyphicon:"glyphicon-export"};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"exportCsvBtnDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ExportCSVButton.js"),__REACT_HOT_LOADER__.register(_,"ExportCSVButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ExportCSVButton.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ExportCSVButton.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(2),d=o(f),h="react-bs-table-add-btn",_=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.btnContextual,r=e.className,o=e.onClick,a=e.btnGlyphicon,s=e.btnText,i=e.children,u=n(e,["btnContextual","className","onClick","btnGlyphicon","btnText","children"]),p=i||c.default.createElement("span",null,c.default.createElement("i",{className:"glyphicon "+a}),s);return c.default.createElement("button",l({type:"button",className:"btn "+t+" "+h+" "+r,onClick:o},u),p)}}]),t}(p.Component);_.propTypes={btnText:p.PropTypes.string,btnContextual:p.PropTypes.string,className:p.PropTypes.string,onClick:p.PropTypes.func,btnGlyphicon:p.PropTypes.string},_.defaultProps={btnText:d.default.INSERT_BTN_TEXT,btnContextual:"btn-info",className:"",onClick:void 0,btnGlyphicon:"glyphicon-plus"};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"insertBtnDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertButton.js"),__REACT_HOT_LOADER__.register(_,"InsertButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertButton.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertButton.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o), t}}(),l=r(1),u=o(l),p=r(54),c=o(p),f=function(e){function t(){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),i(t,[{key:"getFieldValue",value:function(){var e=this,t={};return this.props.columns.forEach(function(r,o){var n=void 0;if(r.autoValue){var a=(new Date).getTime();n="function"==typeof r.autoValue?r.autoValue():"autovalue-"+a}else if(r.hiddenOnInsert||!r.field)n="";else{var s=e.refs[r.field+o];if(n=s.value,r.editable&&"checkbox"===r.editable.type){var i=n.split(":");n=s.checked?i[0]:i[1]}else r.customInsertEditor&&(n=n||s.getFieldValue())}t[r.field]=n},this),t}},{key:"render",value:function(){var e=this.props,t=e.columns,r=e.validateState,o=e.ignoreEditable;return u.default.createElement("div",{className:"modal-body"},t.map(function(e,t){var n=e.editable,a=e.format,s=e.field,i=e.name,l=e.autoValue,p=e.hiddenOnInsert,f=e.customInsertEditor,d={ref:s+t,placeholder:n.placeholder?n.placeholder:i},h=void 0,_=n.defaultValue||void 0;if(f){var y=f.getElement;h=y(e,d,"form-control",o,_)}else h=(0,c.default)(n,d,a,"",_,o);if(l||p||!e.field)return null;var b=r[s]?u.default.createElement("span",{className:"help-block bg-danger"},r[s]):null;return u.default.createElement("div",{className:"form-group",key:s},u.default.createElement("label",null,i),h,b)}))}}]),t}(l.Component);f.propTypes={columns:l.PropTypes.array,validateState:l.PropTypes.object,ignoreEditable:l.PropTypes.bool},f.defaultProps={validateState:{},ignoreEditable:!1};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"InsertModalBody","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalBody.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalBody.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(2),c=o(p),f=function(e){function t(){var e,r,o,s;n(this,t);for(var i=arguments.length,l=Array(i),u=0;u<i;u++)l[u]=arguments[u];return r=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleCloseBtnClick=function(){var e;return(e=o).__handleCloseBtnClick__REACT_HOT_LOADER__.apply(e,arguments)},o.handleSaveBtnClick=function(){var e;return(e=o).__handleSaveBtnClick__REACT_HOT_LOADER__.apply(e,arguments)},s=r,a(o,s)}return s(t,e),i(t,[{key:"__handleCloseBtnClick__REACT_HOT_LOADER__",value:function(e){var t=this.props,r=t.beforeClose,o=t.onModalClose;r&&r(e),o()}},{key:"__handleSaveBtnClick__REACT_HOT_LOADER__",value:function(e){var t=this.props,r=t.beforeSave,o=t.onSave;r&&r(e),o()}},{key:"render",value:function(){var e=this.props,t=e.className,r=e.saveBtnText,o=e.closeBtnText,n=e.closeBtnContextual,a=e.saveBtnContextual,s=e.closeBtnClass,i=e.saveBtnClass,l=e.children,p=l||u.default.createElement("span",null,u.default.createElement("button",{type:"button",className:"btn "+n+" "+s,onClick:this.handleCloseBtnClick},o),u.default.createElement("button",{type:"button",className:"btn "+a+" "+i,onClick:this.handleSaveBtnClick},r));return u.default.createElement("div",{className:"modal-footer "+t},p)}}]),t}(l.Component);f.propTypes={className:l.PropTypes.string,saveBtnText:l.PropTypes.string,closeBtnText:l.PropTypes.string,closeBtnContextual:l.PropTypes.string,saveBtnContextual:l.PropTypes.string,closeBtnClass:l.PropTypes.string,saveBtnClass:l.PropTypes.string,beforeClose:l.PropTypes.func,beforeSave:l.PropTypes.func,onSave:l.PropTypes.func,onModalClose:l.PropTypes.func},f.defaultProps={className:"",saveBtnText:c.default.SAVE_BTN_TEXT,closeBtnText:c.default.CLOSE_BTN_TEXT,closeBtnContextual:"btn-default",saveBtnContextual:"btn-primary",closeBtnClass:"",saveBtnClass:"",beforeClose:void 0,beforeSave:void 0};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"InsertModalFooter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalFooter.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalFooter.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=function(e){function t(){var e,r,o,s;n(this,t);for(var i=arguments.length,l=Array(i),u=0;u<i;u++)l[u]=arguments[u];return r=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleCloseBtnClick=function(){var e;return(e=o).__handleCloseBtnClick__REACT_HOT_LOADER__.apply(e,arguments)},s=r,a(o,s)}return s(t,e),i(t,[{key:"__handleCloseBtnClick__REACT_HOT_LOADER__",value:function(e){var t=this.props,r=t.onModalClose,o=t.beforeClose;o&&o(e),r()}},{key:"render",value:function(){var e=this.props,t=e.title,r=e.hideClose,o=e.className,n=e.children,a=r?null:u.default.createElement("button",{type:"button",className:"close",onClick:this.handleCloseBtnClick},u.default.createElement("span",{"aria-hidden":"true"},"×"),u.default.createElement("span",{className:"sr-only"},"Close")),s=n||u.default.createElement("span",null,a,u.default.createElement("h4",{className:"modal-title"},t));return u.default.createElement("div",{className:"modal-header "+o},s)}}]),t}(l.Component);p.propTypes={className:l.PropTypes.string,title:l.PropTypes.string,onModalClose:l.PropTypes.func,hideClose:l.PropTypes.bool,beforeClose:l.PropTypes.func},p.defaultProps={className:"",title:"Add Row",onModalClose:void 0,hideClose:!1,beforeClose:void 0};var c=p;t.default=c;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(p,"InsertModalHeader","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalHeader.js"),__REACT_HOT_LOADER__.register(c,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModalHeader.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(6),d=o(f),h=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"getValue",value:function(){return d.default.findDOMNode(this).value}},{key:"setValue",value:function(e){d.default.findDOMNode(this).value=e}},{key:"render",value:function(){var e=this.props,r=e.className,o=e.defaultValue,a=e.placeholder,s=e.onKeyUp,i=n(e,["className","defaultValue","placeholder","onKeyUp"]);return c.default.createElement("input",l({className:"form-control "+r,type:"text",defaultValue:o,placeholder:a||t.defaultProps.placeholder,onKeyUp:s,style:{zIndex:0}},i))}}]),t}(p.Component);h.propTypes={className:p.PropTypes.string,defaultValue:p.PropTypes.string,placeholder:p.PropTypes.string,onKeyUp:p.PropTypes.func},h.defaultProps={className:"",defaultValue:"",placeholder:"Search",onKeyUp:void 0};var _=h;t.default=_;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"SearchField","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/SearchField.js"),__REACT_HOT_LOADER__.register(_,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/SearchField.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(2),d=o(f),h="react-bs-table-show-sel-only-btn",_=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.btnContextual,r=e.className,o=e.onClick,a=e.toggle,s=e.showAllText,i=e.showOnlySelectText,u=e.children,p=n(e,["btnContextual","className","onClick","toggle","showAllText","showOnlySelectText","children"]),f=u||c.default.createElement("span",null,a?i:s);return c.default.createElement("button",l({type:"button","aria-pressed":"false","data-toggle":"button",className:"btn "+t+" "+h+" "+r,onClick:o},p),f)}}]),t}(p.Component);_.propTypes={showAllText:p.PropTypes.string,showOnlySelectText:p.PropTypes.string,toggle:p.PropTypes.bool,btnContextual:p.PropTypes.string,className:p.PropTypes.string,onClick:p.PropTypes.func},_.defaultProps={showAllText:d.default.SHOW_ALL,showOnlySelectText:d.default.SHOW_ONLY_SELECT,toggle:!1,btnContextual:"btn-primary",className:"",onClick:void 0};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"showSelectedOnlyBtnDefaultClass","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ShowSelectedOnlyButton.js"),__REACT_HOT_LOADER__.register(_,"ShowSelectedOnlyButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ShowSelectedOnlyButton.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ShowSelectedOnlyButton.js"))})()},function(e,t){/*! * Adapted from jQuery UI core * * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/category/ui-core/ */ function r(e,t){var r=e.nodeName.toLowerCase();return(/input|select|textarea|button|object/.test(r)?!e.disabled:"a"===r?e.href||t:t)&&n(e)}function o(e){return e.offsetWidth<=0&&e.offsetHeight<=0||"none"===e.style.display}function n(e){for(;e&&e!==document.body;){if(o(e))return!1;e=e.parentNode}return!0}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var o=isNaN(t);return(o||t>=0)&&r(e,!o)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return a(e)})}e.exports=s},function(e,t){function r(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function o(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}function n(e,t){return function(r){return e(t(r))}}function a(e,t){var r=N(e)||_(e)?o(e.length,String):[],n=r.length,a=!!n;for(var s in e)!t&&!A.call(e,s)||a&&("length"==s||c(s,n))||r.push(s);return r}function s(e,t,r){var o=e[t];A.call(e,t)&&h(o,r)&&(void 0!==r||t in e)||(e[t]=r)}function i(e){if(!d(e))return D(e);var t=[];for(var r in Object(e))A.call(e,r)&&"constructor"!=r&&t.push(r);return t}function l(e,t){return t=j(void 0===t?e.length-1:t,0),function(){for(var o=arguments,n=-1,a=j(o.length-t,0),s=Array(a);++n<a;)s[n]=o[t+n];n=-1;for(var i=Array(t+1);++n<t;)i[n]=o[n];return i[t]=s,r(e,this,i)}}function u(e,t,r,o){r||(r={});for(var n=-1,a=t.length;++n<a;){var i=t[n],l=o?o(r[i],e[i],i,r,e):void 0;s(r,i,void 0===l?e[i]:l)}return r}function p(e){return l(function(t,r){var o=-1,n=r.length,a=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(n--,a):void 0,s&&f(r[0],r[1],s)&&(a=n<3?void 0:a,n=1),t=Object(t);++o<n;){var i=r[o];i&&e(t,i,o,a)}return t})}function c(e,t){return t=null==t?O:t,!!t&&("number"==typeof e||R.test(e))&&e>-1&&e%1==0&&e<t}function f(e,t,r){if(!m(r))return!1;var o=typeof t;return!!("number"==o?y(r)&&c(t,r.length):"string"==o&&t in r)&&h(r[t],e)}function d(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||S;return e===r}function h(e,t){return e===t||e!==e&&t!==t}function _(e){return b(e)&&A.call(e,"callee")&&(!k.call(e,"callee")||x.call(e)==C)}function y(e){return null!=e&&T(e.length)&&!v(e)}function b(e){return E(e)&&y(e)}function v(e){var t=m(e)?x.call(e):"";return t==P||t==w}function T(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=O}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function E(e){return!!e&&"object"==typeof e}function g(e){return y(e)?a(e):i(e)}var O=9007199254740991,C="[object Arguments]",P="[object Function]",w="[object GeneratorFunction]",R=/^(?:0|[1-9]\d*)$/,S=Object.prototype,A=S.hasOwnProperty,x=S.toString,k=S.propertyIsEnumerable,D=n(Object.keys,Object),j=Math.max,L=!k.call({valueOf:1},"valueOf"),N=Array.isArray,I=p(function(e,t){if(L||d(t)||y(t))return void u(t,g(t),e);for(var r in t)A.call(t,r)&&s(e,r,t[r])});e.exports=I},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(170),u=o(l),p=r(165),c=o(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},d=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),h=r(1),_=o(h),y=r(52),b=o(y),v=r(31),T=o(v),m=function(e){function t(){var e,r,o,n;a(this,t);for(var i=arguments.length,l=Array(i),u=0;u<i;u++)l[u]=arguments[u];return r=o=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.state={toasts:[],toastId:0,messageList:[]},o._handle_toast_remove=o._handle_toast_remove.bind(o),n=r,s(o,n)}return i(t,e),d(t,[{key:"error",value:function(e,t,r){this._notify(this.props.toastType.error,e,t,r)}},{key:"info",value:function(e,t,r){this._notify(this.props.toastType.info,e,t,r)}},{key:"success",value:function(e,t,r){this._notify(this.props.toastType.success,e,t,r)}},{key:"warning",value:function(e,t,r){this._notify(this.props.toastType.warning,e,t,r)}},{key:"clear",value:function(){var e=this;Object.keys(this.refs).forEach(function(t){e.refs[t].hideToast(!1)})}},{key:"_notify",value:function(e,t,r){var o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!this.props.preventDuplicates||!(0,c.default)(this.state.messageList,t)){var s=this.state.toastId++,i=s,l=(0,b.default)(a,{$merge:{type:e,title:r,message:t,toastId:i,key:s,ref:"toasts__"+s,handleOnClick:function(e){return"function"==typeof a.handleOnClick&&a.handleOnClick(),o._handle_toast_on_click(e)},handleRemove:this._handle_toast_remove}}),u=n({},""+(this.props.newestOnTop?"$unshift":"$push"),[l]),p=n({},""+(this.props.newestOnTop?"$unshift":"$push"),[t]),f=(0,b.default)(this.state,{toasts:u,messageList:p});this.setState(f)}}},{key:"_handle_toast_on_click",value:function(e){this.props.onClick(e),e.defaultPrevented||(e.preventDefault(),e.stopPropagation())}},{key:"_handle_toast_remove",value:function(e){var t=this;this.props.preventDuplicates&&(this.state.previousMessage="");var r=""+(this.props.newestOnTop?"reduceRight":"reduce");this.state.toasts[r](function(r,o,n){return!r&&o.toastId===e&&(t.setState((0,b.default)(t.state,{toasts:{$splice:[[n,1]]},messageList:{$splice:[[n,1]]}})),!0)},!1)}},{key:"render",value:function(){var e=this,t=(0,u.default)(this.props,["toastType","toastMessageFactory","preventDuplicates","newestOnTop"]);return _.default.createElement("div",f({},t,{"aria-live":"polite",role:"alert"}),this.state.toasts.map(function(t){return e.props.toastMessageFactory(t)}))}}]),t}(h.Component);m.propTypes={toastType:h.PropTypes.shape({error:h.PropTypes.string,info:h.PropTypes.string,success:h.PropTypes.string,warning:h.PropTypes.string}).isRequired,id:h.PropTypes.string.isRequired,toastMessageFactory:h.PropTypes.func.isRequired,preventDuplicates:h.PropTypes.bool.isRequired,newestOnTop:h.PropTypes.bool.isRequired,onClick:h.PropTypes.func.isRequired},m.defaultProps={toastType:{error:"error",info:"info",success:"success",warning:"warning"},id:"toast-container",toastMessageFactory:_.default.createFactory(T.default.animation),preventDuplicates:!0,newestOnTop:!0,onClick:function(){}},t.default=m},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(177),a=o(n),s=r(6),i=o(s),l=r(72),u=o(l),p=17,c=Object.prototype.toString;t.default={getDefaultProps:function(){return{transition:null,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut",timeOut:5e3,extendedTimeOut:1e3}},componentWillMount:function(){this.classNameQueue=[],this.isHiding=!1,this.intervalId=null},componentDidMount:function(){var e=this;this._is_mounted=!0,this._show();var t=i.default.findDOMNode(this),r=function r(){e.isHiding&&(e._set_is_hiding(!1),a.default.removeEndEventListener(t,r),e._handle_remove())};a.default.addEndEventListener(t,r),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},componentWillUnmount:function(){this._is_mounted=!1,this.intervalId&&clearTimeout(this.intervalId)},_set_transition:function(e){var t=e?"leave":"enter",r=i.default.findDOMNode(this),o=this.props.transition+"-"+t,n=o+"-active",s=function e(t){if(!t||t.target===r){var s=(0,u.default)(r);s.remove(o),s.remove(n),a.default.removeEndEventListener(r,e)}};a.default.addEndEventListener(r,s),(0,u.default)(r).add(o),this._queue_class(n)},_clear_transition:function(e){var t=i.default.findDOMNode(this),r=e?"leave":"enter",o=this.props.transition+"-"+r,n=o+"-active",a=(0,u.default)(t);a.remove(o),a.remove(n)},_set_animation:function(e){var t=i.default.findDOMNode(this),r=this._get_animation_classes(e),o=function e(o){o&&o.target!==t||(r.forEach(function(e){return(0,u.default)(t).remove(e)}),a.default.removeEndEventListener(t,e))};a.default.addEndEventListener(t,o),r.forEach(function(e){return(0,u.default)(t).add(e)})},_get_animation_classes:function(e){var t=e?this.props.hideAnimation:this.props.showAnimation;return"[object Array]"===c.call(t)?t:"string"==typeof t?t.split(" "):void 0},_clear_animation:function(e){var t=i.default.findDOMNode(this),r=this._get_animation_classes(e);r.forEach(function(e){return(0,u.default)(t).remove(e)})},_queue_class:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this._flush_class_name_queue,p))},_flush_class_name_queue:function(){var e=this;this._is_mounted&&!function(){var t=i.default.findDOMNode(e);e.classNameQueue.forEach(function(e){return(0,u.default)(t).add(e)})}(),this.classNameQueue.length=0,this.timeout=null},_show:function(){this.props.transition?this._set_transition():this.props.showAnimation&&this._set_animation()},handleMouseEnter:function(){clearTimeout(this.intervalId),this._set_interval_id(null),this.isHiding&&(this._set_is_hiding(!1),this.props.hideAnimation?this._clear_animation(!0):this.props.transition&&this._clear_transition(!0))},handleMouseLeave:function(){!this.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.isHiding||null===this.intervalId&&!e||(this._set_is_hiding(!0),this.props.transition?this._set_transition(!0):this.props.hideAnimation?this._set_animation(!0):this._handle_remove())},_set_interval_id:function(e){this.intervalId=e},_set_is_hiding:function(e){this.isHiding=e}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){e[t.showMethod]({duration:t.showDuration,easing:t.showEasing})}Object.defineProperty(t,"__esModule",{value:!0});var a=r(6),s=o(a);t.default={getDefaultProps:function(){return{style:{display:"none"},showMethod:"fadeIn",showDuration:300,showEasing:"swing",hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",timeOut:5e3,extendedTimeOut:1e3}},getInitialState:function(){return{intervalId:null,isHiding:!1}},componentDidMount:function(){n(this._get_$_node(),this.props),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},handleMouseEnter:function(){clearTimeout(this.state.intervalId),this._set_interval_id(null),this._set_is_hiding(!1),n(this._get_$_node().stop(!0,!0),this.props)},handleMouseLeave:function(){!this.state.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.state.isHiding||null===this.state.intervalId&&!e||(this.setState({isHiding:!0}),this._get_$_node()[this.props.hideMethod]({duration:this.props.hideDuration,easing:this.props.hideEasing,complete:this._handle_remove}))},_get_$_node:function(){return jQuery(s.default.findDOMNode(this))},_set_interval_id:function(e){this.setState({intervalId:e})},_set_is_hiding:function(e){this.setState({isHiding:e})}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ToastMessage=t.ToastContainer=void 0;var n=r(68),a=o(n),s=r(31),i=o(s);t.ToastContainer=a.default,t.ToastMessage=i.default},function(e,t){function r(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}function o(e){if(!(this instanceof o))return new o(e);e||(e={}),e.nodeType&&(e={el:e}),this.opts=e,this.el=e.el||document.body,"object"!=typeof this.el&&(this.el=document.querySelector(this.el))}e.exports=function(e){return new o(e)},o.prototype.add=function(e){var t=this.el;if(t){if(""===t.className)return t.className=e;var o=t.className.split(" ");return r(o,e)>-1?o:(o.push(e),t.className=o.join(" "),o)}},o.prototype.remove=function(e){var t=this.el;if(t&&""!==t.className){var o=t.className.split(" "),n=r(o,e);return n>-1&&o.splice(n,1),t.className=o.join(" "),o}},o.prototype.has=function(e){var t=this.el;if(t){var o=t.className.split(" ");return r(o,e)>-1}},o.prototype.toggle=function(e){var t=this.el;t&&(this.has(e)?this.remove(e):this.add(e))}},function(e,t,r){var o=r(7),n=r(4),a=o(n,"DataView");e.exports=a},function(e,t,r){function o(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}var n=r(121),a=r(122),s=r(123),i=r(124),l=r(125);o.prototype.clear=n,o.prototype.delete=a,o.prototype.get=s,o.prototype.has=i,o.prototype.set=l,e.exports=o},function(e,t,r){var o=r(7),n=r(4),a=o(n,"Promise");e.exports=a},function(e,t,r){var o=r(7),n=r(4),a=o(n,"Set");e.exports=a},function(e,t,r){function o(e){var t=this.__data__=new n(e);this.size=t.size}var n=r(13),a=r(155),s=r(156),i=r(157),l=r(158),u=r(159);o.prototype.clear=a,o.prototype.delete=s,o.prototype.get=i,o.prototype.has=l,o.prototype.set=u,e.exports=o},function(e,t,r){var o=r(4),n=o.Uint8Array;e.exports=n},function(e,t,r){var o=r(7),n=r(4),a=o(n,"WeakMap");e.exports=a},function(e,t){function r(e,t){return e.set(t[0],t[1]),e}e.exports=r},function(e,t){function r(e,t){return e.add(t),e}e.exports=r},function(e,t){function r(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}e.exports=r},function(e,t){function r(e,t){for(var r=-1,o=null==e?0:e.length;++r<o&&t(e[r],r,e)!==!1;);return e}e.exports=r},function(e,t,r){function o(e,t){return e&&n(t,a(t),e)}var n=r(11),a=r(18);e.exports=o},function(e,t,r){function o(e,t){return e&&n(t,a(t),e)}var n=r(11),a=r(50);e.exports=o},function(e,t,r){function o(e,t,r,R,S,A){var x,j=t&O,L=t&C,I=t&P;if(r&&(x=S?r(e,R,S,A):r(e)),void 0!==x)return x;if(!E(e))return e;var M=T(e);if(M){if(x=y(e),!j)return p(e,x)}else{var F=_(e),H=F==k||F==D;if(m(e))return u(e,j);if(F==N||F==w||H&&!S){if(x=L||H?{}:v(e),!j)return L?f(e,l(x,e)):c(e,i(x,e))}else{if(!Z[F])return S?e:{};x=b(e,F,o,j)}}A||(A=new n);var B=A.get(e);if(B)return B;A.set(e,x);var V=I?L?h:d:L?keysIn:g,U=M?void 0:V(e);return a(U||e,function(n,a){U&&(a=n,n=e[a]),s(x,a,o(n,t,r,a,e,A))}),x}var n=r(77),a=r(83),s=r(35),i=r(84),l=r(85),u=r(105),p=r(112),c=r(113),f=r(114),d=r(117),h=r(40),_=r(119),y=r(126),b=r(127),v=r(128),T=r(5),m=r(47),E=r(9),g=r(18),O=1,C=2,P=4,w="[object Arguments]",R="[object Array]",S="[object Boolean]",A="[object Date]",x="[object Error]",k="[object Function]",D="[object GeneratorFunction]",j="[object Map]",L="[object Number]",N="[object Object]",I="[object RegExp]",M="[object Set]",F="[object String]",H="[object Symbol]",B="[object WeakMap]",V="[object ArrayBuffer]",U="[object DataView]",z="[object Float32Array]",G="[object Float64Array]",K="[object Int8Array]",W="[object Int16Array]",Y="[object Int32Array]",X="[object Uint8Array]",q="[object Uint8ClampedArray]",$="[object Uint16Array]",Q="[object Uint32Array]",Z={};Z[w]=Z[R]=Z[V]=Z[U]=Z[S]=Z[A]=Z[z]=Z[G]=Z[K]=Z[W]=Z[Y]=Z[j]=Z[L]=Z[N]=Z[I]=Z[M]=Z[F]=Z[H]=Z[X]=Z[q]=Z[$]=Z[Q]=!0,Z[x]=Z[k]=Z[B]=!1,e.exports=o},function(e,t,r){var o=r(9),n=Object.create,a=function(){function e(){}return function(t){if(!o(t))return{};if(n)return n(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=a},function(e,t){function r(e,t,r,o){for(var n=e.length,a=r+(o?1:-1);o?a--:++a<n;)if(t(e[a],a,e))return a;return-1}e.exports=r},function(e,t,r){function o(e,t,r,s,i){var l=-1,u=e.length;for(r||(r=a),i||(i=[]);++l<u;){var p=e[l];t>0&&r(p)?t>1?o(p,t-1,r,s,i):n(i,p):s||(i[i.length]=p)}return i}var n=r(22),a=r(129);e.exports=o},function(e,t,r){function o(e,t){t=n(t,e);for(var r=0,o=t.length;null!=e&&r<o;)e=e[a(t[r++])];return r&&r==o?e:void 0}var n=r(23),a=r(43);e.exports=o},function(e,t,r){function o(e,t,r){return t===t?s(e,t,r):n(e,a,r)}var n=r(88),a=r(93),s=r(160);e.exports=o},function(e,t,r){function o(e){return a(e)&&n(e)==s}var n=r(8),a=r(12),s="[object Arguments]";e.exports=o},function(e,t){function r(e){return e!==e}e.exports=r},function(e,t,r){function o(e){if(!s(e)||a(e))return!1;var t=n(e)?h:u;return t.test(i(e))}var n=r(48),a=r(133),s=r(9),i=r(44),l=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,p=Function.prototype,c=Object.prototype,f=p.toString,d=c.hasOwnProperty,h=RegExp("^"+f.call(d).replace(l,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=o},function(e,t,r){function o(e){return s(e)&&a(e.length)&&!!k[n(e)]}var n=r(8),a=r(49),s=r(12),i="[object Arguments]",l="[object Array]",u="[object Boolean]",p="[object Date]",c="[object Error]",f="[object Function]",d="[object Map]",h="[object Number]",_="[object Object]",y="[object RegExp]",b="[object Set]",v="[object String]",T="[object WeakMap]",m="[object ArrayBuffer]",E="[object DataView]",g="[object Float32Array]",O="[object Float64Array]",C="[object Int8Array]",P="[object Int16Array]",w="[object Int32Array]",R="[object Uint8Array]",S="[object Uint8ClampedArray]",A="[object Uint16Array]",x="[object Uint32Array]",k={};k[g]=k[O]=k[C]=k[P]=k[w]=k[R]=k[S]=k[A]=k[x]=!0,k[i]=k[l]=k[m]=k[u]=k[E]=k[p]=k[c]=k[f]=k[d]=k[h]=k[_]=k[y]=k[b]=k[v]=k[T]=!1,e.exports=o},function(e,t,r){function o(e){if(!n(e))return a(e);var t=[];for(var r in Object(e))i.call(e,r)&&"constructor"!=r&&t.push(r);return t}var n=r(26),a=r(146),s=Object.prototype,i=s.hasOwnProperty;e.exports=o},function(e,t,r){function o(e){if(!n(e))return s(e);var t=a(e),r=[];for(var o in e)("constructor"!=o||!t&&l.call(e,o))&&r.push(o);return r}var n=r(9),a=r(26),s=r(147),i=Object.prototype,l=i.hasOwnProperty;e.exports=o},function(e,t,r){var o=r(162),n=r(38),a=r(164),s=n?function(e,t){return n(e,"toString",{configurable:!0,enumerable:!1,value:o(t),writable:!0})}:a;e.exports=s},function(e,t){function r(e,t,r){var o=-1,n=e.length;t<0&&(t=-t>n?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(n);++o<n;)a[o]=e[o+t];return a}e.exports=r},function(e,t){function r(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}e.exports=r},function(e,t,r){function o(e){if("string"==typeof e)return e;if(s(e))return a(e,o)+"";if(i(e))return p?p.call(e):"";var t=e+"";return"0"==t&&1/e==-l?"-0":t}var n=r(10),a=r(21),s=r(5),i=r(17),l=1/0,u=n?n.prototype:void 0,p=u?u.toString:void 0;e.exports=o},function(e,t){function r(e){return function(t){return e(t)}}e.exports=r},function(e,t,r){function o(e,t){return t=n(t,e),e=s(e,t),null==e||delete e[i(a(t))]}var n=r(23),a=r(168),s=r(151),i=r(43);e.exports=o},function(e,t,r){function o(e,t){return n(t,function(t){return e[t]})}var n=r(21);e.exports=o},function(e,t,r){(function(e){function o(e,t){if(t)return e.slice();var r=e.length,o=u?u(r):new e.constructor(r);return e.copy(o),o}var n=r(4),a="object"==typeof t&&t&&!t.nodeType&&t,s=a&&"object"==typeof e&&e&&!e.nodeType&&e,i=s&&s.exports===a,l=i?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;e.exports=o}).call(t,r(29)(e))},function(e,t,r){function o(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var n=r(24);e.exports=o},function(e,t,r){function o(e,t,r){var o=t?r(s(e),i):s(e);return a(o,n,new e.constructor)}var n=r(80),a=r(34),s=r(144),i=1;e.exports=o},function(e,t){function r(e){var t=new e.constructor(e.source,o.exec(e));return t.lastIndex=e.lastIndex,t}var o=/\w*$/;e.exports=r},function(e,t,r){function o(e,t,r){var o=t?r(s(e),i):s(e);return a(o,n,new e.constructor)}var n=r(81),a=r(34),s=r(152),i=1;e.exports=o},function(e,t,r){function o(e){return s?Object(s.call(e)):{}}var n=r(10),a=n?n.prototype:void 0,s=a?a.valueOf:void 0;e.exports=o},function(e,t,r){function o(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var n=r(24);e.exports=o},function(e,t){function r(e,t){var r=-1,o=e.length;for(t||(t=Array(o));++r<o;)t[r]=e[r];return t}e.exports=r},function(e,t,r){function o(e,t){return n(e,a(e),t)}var n=r(11),a=r(25);e.exports=o},function(e,t,r){function o(e,t){return n(e,a(e),t)}var n=r(11),a=r(42);e.exports=o},function(e,t,r){var o=r(4),n=o["__core-js_shared__"];e.exports=n},function(e,t,r){function o(e){return s(a(e,void 0,n),e+"")}var n=r(163),a=r(150),s=r(153);e.exports=o},function(e,t,r){function o(e){return n(e,s,a)}var n=r(37),a=r(25),s=r(18);e.exports=o},function(e,t,r){function o(e){var t=s.call(e,l),r=e[l];try{e[l]=void 0;var o=!0}catch(e){}var n=i.call(e);return o&&(t?e[l]=r:delete e[l]),n}var n=r(10),a=Object.prototype,s=a.hasOwnProperty,i=a.toString,l=n?n.toStringTag:void 0;e.exports=o},function(e,t,r){var o=r(73),n=r(20),a=r(75),s=r(76),i=r(79),l=r(8),u=r(44),p="[object Map]",c="[object Object]",f="[object Promise]",d="[object Set]",h="[object WeakMap]",_="[object DataView]",y=u(o),b=u(n),v=u(a),T=u(s),m=u(i),E=l;(o&&E(new o(new ArrayBuffer(1)))!=_||n&&E(new n)!=p||a&&E(a.resolve())!=f||s&&E(new s)!=d||i&&E(new i)!=h)&&(E=function(e){var t=l(e),r=t==c?e.constructor:void 0,o=r?u(r):"";if(o)switch(o){case y:return _;case b:return p;case v:return f;case T:return d;case m:return h}return t}),e.exports=E},function(e,t){function r(e,t){return null==e?void 0:e[t]}e.exports=r},function(e,t,r){function o(){this.__data__=n?n(null):{},this.size=0}var n=r(16);e.exports=o},function(e,t){function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=r},function(e,t,r){function o(e){var t=this.__data__;if(n){var r=t[e];return r===a?void 0:r}return i.call(t,e)?t[e]:void 0}var n=r(16),a="__lodash_hash_undefined__",s=Object.prototype,i=s.hasOwnProperty;e.exports=o},function(e,t,r){function o(e){var t=this.__data__;return n?void 0!==t[e]:s.call(t,e)}var n=r(16),a=Object.prototype,s=a.hasOwnProperty;e.exports=o},function(e,t,r){function o(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?a:t,this}var n=r(16),a="__lodash_hash_undefined__";e.exports=o},function(e,t){function r(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var o=Object.prototype,n=o.hasOwnProperty;e.exports=r},function(e,t,r){function o(e,t,r,o){var x=e.constructor;switch(t){case T:return n(e);case c:case f:return new x(+e);case m:return a(e,o);case E:case g:case O:case C:case P:case w:case R:case S:case A:return p(e,o);case d:return s(e,o,r);case h:case b:return new x(e);case _:return i(e);case y:return l(e,o,r);case v:return u(e)}}var n=r(24),a=r(106),s=r(107),i=r(108),l=r(109),u=r(110),p=r(111),c="[object Boolean]",f="[object Date]",d="[object Map]",h="[object Number]",_="[object RegExp]",y="[object Set]",b="[object String]",v="[object Symbol]",T="[object ArrayBuffer]",m="[object DataView]",E="[object Float32Array]",g="[object Float64Array]",O="[object Int8Array]",C="[object Int16Array]",P="[object Int32Array]",w="[object Uint8Array]",R="[object Uint8ClampedArray]",S="[object Uint16Array]",A="[object Uint32Array]";e.exports=o},function(e,t,r){function o(e){return"function"!=typeof e.constructor||s(e)?{}:n(a(e))}var n=r(87),a=r(41),s=r(26);e.exports=o},function(e,t,r){function o(e){return s(e)||a(e)||!!(i&&e&&e[i])}var n=r(10),a=r(46),s=r(5),i=n?n.isConcatSpreadable:void 0;e.exports=o},function(e,t){function r(e,t){return t=null==t?o:t,!!t&&("number"==typeof e||n.test(e))&&e>-1&&e%1==0&&e<t}var o=9007199254740991,n=/^(?:0|[1-9]\d*)$/;e.exports=r},function(e,t,r){function o(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!a(e))||(i.test(e)||!s.test(e)||null!=t&&e in Object(t))}var n=r(5),a=r(17),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;e.exports=o},function(e,t){function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=r},function(e,t,r){function o(e){return!!a&&a in e}var n=r(115),a=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=o},function(e,t){function r(){this.__data__=[],this.size=0}e.exports=r},function(e,t,r){function o(e){var t=this.__data__,r=n(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():s.call(t,r,1),--this.size,!0}var n=r(14),a=Array.prototype,s=a.splice;e.exports=o},function(e,t,r){function o(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}var n=r(14);e.exports=o},function(e,t,r){function o(e){return n(this.__data__,e)>-1}var n=r(14);e.exports=o},function(e,t,r){function o(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}var n=r(14);e.exports=o},function(e,t,r){function o(){this.size=0,this.__data__={hash:new n,map:new(s||a),string:new n}}var n=r(74),a=r(13),s=r(20);e.exports=o},function(e,t,r){function o(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}var n=r(15);e.exports=o},function(e,t,r){function o(e){return n(this,e).get(e)}var n=r(15);e.exports=o},function(e,t,r){function o(e){return n(this,e).has(e)}var n=r(15);e.exports=o},function(e,t,r){function o(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var n=r(15);e.exports=o},function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e,o){r[++t]=[o,e]}),r}e.exports=r},function(e,t,r){function o(e){var t=n(e,function(e){return r.size===a&&r.clear(),e}),r=t.cache;return t}var n=r(169),a=500;e.exports=o},function(e,t,r){var o=r(27),n=o(Object.keys,Object);e.exports=n},function(e,t){function r(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}e.exports=r},function(e,t,r){(function(e){var o=r(39),n="object"==typeof t&&t&&!t.nodeType&&t,a=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===n,i=s&&o.process,l=function(){try{return i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=l}).call(t,r(29)(e))},function(e,t){function r(e){return n.call(e)}var o=Object.prototype,n=o.toString;e.exports=r},function(e,t,r){function o(e,t,r){return t=a(void 0===t?e.length-1:t,0),function(){for(var o=arguments,s=-1,i=a(o.length-t,0),l=Array(i);++s<i;)l[s]=o[t+s];s=-1;for(var u=Array(t+1);++s<t;)u[s]=o[s];return u[t]=r(l),n(e,this,u)}}var n=r(82),a=Math.max;e.exports=o},function(e,t,r){function o(e,t){return t.length<2?e:n(e,a(t,0,-1))}var n=r(90),a=r(99);e.exports=o},function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}e.exports=r},function(e,t,r){var o=r(98),n=r(154),a=n(o);e.exports=a},function(e,t){function r(e){var t=0,r=0;return function(){var s=a(),i=n-(s-r);if(r=s,i>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var o=800,n=16,a=Date.now;e.exports=r},function(e,t,r){function o(){this.__data__=new n,this.size=0}var n=r(13);e.exports=o},function(e,t){function r(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}e.exports=r},function(e,t){function r(e){return this.__data__.get(e)}e.exports=r},function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},function(e,t,r){function o(e,t){var r=this.__data__;if(r instanceof n){var o=r.__data__;if(!a||o.length<i-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new s(o)}return r.set(e,t),this.size=r.size,this}var n=r(13),a=r(20),s=r(32),i=200;e.exports=o},function(e,t){function r(e,t,r){for(var o=r-1,n=e.length;++o<n;)if(e[o]===t)return o;return-1}e.exports=r},function(e,t,r){var o=r(145),n=/^\./,a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,i=o(function(e){var t=[];return n.test(e)&&t.push(""),e.replace(a,function(e,r,o,n){t.push(o?n.replace(s,"$1"):r||e)}),t});e.exports=i},function(e,t){function r(e){return function(){return e}}e.exports=r},function(e,t,r){function o(e){var t=null==e?0:e.length;return t?n(e,1):[]}var n=r(89);e.exports=o},function(e,t){function r(e){return e}e.exports=r},function(e,t,r){function o(e,t,r,o){e=a(e)?e:l(e),r=r&&!o?i(r):0;var p=e.length;return r<0&&(r=u(p+r,0)),s(e)?r<=p&&e.indexOf(t,r)>-1:!!p&&n(e,t,r)>-1}var n=r(91),a=r(28),s=r(166),i=r(173),l=r(176),u=Math.max;e.exports=o},function(e,t,r){function o(e){return"string"==typeof e||!a(e)&&s(e)&&n(e)==i}var n=r(8),a=r(5),s=r(12),i="[object String]";e.exports=o},function(e,t,r){var o=r(95),n=r(102),a=r(148),s=a&&a.isTypedArray,i=s?n(s):o;e.exports=i},function(e,t){function r(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}e.exports=r},function(e,t,r){function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(a);var r=function(){var o=arguments,n=t?t.apply(this,o):o[0],a=r.cache;if(a.has(n))return a.get(n);var s=e.apply(this,o);return r.cache=a.set(n,s)||a,s};return r.cache=new(o.Cache||n),r}var n=r(32),a="Expected a function";o.Cache=n,e.exports=o},function(e,t,r){var o=r(21),n=r(86),a=r(103),s=r(23),i=r(11),l=r(116),u=r(40),p=1,c=2,f=4,d=l(function(e,t){var r={};if(null==e)return r;var l=!1;t=o(t,function(t){return t=s(t,e),l||(l=t.length>1),t}),i(e,u(e),r),l&&(r=n(r,p|c|f));for(var d=t.length;d--;)a(r,t[d]);return r});e.exports=d},function(e,t){function r(){return!1}e.exports=r},function(e,t,r){function o(e){if(!e)return 0===e?e:0;if(e=n(e),e===a||e===-a){var t=e<0?-1:1;return t*s}return e===e?e:0}var n=r(174),a=1/0,s=1.7976931348623157e308;e.exports=o},function(e,t,r){function o(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}var n=r(172);e.exports=o},function(e,t,r){function o(e){if("number"==typeof e)return e;if(a(e))return s;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var r=u.test(e);return r||p.test(e)?c(e.slice(2),r?2:8):l.test(e)?s:+e}var n=r(9),a=r(17),s=NaN,i=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,p=/^0o[0-7]+$/i,c=parseInt;e.exports=o},function(e,t,r){function o(e){return null==e?"":n(e)}var n=r(101);e.exports=o},function(e,t,r){function o(e){return null==e?[]:n(e,a(e))}var n=r(104),a=r(18);e.exports=o},function(e,t,r){"use strict";function o(){var e=i("animationend"),t=i("transitionend");e&&l.push(e),t&&l.push(t)}function n(e,t,r){e.addEventListener(t,r,!1)}function a(e,t,r){e.removeEventListener(t,r,!1)}var s=r(53),i=r(178),l=[];s.canUseDOM&&o();var u={addEndEventListener:function(e,t){return 0===l.length?void window.setTimeout(t,0):void l.forEach(function(r){n(e,r,t)})},removeEndEventListener:function(e,t){0!==l.length&&l.forEach(function(r){a(e,r,t)})}};e.exports=u},function(e,t,r){"use strict";function o(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r["ms"+e]="MS"+t,r["O"+e]="o"+t.toLowerCase(),r}function n(e){if(i[e])return i[e];if(!s[e])return e;var t=s[e];for(var r in t)if(t.hasOwnProperty(r)&&r in l)return i[e]=t[r];return""}var a=r(53),s={animationend:o("Animation","AnimationEnd"),animationiteration:o("Animation","AnimationIteration"),animationstart:o("Animation","AnimationStart"),transitionend:o("Transition","TransitionEnd")},i={},l={};a.canUseDOM&&(l=document.createElement("div").style,"AnimationEvent"in window||(delete s.animationend.animation,delete s.animationiteration.animation,delete s.animationstart.animation),"TransitionEvent"in window||delete s.transitionend.transition),e.exports=n},function(e,t){"use strict";function r(e){for(var t=arguments.length-1,r="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,o=0;o<t;o++)r+="&args[]="+encodeURIComponent(arguments[o+1]);r+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; var n=new Error(r);throw n.name="Invariant Violation",n.framesToPop=1,n}e.exports=r},function(e,t,r){(function(t){"use strict";function o(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?i(new e.constructor,e):e}function n(e,r,o){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): expected target of %s to be an array; got %s.",o,e):s("1",o,e);var n=r[o];Array.isArray(n)?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",o,n):s("2",o,n)}function a(e,r){if("object"!=typeof r?"production"!==t.env.NODE_ENV?u(!1,"update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?",b.join(", "),h):s("3",b.join(", "),h):void 0,p.call(r,h))return 1!==Object.keys(r).length?"production"!==t.env.NODE_ENV?u(!1,"Cannot have more than one key in an object with %s",h):s("4",h):void 0,r[h];var l=o(e);if(p.call(r,_)){var T=r[_];T&&"object"==typeof T?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): %s expects a spec of type 'object'; got %s",_,T):s("5",_,T),l&&"object"==typeof l?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): %s expects a target of type 'object'; got %s",_,l):s("6",_,l),i(l,r[_])}p.call(r,c)&&(n(e,r,c),r[c].forEach(function(e){l.push(e)})),p.call(r,f)&&(n(e,r,f),r[f].forEach(function(e){l.unshift(e)})),p.call(r,d)&&(Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?u(!1,"Expected %s target to be an array; got %s",d,e):s("7",d,e),Array.isArray(r[d])?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):s("8",d,r[d]),r[d].forEach(function(e){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?u(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):s("8",d,r[d]),l.splice.apply(l,e)})),p.call(r,y)&&("function"!=typeof r[y]?"production"!==t.env.NODE_ENV?u(!1,"update(): expected spec of %s to be a function; got %s.",y,r[y]):s("9",y,r[y]):void 0,l=r[y](l));for(var m in r)v.hasOwnProperty(m)&&v[m]||(l[m]=a(e[m],r[m]));return l}var s=r(179),i=r(183),l=r(182),u=r(181),p={}.hasOwnProperty,c=l({$push:null}),f=l({$unshift:null}),d=l({$splice:null}),h=l({$set:null}),_=l({$merge:null}),y=l({$apply:null}),b=[c,f,d,h,_,y],v={};b.forEach(function(e){v[e]=!0}),e.exports=a}).call(t,r(30))},function(e,t,r){(function(t){"use strict";function r(e,r,o,n,a,s,i,l){if("production"!==t.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[o,n,a,s,i,l],c=0;u=new Error(r.replace(/%s/g,function(){return p[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=r}).call(t,r(30))},function(e,t){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=r},function(e,t){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var o=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==o.join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var o,s,i=r(e),l=1;l<arguments.length;l++){o=Object(arguments[l]);for(var u in o)n.call(o,u)&&(i[u]=o[u]);if(Object.getOwnPropertySymbols){s=Object.getOwnPropertySymbols(o);for(var p=0;p<s.length;p++)a.call(o,s[p])&&(i[s[p]]=o[s[p]])}}return i}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(3),d=o(f),h=r(2),_=o(h),y=r(192),b=o(y),v=r(188),T=o(v),m=r(202),E=o(m),g=r(206),O=o(g),C=r(191),P=o(C),w=r(203),R=r(19),S=o(R),A=r(195),x=o(A),k=r(186),D=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(r.handleSort=function(){return r.__handleSort__REACT_HOT_LOADER__.apply(r,arguments)},r.handleExpandRow=function(){return r.__handleExpandRow__REACT_HOT_LOADER__.apply(r,arguments)},r.handlePaginationData=function(){return r.__handlePaginationData__REACT_HOT_LOADER__.apply(r,arguments)},r.handleMouseLeave=function(){return r.__handleMouseLeave__REACT_HOT_LOADER__.apply(r,arguments)},r.handleMouseEnter=function(){return r.__handleMouseEnter__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowMouseOut=function(){return r.__handleRowMouseOut__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowMouseOver=function(){return r.__handleRowMouseOver__REACT_HOT_LOADER__.apply(r,arguments)},r.handleNavigateCell=function(){return r.__handleNavigateCell__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowClick=function(){return r.__handleRowClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowDoubleClick=function(){return r.__handleRowDoubleClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleSelectAllRow=function(){return r.__handleSelectAllRow__REACT_HOT_LOADER__.apply(r,arguments)},r.handleShowOnlySelected=function(){return r.__handleShowOnlySelected__REACT_HOT_LOADER__.apply(r,arguments)},r.handleSelectRow=function(){return r.__handleSelectRow__REACT_HOT_LOADER__.apply(r,arguments)},r.handleAddRow=function(){return r.__handleAddRow__REACT_HOT_LOADER__.apply(r,arguments)},r.getPageByRowKey=function(){return r.__getPageByRowKey__REACT_HOT_LOADER__.apply(r,arguments)},r.handleDropRow=function(){return r.__handleDropRow__REACT_HOT_LOADER__.apply(r,arguments)},r.handleFilterData=function(){return r.__handleFilterData__REACT_HOT_LOADER__.apply(r,arguments)},r.handleExportCSV=function(){return r.__handleExportCSV__REACT_HOT_LOADER__.apply(r,arguments)},r.handleSearch=function(){return r.__handleSearch__REACT_HOT_LOADER__.apply(r,arguments)},r._scrollTop=function(){return r.___scrollTop__REACT_HOT_LOADER__.apply(r,arguments)},r._scrollHeader=function(){return r.___scrollHeader__REACT_HOT_LOADER__.apply(r,arguments)},r.isIE=!1,r._attachCellEditFunc(),S.default.canUseDOM()&&(r.isIE=document.documentMode),r.store=new w.TableDataStore(r.props.data?r.props.data.slice():[]),r.isVerticalScroll=!1,r.initTable(r.props),r.props.selectRow&&r.props.selectRow.selected){var o=r.props.selectRow.selected.slice();r.store.setSelectedRowKey(o)}var s=_.default.PAGE_START_INDEX;return"undefined"!=typeof r.props.options.page?s=r.props.options.page:"undefined"!=typeof r.props.options.pageStartIndex&&(s=r.props.options.pageStartIndex),r._adjustHeaderWidth=r._adjustHeaderWidth.bind(r),r._adjustHeight=r._adjustHeight.bind(r),r._adjustTable=r._adjustTable.bind(r),r.state={data:r.getTableData(),currPage:s,expanding:r.props.options.expanding||[],sizePerPage:r.props.options.sizePerPage||_.default.SIZE_PER_PAGE_LIST[0],selectedRowKeys:r.store.getSelectedRowKeys(),reset:!1,x:r.props.keyBoardNav?0:-1,y:r.props.keyBoardNav?0:-1},r}return s(t,e),u(t,[{key:"initTable",value:function(e){var t=this,r=e.keyField,o="string"==typeof r&&r.length;if(c.default.Children.forEach(e.children,function(e){if(null!==e&&void 0!==e){if(e.props.isKey){if(r)throw new Error("Error. Multiple key column be detected in TableHeaderColumn.");r=e.props.dataField}e.props.filter&&(t.filter||(t.filter=new k.Filter),e.props.filter.emitter=t.filter)}}),this.filter&&(this.filter.removeAllListeners("onFilterChange"),this.filter.on("onFilterChange",function(e){t.handleFilterData(e)})),this.colInfos=this.getColumnsDescription(e).reduce(function(e,t){return e[t.name]=t,e},{}),!o&&!r)throw new Error("Error. No any key column defined in TableHeaderColumn.\n Use 'isKey={true}' to specify a unique column after version 0.5.4.");this.store.setProps({isPagination:e.pagination,keyField:r,colInfos:this.colInfos,multiColumnSearch:e.multiColumnSearch,strictSearch:e.strictSearch,multiColumnSort:e.multiColumnSort,remote:this.props.remote})}},{key:"getTableData",value:function(){var e=[],t=this.props,r=t.options,o=t.pagination,n=r.defaultSortName||r.sortName,a=r.defaultSortOrder||r.sortOrder,s=r.defaultSearch;if(n&&a&&(this.store.setSortInfo(a,n),this.allowRemote(_.default.REMOTE_SORT)||this.store.sort()),s&&this.store.search(s),o){var i=void 0,l=void 0;this.store.isChangedPage()?(l=this.state.sizePerPage,i=this.state.currPage):(l=r.sizePerPage||_.default.SIZE_PER_PAGE_LIST[0],i=r.page||1),e=this.store.page(i,l).get()}else e=this.store.get();return e}},{key:"getColumnsDescription",value:function(e){var t=e.children,r=0;return c.default.Children.forEach(t,function(e){null!==e&&void 0!==e&&Number(e.props.row)>r&&(r=Number(e.props.row))}),c.default.Children.map(t,function(e,t){if(null===e||void 0===e)return null;var o=e.props.row?Number(e.props.row):0,n=e.props.rowSpan?Number(e.props.rowSpan):1;return n+o===r+1?{name:e.props.dataField,align:e.props.dataAlign,sort:e.props.dataSort,format:e.props.dataFormat,formatExtraData:e.props.formatExtraData,filterFormatted:e.props.filterFormatted,filterValue:e.props.filterValue,editable:e.props.editable,customEditor:e.props.customEditor,hidden:e.props.hidden,hiddenOnInsert:e.props.hiddenOnInsert,searchable:e.props.searchable,className:e.props.columnClassName,editClassName:e.props.editColumnClassName,invalidEditColumnClassName:e.props.invalidEditColumnClassName,columnTitle:e.props.columnTitle,width:e.props.width,text:e.props.headerText||e.props.children,sortFunc:e.props.sortFunc,sortFuncExtraData:e.props.sortFuncExtraData,export:e.props.export,expandable:e.props.expandable,index:t,attrs:e.props.tdAttr,style:e.props.tdStyle}:void 0})}},{key:"reset",value:function(){var e=this.props.options.pageStartIndex;this.store.clean(),this.setState({data:this.getTableData(),currPage:S.default.getFirstPage(e),expanding:[],sizePerPage:_.default.SIZE_PER_PAGE_LIST[0],selectedRowKeys:this.store.getSelectedRowKeys(),reset:!0})}},{key:"componentWillReceiveProps",value:function(e){this.initTable(e);var t=e.options,r=e.selectRow;this.store.setData(e.data.slice());var o=this.state.currPage;this.props.options.page!==t.page&&(o=t.page);var n=this.state.sizePerPage;if(this.props.options.sizePerPage!==t.sizePerPage&&(n=t.sizePerPage),this.isRemoteDataSource()){var a=e.data.slice();e.pagination&&!this.allowRemote(_.default.REMOTE_PAGE)&&(a=this.store.page(o,n).get()),this.setState({data:a,currPage:o,sizePerPage:n,reset:!1})}else{o>Math.ceil(e.data.length/n)&&(o=1);var s=this.store.getSortInfo(),i=t.sortName,l=t.sortOrder;i&&l?(this.store.setSortInfo(l,i),this.store.sort()):s.length>0&&this.store.sort();var u=this.store.page(o,n).get();this.setState({data:u,currPage:o,sizePerPage:n,reset:!1}),this.store.isSearching&&t.afterSearch&&t.afterSearch(this.store.searchText,this.store.getDataIgnoringPagination()),this.store.isFiltering&&t.afterColumnFilter&&t.afterColumnFilter(this.store.filterObj,this.store.getDataIgnoringPagination())}if(this.props.options.expanding!==t.expanding&&this.setState({expanding:t.expanding||[]}),r&&r.selected){var p=r.selected.slice();this.store.setSelectedRowKey(p),this.setState({selectedRowKeys:p,reset:!1})}}},{key:"componentDidMount",value:function(){this._adjustTable(),window.addEventListener("resize",this._adjustTable),this.refs.body.refs.container.addEventListener("scroll",this._scrollHeader),this.props.scrollTop&&this._scrollTop()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._adjustTable),this.refs&&this.refs.body&&this.refs.body.refs&&this.refs.body.refs.container.removeEventListener("scroll",this._scrollHeader),this.filter&&this.filter.removeAllListeners("onFilterChange")}},{key:"componentDidUpdate",value:function(){this._adjustTable(),this._attachCellEditFunc(),this.props.options.afterTableComplete&&this.props.options.afterTableComplete()}},{key:"_attachCellEditFunc",value:function(){var e=this.props.cellEdit;e&&(this.props.cellEdit.__onCompleteEdit__=this.handleEditCell.bind(this),e.mode!==_.default.CELL_EDIT_NONE&&(this.props.selectRow.clickToSelect=!1))}},{key:"isRemoteDataSource",value:function(e){var t=e||this.props,r=t.remote;return r===!0||"function"==typeof r}},{key:"allowRemote",value:function(e,t){var r=t||this.props,o=r.remote;if("function"==typeof o){var n=o(_.default.REMOTE);return n[e]}return o}},{key:"render",value:function(){var e={height:this.props.height,maxHeight:this.props.maxHeight},t=this.getColumnsDescription(this.props),r=this.store.getSortInfo(),o=this.renderPagination(),n=this.renderToolBar(),a=this.renderTableFilter(t),s=this.isSelectAll(),i=this.props.expandColumnOptions;"undefined"==typeof i.expandColumnBeforeSelectColumn&&(i.expandColumnBeforeSelectColumn=!0);var u=S.default.renderColGroup(t,this.props.selectRow,i),p=this.props.options.sortIndicator;"undefined"==typeof this.props.options.sortIndicator&&(p=!0);var f=this.props.options.paginationPosition,h=void 0===f?_.default.PAGINATION_POS_BOTTOM:f,y=h!==_.default.PAGINATION_POS_BOTTOM,v=h!==_.default.PAGINATION_POS_TOP;return c.default.createElement("div",{className:(0,d.default)("react-bs-table-container",this.props.className,this.props.containerClass),style:this.props.containerStyle},n,y?o:null,c.default.createElement("div",{ref:"table",className:(0,d.default)("react-bs-table",{"react-bs-table-bordered":this.props.bordered},this.props.tableContainerClass),style:l({},e,this.props.tableStyle),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},c.default.createElement(b.default,{ref:"header",colGroups:u,headerContainerClass:this.props.headerContainerClass,tableHeaderClass:this.props.tableHeaderClass,style:this.props.headerStyle,rowSelectType:this.props.selectRow.mode,customComponent:this.props.selectRow.customComponent,hideSelectColumn:this.props.selectRow.hideSelectColumn,sortList:r,sortIndicator:p,onSort:this.handleSort,onSelectAllRow:this.handleSelectAllRow,bordered:this.props.bordered,condensed:this.props.condensed,isFiltered:!!this.filter,isSelectAll:s,reset:this.state.reset,expandColumnVisible:i.expandColumnVisible,expandColumnComponent:i.expandColumnComponent,expandColumnBeforeSelectColumn:i.expandColumnBeforeSelectColumn},this.props.children),c.default.createElement(T.default,{ref:"body",bodyContainerClass:this.props.bodyContainerClass,tableBodyClass:this.props.tableBodyClass,style:l({},e,this.props.bodyStyle),data:this.state.data,expandComponent:this.props.expandComponent,expandableRow:this.props.expandableRow,expandRowBgColor:this.props.options.expandRowBgColor,expandBy:this.props.options.expandBy||_.default.EXPAND_BY_ROW,columns:t,trClassName:this.props.trClassName,striped:this.props.striped,bordered:this.props.bordered,hover:this.props.hover,keyField:this.store.getKeyField(),condensed:this.props.condensed,selectRow:this.props.selectRow,expandColumnOptions:this.props.expandColumnOptions,cellEdit:this.props.cellEdit,selectedRowKeys:this.state.selectedRowKeys,onRowClick:this.handleRowClick,onRowDoubleClick:this.handleRowDoubleClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,noDataText:this.props.options.noDataText,withoutNoDataText:this.props.options.withoutNoDataText,expanding:this.state.expanding,onExpand:this.handleExpandRow,onlyOneExpanding:this.props.options.onlyOneExpanding,beforeShowError:this.props.options.beforeShowError,keyBoardNav:this.props.keyBoardNav,onNavigateCell:this.handleNavigateCell,x:this.state.x,y:this.state.y})),a,v?o:null)}},{key:"isSelectAll",value:function(){if(this.store.isEmpty())return!1;var e=this.props.selectRow,t=e.unselectable,r=e.onlyUnselectVisible,o=this.store.getKeyField(),n=r?this.store.get().map(function(e){return e[o]}):this.store.getAllRowkey(),a=this.store.getSelectedRowKeys();if(r&&(a=a.filter(function(e){return e!==n})),0===a.length)return!1;var s=0,i=0,l=0;return a.forEach(function(e){n.indexOf(e)!==-1?s++:i++,t&&t.indexOf(e)!==-1&&l++}),i!==a.length&&(s===n.length||!(t&&s<=l&&l===t.length)&&"indeterminate")}},{key:"cleanSelected",value:function(){this.store.setSelectedRowKey([]),this.setState({selectedRowKeys:[],reset:!1})}},{key:"cleanSort",value:function(){this.store.cleanSortInfo(),this.setState({reset:!1})}},{key:"__handleSort__REACT_HOT_LOADER__",value:function(e,t){if(this.props.options.onSortChange&&this.props.options.onSortChange(t,e,this.props),this.store.setSortInfo(e,t),!this.allowRemote(_.default.REMOTE_SORT)){var r=this.store.sort().get();this.setState({data:r,reset:!1})}}},{key:"__handleExpandRow__REACT_HOT_LOADER__",value:function(e,t,r){var o=this,n=this.props.options.onExpand;n&&n(t,!r),this.setState({expanding:e,reset:!1},function(){o._adjustHeaderWidth()})}},{key:"__handlePaginationData__REACT_HOT_LOADER__",value:function(e,t){var r=this.props.options,o=r.onPageChange,n=r.pageStartIndex,a=this.store.isEmpty();o&&o(e,t);var s={sizePerPage:t,reset:!1};if(a||(s.currPage=e),this.setState(s),!this.allowRemote(_.default.REMOTE_PAGE)&&!a){var i=this.store.page(S.default.getNormalizedPage(n,e),t).get();this.setState({data:i,reset:!1})}}},{key:"__handleMouseLeave__REACT_HOT_LOADER__",value:function(){this.props.options.onMouseLeave&&this.props.options.onMouseLeave()}},{key:"__handleMouseEnter__REACT_HOT_LOADER__",value:function(){this.props.options.onMouseEnter&&this.props.options.onMouseEnter()}},{key:"__handleRowMouseOut__REACT_HOT_LOADER__",value:function(e,t){this.props.options.onRowMouseOut&&this.props.options.onRowMouseOut(e,t)}},{key:"__handleRowMouseOver__REACT_HOT_LOADER__",value:function(e,t){this.props.options.onRowMouseOver&&this.props.options.onRowMouseOver(e,t)}},{key:"__handleNavigateCell__REACT_HOT_LOADER__",value:function(e){var t=e.x,r=e.y,o=e.lastEditCell,n=this.props.pagination,a=this.state,s=a.x,i=a.y,l=a.currPage;s+=t,i+=r;var u=this.store.getColInfos(),p=this.state.data.length,c=Object.keys(u).filter(function(e){return!u[e].hidden}).length;if(i>=p){l++;var f=n?this.refs.pagination.getLastPage():-1;if(!(l<=f))return;this.handlePaginationData(l,this.state.sizePerPage),i=0}else if(i<0){if(l--,!(l>0))return;this.handlePaginationData(l,this.state.sizePerPage),i=p-1}else if(s>=c){if(i+1===p){l++;var d=n?this.refs.pagination.getLastPage():-1;if(!(l<=d))return;this.handlePaginationData(l,this.state.sizePerPage),i=0}else i++;s=o?1:0}else if(s<0)if(s=c-1,0===i){if(l--,!(l>0))return;this.handlePaginationData(l,this.state.sizePerPage),i=this.state.sizePerPage-1}else i--;this.setState({x:s,y:i,currPage:l,reset:!1})}},{key:"__handleRowClick__REACT_HOT_LOADER__",value:function(e,t,r){var o=this.props,n=o.options,a=o.keyBoardNav;if(n.onRowClick&&n.onRowClick(e),a){var s="object"===("undefined"==typeof a?"undefined":i(a))?a:{},l=s.clickToNav;l=l!==!1||l,l&&this.setState({x:r,y:t,reset:!1})}}},{key:"__handleRowDoubleClick__REACT_HOT_LOADER__",value:function(e){this.props.options.onRowDoubleClick&&this.props.options.onRowDoubleClick(e)}},{key:"__handleSelectAllRow__REACT_HOT_LOADER__",value:function(e){var t=e.currentTarget.checked,r=this.store.getKeyField(),o=this.props.selectRow,n=o.onSelectAll,a=o.unselectable,s=o.selected,i=o.onlyUnselectVisible,l=i?this.state.selectedRowKeys:[],u=!0,p=this.store.get();if(t||i||(p=this.store.getRowByKey(this.state.selectedRowKeys)),a&&a.length>0&&(p=t?p.filter(function(e){return a.indexOf(e[r])===-1||s&&s.indexOf(e[r])!==-1}):p.filter(function(e){return a.indexOf(e[r])===-1})),n&&(u=this.props.selectRow.onSelectAll(t,p)),"undefined"==typeof u||u!==!1){if(t)if(Array.isArray(u))l=u;else{var c=p.map(function(e){return e[r]});l=i?l.concat(c):c}else a&&s?l=s.filter(function(e){return a.indexOf(e)>-1}):i&&!function(){var e=p.map(function(e){return e[r]});l=l.filter(function(t){return e.indexOf(t)===-1})}();this.store.setSelectedRowKey(l),this.setState({selectedRowKeys:l,reset:!1})}}},{key:"__handleShowOnlySelected__REACT_HOT_LOADER__",value:function(){this.store.ignoreNonSelected();var e=this.props.options.pageStartIndex,t=void 0;t=this.props.pagination?this.store.page(S.default.getNormalizedPage(e),this.state.sizePerPage).get():this.store.get(),this.setState({data:t,reset:!1,currPage:S.default.getFirstPage(e)})}},{key:"__handleSelectRow__REACT_HOT_LOADER__",value:function(e,t,r){var o=!0,n=this.store.getSelectedRowKeys(),a=e[this.store.getKeyField()],s=this.props.selectRow;s.onSelect&&(o=s.onSelect(e,t,r)),"undefined"!=typeof o&&o===!1||(s.mode===_.default.ROW_SELECT_SINGLE?n=t?[a]:[]:t?n.push(a):n=n.filter(function(e){return a!==e}),this.store.setSelectedRowKey(n),this.setState({selectedRowKeys:n,reset:!1}))}},{key:"handleEditCell",value:function(e,t,r){var o=this,n=this.props.cellEdit.beforeSaveCell,a=this.getColumnsDescription(this.props),s=a[r].name,i=function(){o.setState({data:o.store.get(),reset:!1})};if(n){var l=function(n){o.refs.body.cancelEditCell(),n||void 0===n?o.editCell(e,t,r):i()},u=n(this.state.data[t],s,e,l);if(u===!1&&"undefined"!=typeof u)return i();if(u===_.default.AWAIT_BEFORE_CELL_EDIT)return u}this.editCell(e,t,r)}},{key:"editCell",value:function(e,t,r){var o=this.props.options.onCellEdit,n=this.props.cellEdit.afterSaveCell,a=this.getColumnsDescription(this.props),s=a[r].name;if(o&&(e=o(this.state.data[t],s,e)),this.allowRemote(_.default.REMOTE_CELL_EDIT))return void(n&&n(this.state.data[t],s,e));var i=this.store.edit(e,t,s).get();this.setState({data:i,reset:!1}),n&&n(this.state.data[t],s,e)}},{key:"handleAddRowAtBegin",value:function(e){try{this.store.addAtBegin(e)}catch(e){return e}this._handleAfterAddingRow(e,!0)}},{key:"__handleAddRow__REACT_HOT_LOADER__",value:function(e){var t=this.props.options.onAddRow;if(t){var r=this.store.getColInfos();t(e,r)}if(this.allowRemote(_.default.REMOTE_INSERT_ROW))return this.props.options.afterInsertRow&&this.props.options.afterInsertRow(e),null;try{this.store.add(e)}catch(e){return e.message}this._handleAfterAddingRow(e,!1)}},{key:"getSizePerPage",value:function(){return this.state.sizePerPage}},{key:"getCurrentPage",value:function(){return this.state.currPage}},{key:"getTableDataIgnorePaging",value:function(){return this.store.getCurrentDisplayData()}},{key:"__getPageByRowKey__REACT_HOT_LOADER__",value:function(e){var t=this.state.sizePerPage,r=this.store.getCurrentDisplayData(),o=this.store.getKeyField(),n=r.findIndex(function(t){return t[o]===e});return n>-1?parseInt(n/t,10)+1:n}},{key:"__handleDropRow__REACT_HOT_LOADER__",value:function(e){var t=this,r=e?e:this.store.getSelectedRowKeys();r&&r.length>0&&(this.props.options.handleConfirmDeleteRow?this.props.options.handleConfirmDeleteRow(function(){t.deleteRow(r)},r):confirm("Are you sure you want to delete?")&&this.deleteRow(r))}},{key:"deleteRow",value:function(e){var t=this.props.options.onDeleteRow;if(t&&t(e),this.store.setSelectedRowKey([]),this.allowRemote(_.default.REMOTE_DROP_ROW))return void(this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e));this.store.remove(e);var r=void 0;if(this.props.pagination){var o=this.state.sizePerPage,n=Math.ceil(this.store.getDataNum()/o),a=this.state.currPage;a>n&&(a=n),r=this.store.page(S.default.getNormalizedPage(a),o).get(),this.setState({data:r,selectedRowKeys:this.store.getSelectedRowKeys(),currPage:a,reset:!1})}else r=this.store.get(),this.setState({data:r,reset:!1,selectedRowKeys:this.store.getSelectedRowKeys()});this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e)}},{key:"__handleFilterData__REACT_HOT_LOADER__",value:function(e){var t=this.props.options,r=t.onFilterChange,o=t.pageStartIndex;if(r){var n=this.store.getColInfos();r(e,n)}if(this.setState({currPage:S.default.getFirstPage(o),reset:!1}),this.allowRemote(_.default.REMOTE_FILTER))return void(this.props.options.afterColumnFilter&&this.props.options.afterColumnFilter(e,this.store.getDataIgnoringPagination()));this.store.filter(e);var a=this.store.getSortInfo();a.length>0&&this.store.sort();var s=void 0;if(this.props.pagination){var i=this.state.sizePerPage;s=this.store.page(S.default.getNormalizedPage(o),i).get()}else s=this.store.get();this.props.options.afterColumnFilter&&this.props.options.afterColumnFilter(e,this.store.getDataIgnoringPagination()),this.setState({data:s,reset:!1})}},{key:"__handleExportCSV__REACT_HOT_LOADER__",value:function(){var e={},t=this.props.csvFileName,r=this.props.options.onExportToCSV;e=r?r():this.store.getDataIgnoringPagination();var o=[];this.props.children.filter(function(e){return null!=e}).map(function(e){(e.props.export===!0||"undefined"==typeof e.props.export&&e.props.hidden===!1)&&o.push({field:e.props.dataField,format:e.props.csvFormat,extraData:e.props.csvFormatExtraData,header:e.props.csvHeader||e.props.dataField,row:Number(e.props.row)||0,rowSpan:Number(e.props.rowSpan)||1,colSpan:Number(e.props.colSpan)||1})}),"function"==typeof t&&(t=t()),(0,x.default)(e,o,t)}},{key:"__handleSearch__REACT_HOT_LOADER__",value:function(e){this.refs.toolbar&&this.refs.toolbar.setSearchInput(e);var t=this.props.options,r=t.onSearchChange,o=t.pageStartIndex;if(r){var n=this.store.getColInfos();r(e,n,this.props.multiColumnSearch)}if(this.setState({currPage:S.default.getFirstPage(o),reset:!1}),this.allowRemote(_.default.REMOTE_SEARCH))return void(this.props.options.afterSearch&&this.props.options.afterSearch(e,this.store.getDataIgnoringPagination()));this.store.search(e);var a=this.store.getSortInfo();a.length>0&&this.store.sort();var s=void 0;if(this.props.pagination){var i=this.state.sizePerPage;s=this.store.page(S.default.getNormalizedPage(o),i).get()}else s=this.store.get();this.props.options.afterSearch&&this.props.options.afterSearch(e,this.store.getDataIgnoringPagination()),this.setState({data:s,reset:!1})}},{key:"renderPagination",value:function(){if(this.props.pagination){var e=void 0;e=this.allowRemote(_.default.REMOTE_PAGE)?this.props.fetchInfo.dataTotalSize:this.store.getDataNum();var t=this.props.options,r=void 0===t.withFirstAndLast||t.withFirstAndLast;return Math.ceil(e/this.state.sizePerPage)<=1&&this.props.ignoreSinglePage?null:c.default.createElement("div",{className:"react-bs-table-pagination"},c.default.createElement(E.default,{ref:"pagination",withFirstAndLast:r,alwaysShowAllBtns:t.alwaysShowAllBtns,currPage:this.state.currPage,changePage:this.handlePaginationData,sizePerPage:this.state.sizePerPage,sizePerPageList:t.sizePerPageList||_.default.SIZE_PER_PAGE_LIST,pageStartIndex:t.pageStartIndex,paginationShowsTotal:t.paginationShowsTotal,paginationSize:t.paginationSize||_.default.PAGINATION_SIZE,dataSize:e,onSizePerPageList:t.onSizePerPageList,prePage:t.prePage||_.default.PRE_PAGE,nextPage:t.nextPage||_.default.NEXT_PAGE,firstPage:t.firstPage||_.default.FIRST_PAGE,lastPage:t.lastPage||_.default.LAST_PAGE,prePageTitle:t.prePageTitle||_.default.PRE_PAGE_TITLE,nextPageTitle:t.nextPageTitle||_.default.NEXT_PAGE_TITLE,firstPageTitle:t.firstPageTitle||_.default.FIRST_PAGE_TITLE,lastPageTitle:t.lastPageTitle||_.default.LAST_PAGE_TITLE,hideSizePerPage:t.hideSizePerPage,sizePerPageDropDown:t.sizePerPageDropDown,hidePageListOnlyOnePage:t.hidePageListOnlyOnePage,paginationPanel:t.paginationPanel,keepSizePerPageState:t.keepSizePerPageState,open:!1}))}return null}},{key:"renderToolBar",value:function(){var e=this.props,t=e.exportCSV,r=e.selectRow,o=e.insertRow,n=e.deleteRow,a=e.search,s=e.children,i=e.keyField,l=r&&r.showOnlySelected,u="undefined"==typeof this.props.options.printToolBar||this.props.options.printToolBar;if(l||o||n||a||t||this.props.options.searchPanel||this.props.options.btnGroup||this.props.options.toolBar){var p=void 0;return p=Array.isArray(s)?s.filter(function(e){return null!=e}).map(function(e,t){if(e){var r=e.props,o=r.isKey||i===r.dataField;return{isKey:o,name:r.headerText||r.children,field:r.dataField,hiddenOnInsert:r.hiddenOnInsert,keyValidator:r.keyValidator,customInsertEditor:r.customInsertEditor,autoValue:r.autoValue||!1,editable:r.editable&&"function"==typeof r.editable?r.editable():r.editable,format:!!r.dataFormat&&function(e){return r.dataFormat(e,null,r.formatExtraData,t).replace(/<.*?>/g,"")}}}}):[{name:s.props.headerText||s.props.children,field:s.props.dataField,editable:s.props.editable,customInsertEditor:s.props.customInsertEditor,hiddenOnInsert:s.props.hiddenOnInsert,keyValidator:s.props.keyValidator}],c.default.createElement("div",{className:"react-bs-table-tool-bar "+(u?"":"hidden-print")},c.default.createElement(O.default,{ref:"toolbar",defaultSearch:this.props.options.defaultSearch,clearSearch:this.props.options.clearSearch,searchPosition:this.props.options.searchPosition,searchDelayTime:this.props.options.searchDelayTime,enableInsert:o,enableDelete:n,enableSearch:a,enableExportCSV:t,enableShowOnlySelected:l,columns:p,searchPlaceholder:this.props.searchPlaceholder,exportCSVText:this.props.options.exportCSVText,insertText:this.props.options.insertText,deleteText:this.props.options.deleteText,saveText:this.props.options.saveText,closeText:this.props.options.closeText,ignoreEditable:this.props.options.ignoreEditable,onAddRow:this.handleAddRow,onDropRow:this.handleDropRow,onSearch:this.handleSearch,onExportCSV:this.handleExportCSV,onShowOnlySelected:this.handleShowOnlySelected,insertModalHeader:this.props.options.insertModalHeader,insertModalFooter:this.props.options.insertModalFooter,insertModalBody:this.props.options.insertModalBody,insertModal:this.props.options.insertModal,insertBtn:this.props.options.insertBtn,deleteBtn:this.props.options.deleteBtn,showSelectedOnlyBtn:this.props.options.showSelectedOnlyBtn,exportCSVBtn:this.props.options.exportCSVBtn,clearSearchBtn:this.props.options.clearSearchBtn,searchField:this.props.options.searchField,searchPanel:this.props.options.searchPanel,btnGroup:this.props.options.btnGroup,toolBar:this.props.options.toolBar,reset:this.state.reset,isValidKey:this.store.isValidKey}))}return null}},{key:"renderTableFilter",value:function(e){return this.props.columnFilter?c.default.createElement(P.default,{columns:e,rowSelectType:this.props.selectRow.mode,onFilter:this.handleFilterData}):null}},{key:"___scrollTop__REACT_HOT_LOADER__",value:function(){var e=this.props.scrollTop;e===_.default.SCROLL_TOP?this.refs.body.refs.container.scrollTop=0:e===_.default.SCROLL_BOTTOM?this.refs.body.refs.container.scrollTop=this.refs.body.refs.container.scrollHeight:"number"!=typeof e||isNaN(e)||(this.refs.body.refs.container.scrollTop=e)}},{key:"___scrollHeader__REACT_HOT_LOADER__",value:function(e){this.refs.header.refs.container.scrollLeft=e.currentTarget.scrollLeft; }},{key:"_adjustTable",value:function(){this._adjustHeight(),this.props.printable||this._adjustHeaderWidth()}},{key:"_adjustHeaderWidth",value:function(){var e=this.refs.header.getHeaderColGrouop(),t=this.refs.body.refs.tbody,r=this.refs.body.getHeaderColGrouop(),o=t.childNodes[0],n=t.parentNode.getBoundingClientRect().height>t.parentNode.parentNode.getBoundingClientRect().height,a=n?S.default.getScrollBarWidth():0;if(o&&this.store.getDataNum()){if(n||this.isVerticalScroll!==n)for(var s=o.childNodes,i=0;i<s.length;i++){var l=s[i],u=window.getComputedStyle(l),p=parseFloat(u.width.replace("px",""));if(this.isIE){var f=parseFloat(u.paddingLeft.replace("px","")),d=parseFloat(u.paddingRight.replace("px","")),h=parseFloat(u.borderRightWidth.replace("px","")),_=parseFloat(u.borderLeftWidth.replace("px",""));p=p+f+d+h+_}var y=s.length-1===i?a:0;p<=0&&(p=120,l.width=p+y+"px");var b=p+y+"px";e[i].style.width=b,e[i].style.minWidth=b,s.length-1===i?(r[i].style.width=p+"px",r[i].style.minWidth=p+"px"):(r[i].style.width=b,r[i].style.minWidth=b)}}else c.default.Children.forEach(this.props.children.filter(function(e){return!!e}),function(t,r){t.props.width&&(e[r].style.width=t.props.width+"px",e[r].style.minWidth=t.props.width+"px")});this.isVerticalScroll=n}},{key:"_adjustHeight",value:function(){var e=this.props.height,t=this.props.maxHeight;("number"==typeof e&&!isNaN(e)||e.indexOf("%")===-1)&&(this.refs.body.refs.container.style.height=parseFloat(e,10)-this.refs.header.refs.container.offsetHeight+"px"),t&&(t="number"==typeof t?t:parseInt(t.replace("px",""),10),this.refs.body.refs.container.style.maxHeight=t-this.refs.header.refs.container.offsetHeight+"px")}},{key:"_handleAfterAddingRow",value:function(e,t){var r=void 0;if(this.props.pagination){var o=this.state.sizePerPage;if(t){var n=this.props.options.pageStartIndex;r=this.store.page(S.default.getNormalizedPage(n),o).get(),this.setState({data:r,currPage:S.default.getFirstPage(n),reset:!1})}else{var a=Math.ceil(this.store.getDataNum()/o);r=this.store.page(a,o).get(),this.setState({data:r,currPage:a,reset:!1})}}else r=this.store.get(),this.setState({data:r,reset:!1});this.props.options.afterInsertRow&&this.props.options.afterInsertRow(e)}}]),t}(p.Component);D.propTypes={keyField:p.PropTypes.string,height:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.number]),maxHeight:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.number]),data:p.PropTypes.oneOfType([p.PropTypes.array,p.PropTypes.object]),remote:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.func]),scrollTop:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.number]),striped:p.PropTypes.bool,bordered:p.PropTypes.bool,hover:p.PropTypes.bool,condensed:p.PropTypes.bool,pagination:p.PropTypes.bool,printable:p.PropTypes.bool,keyBoardNav:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.object]),searchPlaceholder:p.PropTypes.string,selectRow:p.PropTypes.shape({mode:p.PropTypes.oneOf([_.default.ROW_SELECT_NONE,_.default.ROW_SELECT_SINGLE,_.default.ROW_SELECT_MULTI]),customComponent:p.PropTypes.func,bgColor:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.func]),selected:p.PropTypes.array,onSelect:p.PropTypes.func,onSelectAll:p.PropTypes.func,clickToSelect:p.PropTypes.bool,hideSelectColumn:p.PropTypes.bool,clickToSelectAndEditCell:p.PropTypes.bool,clickToExpand:p.PropTypes.bool,showOnlySelected:p.PropTypes.bool,unselectable:p.PropTypes.array,columnWidth:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string]),onlyUnselectVisible:p.PropTypes.bool}),cellEdit:p.PropTypes.shape({mode:p.PropTypes.string,blurToSave:p.PropTypes.bool,beforeSaveCell:p.PropTypes.func,afterSaveCell:p.PropTypes.func,nonEditableRows:p.PropTypes.func}),insertRow:p.PropTypes.bool,deleteRow:p.PropTypes.bool,search:p.PropTypes.bool,multiColumnSearch:p.PropTypes.bool,strictSearch:p.PropTypes.bool,columnFilter:p.PropTypes.bool,trClassName:p.PropTypes.any,tableStyle:p.PropTypes.object,containerStyle:p.PropTypes.object,headerStyle:p.PropTypes.object,bodyStyle:p.PropTypes.object,containerClass:p.PropTypes.string,tableContainerClass:p.PropTypes.string,headerContainerClass:p.PropTypes.string,bodyContainerClass:p.PropTypes.string,tableHeaderClass:p.PropTypes.string,tableBodyClass:p.PropTypes.string,options:p.PropTypes.shape({clearSearch:p.PropTypes.bool,sortName:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.array]),sortOrder:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.array]),defaultSortName:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.array]),defaultSortOrder:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.array]),sortIndicator:p.PropTypes.bool,afterTableComplete:p.PropTypes.func,afterDeleteRow:p.PropTypes.func,afterInsertRow:p.PropTypes.func,afterSearch:p.PropTypes.func,afterColumnFilter:p.PropTypes.func,onRowClick:p.PropTypes.func,onRowDoubleClick:p.PropTypes.func,page:p.PropTypes.number,pageStartIndex:p.PropTypes.number,paginationShowsTotal:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.func]),sizePerPageList:p.PropTypes.array,sizePerPage:p.PropTypes.number,paginationSize:p.PropTypes.number,paginationPosition:p.PropTypes.oneOf([_.default.PAGINATION_POS_TOP,_.default.PAGINATION_POS_BOTTOM,_.default.PAGINATION_POS_BOTH]),hideSizePerPage:p.PropTypes.bool,hidePageListOnlyOnePage:p.PropTypes.bool,alwaysShowAllBtns:p.PropTypes.bool,withFirstAndLast:p.PropTypes.bool,keepSizePerPageState:p.PropTypes.bool,onSortChange:p.PropTypes.func,onPageChange:p.PropTypes.func,onSizePerPageList:p.PropTypes.func,onFilterChange:c.default.PropTypes.func,onSearchChange:c.default.PropTypes.func,onAddRow:c.default.PropTypes.func,onExportToCSV:c.default.PropTypes.func,onCellEdit:c.default.PropTypes.func,noDataText:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.object]),withoutNoDataText:c.default.PropTypes.bool,handleConfirmDeleteRow:p.PropTypes.func,prePage:p.PropTypes.any,nextPage:p.PropTypes.any,firstPage:p.PropTypes.any,lastPage:p.PropTypes.any,prePageTitle:p.PropTypes.string,nextPageTitle:p.PropTypes.string,firstPageTitle:p.PropTypes.string,lastPageTitle:p.PropTypes.string,searchDelayTime:p.PropTypes.number,exportCSVText:p.PropTypes.string,insertText:p.PropTypes.string,deleteText:p.PropTypes.string,saveText:p.PropTypes.string,closeText:p.PropTypes.string,ignoreEditable:p.PropTypes.bool,defaultSearch:p.PropTypes.string,insertModalHeader:p.PropTypes.func,insertModalBody:p.PropTypes.func,insertModalFooter:p.PropTypes.func,insertModal:p.PropTypes.func,insertBtn:p.PropTypes.func,deleteBtn:p.PropTypes.func,showSelectedOnlyBtn:p.PropTypes.func,exportCSVBtn:p.PropTypes.func,clearSearchBtn:p.PropTypes.func,searchField:p.PropTypes.func,searchPanel:p.PropTypes.func,btnGroup:p.PropTypes.func,toolBar:p.PropTypes.func,sizePerPageDropDown:p.PropTypes.func,paginationPanel:p.PropTypes.func,searchPosition:p.PropTypes.string,expandRowBgColor:p.PropTypes.string,expandBy:p.PropTypes.string,expanding:p.PropTypes.array,onExpand:p.PropTypes.func,onlyOneExpanding:p.PropTypes.bool,beforeShowError:p.PropTypes.func,printToolBar:p.PropTypes.bool}),fetchInfo:p.PropTypes.shape({dataTotalSize:p.PropTypes.number}),exportCSV:p.PropTypes.bool,csvFileName:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.func]),ignoreSinglePage:p.PropTypes.bool,expandableRow:p.PropTypes.func,expandComponent:p.PropTypes.func,expandColumnOptions:p.PropTypes.shape({columnWidth:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string]),expandColumnVisible:p.PropTypes.bool,expandColumnComponent:p.PropTypes.func,expandColumnBeforeSelectColumn:p.PropTypes.bool})},D.defaultProps={scrollTop:void 0,expandComponent:void 0,expandableRow:void 0,expandColumnOptions:{expandColumnVisible:!1,expandColumnComponent:void 0,expandColumnBeforeSelectColumn:!0},height:"100%",maxHeight:void 0,striped:!1,bordered:!0,hover:!1,condensed:!1,pagination:!1,printable:!1,keyBoardNav:!1,searchPlaceholder:void 0,selectRow:{mode:_.default.ROW_SELECT_NONE,bgColor:_.default.ROW_SELECT_BG_COLOR,selected:[],onSelect:void 0,onSelectAll:void 0,clickToSelect:!1,hideSelectColumn:!1,clickToSelectAndEditCell:!1,clickToExpand:!1,showOnlySelected:!1,unselectable:[],customComponent:void 0,onlyUnselectVisible:!1},cellEdit:{mode:_.default.CELL_EDIT_NONE,blurToSave:!1,beforeSaveCell:void 0,afterSaveCell:void 0,nonEditableRows:void 0},insertRow:!1,deleteRow:!1,search:!1,multiColumnSearch:!1,strictSearch:void 0,multiColumnSort:1,columnFilter:!1,trClassName:"",tableStyle:void 0,containerStyle:void 0,headerStyle:void 0,bodyStyle:void 0,containerClass:null,tableContainerClass:null,headerContainerClass:null,bodyContainerClass:null,tableHeaderClass:null,tableBodyClass:null,options:{clearSearch:!1,sortName:void 0,sortOrder:void 0,defaultSortName:void 0,defaultSortOrder:void 0,sortIndicator:!0,afterTableComplete:void 0,afterDeleteRow:void 0,afterInsertRow:void 0,afterSearch:void 0,afterColumnFilter:void 0,onRowClick:void 0,onRowDoubleClick:void 0,onMouseLeave:void 0,onMouseEnter:void 0,onRowMouseOut:void 0,onRowMouseOver:void 0,page:void 0,paginationShowsTotal:!1,sizePerPageList:_.default.SIZE_PER_PAGE_LIST,sizePerPage:void 0,paginationSize:_.default.PAGINATION_SIZE,paginationPosition:_.default.PAGINATION_POS_BOTTOM,hideSizePerPage:!1,hidePageListOnlyOnePage:!1,alwaysShowAllBtns:!1,withFirstAndLast:!0,keepSizePerPageState:!1,onSizePerPageList:void 0,noDataText:void 0,withoutNoDataText:!1,handleConfirmDeleteRow:void 0,prePage:_.default.PRE_PAGE,nextPage:_.default.NEXT_PAGE,firstPage:_.default.FIRST_PAGE,lastPage:_.default.LAST_PAGE,prePageTitle:_.default.PRE_PAGE_TITLE,nextPageTitle:_.default.NEXT_PAGE_TITLE,firstPageTitle:_.default.FIRST_PAGE_TITLE,lastPageTitle:_.default.LAST_PAGE_TITLE,pageStartIndex:1,searchDelayTime:void 0,exportCSVText:_.default.EXPORT_CSV_TEXT,insertText:_.default.INSERT_BTN_TEXT,deleteText:_.default.DELETE_BTN_TEXT,saveText:_.default.SAVE_BTN_TEXT,closeText:_.default.CLOSE_BTN_TEXT,ignoreEditable:!1,defaultSearch:"",insertModalHeader:void 0,insertModalBody:void 0,insertModalFooter:void 0,insertModal:void 0,insertBtn:void 0,deleteBtn:void 0,showSelectedOnlyBtn:void 0,exportCSVBtn:void 0,clearSearchBtn:void 0,searchField:void 0,searchPanel:void 0,btnGroup:void 0,toolBar:void 0,sizePerPageDropDown:void 0,paginationPanel:void 0,searchPosition:"right",expandRowBgColor:void 0,expandBy:_.default.EXPAND_BY_ROW,expanding:[],onExpand:void 0,onlyOneExpanding:!1,beforeShowError:void 0,printToolBar:!0},fetchInfo:{dataTotalSize:0},exportCSV:!1,csvFileName:"spreadsheet.csv",ignoreSinglePage:!1};var j=D;t.default=j;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(D,"BootstrapTable","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/BootstrapTable.js"),__REACT_HOT_LOADER__.register(j,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/BootstrapTable.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(3),f=o(c),d=function(e){function t(){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),l(t,[{key:"render",value:function(){var e=this.props.className,t={style:{backgroundColor:this.props.bgColor},className:(0,f.default)(e)};return p.default.createElement("tr",i({hidden:this.props.hidden,width:this.props.width},t),p.default.createElement("td",{colSpan:this.props.colSpan},this.props.children))}}]),t}(u.Component),h=d;t.default=h;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(d,"ExpandComponent","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/ExpandComponent.js"),__REACT_HOT_LOADER__.register(h,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/ExpandComponent.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Filter=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(2),p=o(u),c=r(218),f=t.Filter=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.currentFilter={},r}return s(t,e),l(t,[{key:"handleFilter",value:function(e,t,r,o){var n=r||p.default.FILTER_TYPE.CUSTOM,a={cond:o.condition};if(null!==t&&"object"===("undefined"==typeof t?"undefined":i(t))){var s=!0;for(var l in t)if(!t[l]||""===t[l]){s=!1;break}s?this.currentFilter[e]={value:t,type:n,props:a}:delete this.currentFilter[e]}else t&&""!==t.trim()?this.currentFilter[e]={value:t.trim(),type:n,props:a}:delete this.currentFilter[e];this.emit("onFilterChange",this.currentFilter)}}]),t}(c.EventEmitter);(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(f,"Filter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/Filter.js")})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=function(e){function t(){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),i(t,[{key:"render",value:function(){return u.default.createElement("th",{rowSpan:this.props.rowCount,style:{textAlign:"center"},"data-is-only-head":!1},this.props.children)}}]),t}(l.Component);p.propTypes={children:l.PropTypes.node,rowCount:l.PropTypes.number};var c=p;t.default=c;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(p,"SelectRowHeaderColumn","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/SelectRowHeaderColumn.js"),__REACT_HOT_LOADER__.register(c,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/SelectRowHeaderColumn.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(19),d=o(f),h=r(2),_=o(h),y=r(194),b=o(y),v=r(189),T=o(v),m=r(190),E=o(m),g=r(3),O=o(g),C=r(185),P=o(C),w=function(e){return e&&"function"==typeof e},R=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleCellKeyDown=function(){return r.__handleCellKeyDown__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowMouseOut=function(){return r.__handleRowMouseOut__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowMouseOver=function(){return r.__handleRowMouseOver__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowClick=function(){return r.__handleRowClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleRowDoubleClick=function(){return r.__handleRowDoubleClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleSelectRow=function(){return r.__handleSelectRow__REACT_HOT_LOADER__.apply(r,arguments)},r.handleSelectRowColumChange=function(){return r.__handleSelectRowColumChange__REACT_HOT_LOADER__.apply(r,arguments)},r.handleClickCell=function(){return r.__handleClickCell__REACT_HOT_LOADER__.apply(r,arguments)},r.handleEditCell=function(){return r.__handleEditCell__REACT_HOT_LOADER__.apply(r,arguments)},r.nextEditableCell=function(){return r.__nextEditableCell__REACT_HOT_LOADER__.apply(r,arguments)},r.handleCompleteEditCell=function(){return r.__handleCompleteEditCell__REACT_HOT_LOADER__.apply(r,arguments)},r.cancelEditCell=function(){return r.__cancelEditCell__REACT_HOT_LOADER__.apply(r,arguments)},r.handleClickonSelectColumn=function(){return r.__handleClickonSelectColumn__REACT_HOT_LOADER__.apply(r,arguments)},r.getHeaderColGrouop=function(){return r.__getHeaderColGrouop__REACT_HOT_LOADER__.apply(r,arguments)},r.state={currEditCell:null},r}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.cellEdit,r=e.beforeShowError,o=e.x,n=e.y,a=e.keyBoardNav,s=(0,O.default)("table",{"table-striped":this.props.striped,"table-bordered":this.props.bordered,"table-hover":this.props.hover,"table-condensed":this.props.condensed},this.props.tableBodyClass),i=t.nonEditableRows&&t.nonEditableRows()||[],u=this.props.selectRow.unselectable||[],p=this._isSelectRowDefined(),f=d.default.renderColGroup(this.props.columns,this.props.selectRow,this.props.expandColumnOptions),h=this.props.selectRow.mode===_.default.ROW_SELECT_SINGLE?"radio":"checkbox",y=this.props.selectRow.customComponent,v=a===!0||"object"===("undefined"==typeof a?"undefined":l(a)),m="object"===("undefined"==typeof a?"undefined":l(a))?a.customStyleOnEditCell:null,g="object"===("undefined"==typeof a?"undefined":l(a))?a.customStyle:null,C=this.props.expandColumnOptions.expandColumnComponent,R=this.props.columns.filter(function(e){return e&&!e.hidden}).length;p&&!this.props.selectRow.hideSelectColumn&&(R+=1);var S=1;this.props.expandColumnOptions.expandColumnVisible&&(R+=1);var A=this.props.data.map(function(e,a){var s=this.props.columns.filter(function(e){return null!=e}).map(function(s,l){var u=e[s.name],p=a===n&&l===o;if(s.name!==this.props.keyField&&s.editable&&s.editable.readOnly!==!0&&null!==this.state.currEditCell&&this.state.currEditCell.rid===a&&this.state.currEditCell.cid===l&&i.indexOf(e[this.props.keyField])===-1){var f=s.editable,d=!!s.format&&function(t){return s.format(t,e,s.formatExtraData,a).replace(/<.*?>/g,"")};return w(s.editable)&&(f=s.editable(u,e,a,l)),c.default.createElement(E.default,{completeEdit:this.handleCompleteEditCell,editable:f,customEditor:s.customEditor,format:!!s.format&&d,key:l,blurToSave:t.blurToSave,onTab:this.handleEditCell,rowIndex:a,colIndex:l,row:e,fieldValue:u,className:s.editClassName,invalidColumnClassName:s.invalidEditColumnClassName,beforeShowError:r,isFocus:p,customStyleWithNav:m})}var h=u&&u.toString(),_=null,y=s.className;if(w(s.className)&&(y=s.className(u,e,a,l)),"undefined"!=typeof s.format){var b=s.format(u,e,s.formatExtraData,a);c.default.isValidElement(b)?(h=b,_=s.columnTitle&&b?b.toString():null):h=c.default.createElement("div",{dangerouslySetInnerHTML:{__html:b}})}else _=s.columnTitle&&u?u.toString():null;return c.default.createElement(T.default,{key:l,rIndex:a,dataAlign:s.align,className:y,columnTitle:_,cellEdit:t,hidden:s.hidden,onEdit:this.handleEditCell,width:s.width,onClick:this.handleClickCell,attrs:s.attrs,style:s.style,tabIndex:S++ +"",isFocus:p,keyBoardNav:v,onKeyDown:this.handleCellKeyDown,customNavStyle:g,row:e},h)},this),l=e[this.props.keyField],f=u.indexOf(l)!==-1,d=this.props.selectedRowKeys.indexOf(l)!==-1,O=p&&!this.props.selectRow.hideSelectColumn?this.renderSelectRowColumn(d,h,f,y,a,e):null,A=this.renderExpandRowColumn(this.props.expandableRow&&this.props.expandableRow(e),this.props.expanding.indexOf(l)>-1,C,a,e),x=this.props.trClassName;w(this.props.trClassName)&&(x=this.props.trClassName(e,a));var k=[c.default.createElement(b.default,{isSelected:d,key:l,className:x,index:a,row:e,selectRow:p?this.props.selectRow:void 0,enableCellEdit:t.mode!==_.default.CELL_EDIT_NONE,onRowClick:this.handleRowClick,onRowDoubleClick:this.handleRowDoubleClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,onExpandRow:this.handleClickCell,unselectableRow:f},this.props.expandColumnOptions.expandColumnVisible&&this.props.expandColumnOptions.expandColumnBeforeSelectColumn&&A,O,this.props.expandColumnOptions.expandColumnVisible&&!this.props.expandColumnOptions.expandColumnBeforeSelectColumn&&A,s)];return this.props.expandableRow&&this.props.expandableRow(e)&&k.push(c.default.createElement(P.default,{key:l+"-expand",row:e,className:x,bgColor:this.props.expandRowBgColor||this.props.selectRow.bgColor||void 0,hidden:!(this.props.expanding.indexOf(l)>-1),colSpan:R,width:"100%"},this.props.expandComponent(e))),k},this);if(0===A.length&&!this.props.withoutNoDataText){var x=this.props.columns.filter(function(e){return!e.hidden}).length+(p?1:0);A=[c.default.createElement(b.default,{key:"##table-empty##"},c.default.createElement("td",{"data-toggle":"collapse",colSpan:x,className:"react-bs-table-no-data"},this.props.noDataText||_.default.NO_DATA_TEXT))]}return c.default.createElement("div",{ref:"container",className:(0,O.default)("react-bs-container-body",this.props.bodyContainerClass),style:this.props.style},c.default.createElement("table",{className:s},c.default.cloneElement(f,{ref:"header"}),c.default.createElement("tbody",{ref:"tbody"},A)))}},{key:"__handleCellKeyDown__REACT_HOT_LOADER__",value:function(e,t){e.preventDefault();var r=this.props,o=r.keyBoardNav,n=r.onNavigateCell,a=r.cellEdit,s=void 0;if(37===e.keyCode)s={x:-1,y:0};else if(38===e.keyCode)s={x:0,y:-1};else if(39===e.keyCode||9===e.keyCode)s={x:1,y:0},9===e.keyCode&&t&&(s=i({},s,{lastEditCell:t}));else if(40===e.keyCode)s={x:0,y:1};else if(13===e.keyCode){var u="object"===("undefined"==typeof o?"undefined":l(o))&&o.enterToEdit;a&&u&&this.handleEditCell(e.target.parentElement.rowIndex+1,e.currentTarget.cellIndex,"",e)}s&&o&&n(s)}},{key:"__handleRowMouseOut__REACT_HOT_LOADER__",value:function(e,t){var r=this.props.data[e];this.props.onRowMouseOut(r,t)}},{key:"__handleRowMouseOver__REACT_HOT_LOADER__",value:function(e,t){var r=this.props.data[e];this.props.onRowMouseOver(r,t)}},{key:"__handleRowClick__REACT_HOT_LOADER__",value:function(e,t){var r=this.props.onRowClick;this._isSelectRowDefined()&&t--,this._isExpandColumnVisible()&&t--,r(this.props.data[e-1],e-1,t)}},{key:"__handleRowDoubleClick__REACT_HOT_LOADER__",value:function(e){var t=this.props.onRowDoubleClick,r=this.props.data[e];t(r)}},{key:"__handleSelectRow__REACT_HOT_LOADER__",value:function(e,t,r){var o=void 0,n=this.props,a=n.data,s=n.onSelectRow;a.forEach(function(t,r){if(r===e-1)return o=t,!1}),s(o,t,r)}},{key:"__handleSelectRowColumChange__REACT_HOT_LOADER__",value:function(e,t){this.props.selectRow.clickToSelect&&this.props.selectRow.clickToSelectAndEditCell||this.handleSelectRow(t+1,e.currentTarget.checked,e)}},{key:"__handleClickCell__REACT_HOT_LOADER__",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=this.props,n=o.columns,a=o.keyField,s=o.expandBy,i=o.expandableRow,l=o.selectRow.clickToExpand,u=o.onlyOneExpanding,p=!(this._isSelectRowDefined()&&!l);r=this._isSelectRowDefined()?r-1:r,r=this._isExpandColumnVisible()?r-1:r,i&&p&&(s===_.default.EXPAND_BY_ROW||s===_.default.EXPAND_BY_COL&&r<0||s===_.default.EXPAND_BY_COL&&n[r].expandable)&&!function(){var r=t.props.expanding,o=t.props.data[e-1][a],n=r.indexOf(o)>-1;n?r=r.filter(function(e){return e!==o}):u?r=[o]:r.push(o),t.props.onExpand(r,o,n)}()}},{key:"__handleEditCell__REACT_HOT_LOADER__",value:function(e,t,r,o){var n=this.props.selectRow,a=this._isSelectRowDefined(),s=this._isExpandColumnVisible();if(a&&(t--,n.hideSelectColumn&&t++),s&&t--,e--,"tab"===r){a&&!n.hideSelectColumn&&t++,s&&t++,this.handleCompleteEditCell(o.target.value,e,t-1),t>=this.props.columns.length?this.handleCellKeyDown(o,!0):this.handleCellKeyDown(o);var i=this.nextEditableCell(e,t),l=i.nextRIndex,u=i.nextCIndex;e=l,t=u}var p={currEditCell:{rid:e,cid:t}};if(this.props.selectRow.clickToSelectAndEditCell&&this.props.cellEdit.mode!==_.default.CELL_EDIT_DBCLICK){var c=this.props.selectedRowKeys.indexOf(this.props.data[e][this.props.keyField])!==-1;this.handleSelectRow(e+1,!c,o)}this.setState(p)}},{key:"__nextEditableCell__REACT_HOT_LOADER__",value:function(e,t){var r=this.props.keyField,o=e,n=t,a=void 0,s=void 0;do{if(n>=this.props.columns.length&&(o++,n=0),a=this.props.data[o],s=this.props.columns[n],!a)break;var i=s.editable;if(w(s.editable)&&(i=s.editable(s,a,o,n)),i&&i.readOnly!==!0&&!s.hidden&&r!==s.name)break;n++}while(a);return{nextRIndex:o,nextCIndex:n}}},{key:"__handleCompleteEditCell__REACT_HOT_LOADER__",value:function(e,t,r){if(null!==e){var o=this.props.cellEdit.__onCompleteEdit__(e,t,r);o!==_.default.AWAIT_BEFORE_CELL_EDIT&&this.setState({currEditCell:null})}else this.setState({currEditCell:null})}},{key:"__cancelEditCell__REACT_HOT_LOADER__",value:function(){this.setState({currEditCell:null})}},{key:"__handleClickonSelectColumn__REACT_HOT_LOADER__",value:function(e,t,r,o){if(e.stopPropagation(),"TD"===e.target.tagName&&(this.props.selectRow.clickToSelect||this.props.selectRow.clickToSelectAndEditCell)){var n=this.props.selectRow.unselectable||[];n.indexOf(o[this.props.keyField])===-1&&(this.handleSelectRow(r+1,t,e),this.handleClickCell(r+1))}}},{key:"renderSelectRowColumn",value:function(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments[5];return c.default.createElement("td",{onClick:function(t){n.handleClickonSelectColumn(t,!e,a,s)},style:{textAlign:"center"}},o?c.default.createElement(o,{type:t,checked:e,disabled:r,rowIndex:a,onChange:function(e){return n.handleSelectRowColumChange(e,a)}}):c.default.createElement("input",{type:t,checked:e,disabled:r,onChange:function(e){return n.handleSelectRowColumChange(e,a)}}))}},{key:"renderExpandRowColumn",value:function(e,t,r){var o=this,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=null;return a=r?c.default.createElement(r,{isExpandableRow:e,isExpanded:t}):e?t?c.default.createElement("span",{className:"glyphicon glyphicon-minus"}):c.default.createElement("span",{className:"glyphicon glyphicon-plus"}):" ",c.default.createElement("td",{className:"react-bs-table-expand-cell",onClick:function(){return o.handleClickCell(n+1)}},a)}},{key:"_isSelectRowDefined",value:function(){return this.props.selectRow.mode===_.default.ROW_SELECT_SINGLE||this.props.selectRow.mode===_.default.ROW_SELECT_MULTI}},{key:"_isExpandColumnVisible",value:function(){return this.props.expandColumnOptions.expandColumnVisible}},{key:"__getHeaderColGrouop__REACT_HOT_LOADER__",value:function(){return this.refs.header.childNodes}}]),t}(p.Component);R.propTypes={data:p.PropTypes.array,columns:p.PropTypes.array,striped:p.PropTypes.bool,bordered:p.PropTypes.bool,hover:p.PropTypes.bool,condensed:p.PropTypes.bool,keyField:p.PropTypes.string,selectedRowKeys:p.PropTypes.array,onRowClick:p.PropTypes.func,onRowDoubleClick:p.PropTypes.func,onSelectRow:p.PropTypes.func,noDataText:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.object]),withoutNoDataText:p.PropTypes.bool,style:p.PropTypes.object,tableBodyClass:p.PropTypes.string,bodyContainerClass:p.PropTypes.string,expandableRow:p.PropTypes.func,expandComponent:p.PropTypes.func,expandRowBgColor:p.PropTypes.string,expandBy:p.PropTypes.string,expanding:p.PropTypes.array,onExpand:p.PropTypes.func,onlyOneExpanding:p.PropTypes.bool,beforeShowError:p.PropTypes.func,keyBoardNav:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.object]),x:p.PropTypes.number,y:p.PropTypes.number,onNavigateCell:p.PropTypes.func};var S=R;t.default=S;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(w,"isFun","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableBody.js"),__REACT_HOT_LOADER__.register(R,"TableBody","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableBody.js"),__REACT_HOT_LOADER__.register(S,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableBody.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){ return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(6),d=o(f),h=r(2),_=o(h),y=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleCellEdit=function(){return r.__handleCellEdit__REACT_HOT_LOADER__.apply(r,arguments)},r.handleCellClick=function(){return r.__handleCellClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleKeyDown=function(){return r.__handleKeyDown__REACT_HOT_LOADER__.apply(r,arguments)},r}return s(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e,t){var r=this.props.children,o=this.props.width!==e.width||this.props.className!==e.className||this.props.hidden!==e.hidden||this.props.dataAlign!==e.dataAlign||this.props.isFocus!==e.isFocus||("undefined"==typeof r?"undefined":l(r))!==l(e.children)||(""+this.props.onEdit).toString()!==(""+e.onEdit).toString();return o?o:(o="object"===("undefined"==typeof r?"undefined":l(r))&&null!==r&&null!==r.props?"checkbox"!==r.props.type&&"radio"!==r.props.type||(o||r.props.type!==e.children.props.type||r.props.checked!==e.children.props.checked||r.props.disabled!==e.children.props.disabled):o||r!==e.children,o?o:!(!this.props.cellEdit||!e.cellEdit)&&(o||this.props.cellEdit.mode!==e.cellEdit.mode))}},{key:"componentDidMount",value:function(){var e=d.default.findDOMNode(this);this.props.isFocus?e.focus():e.blur()}},{key:"componentDidUpdate",value:function(){var e=d.default.findDOMNode(this);this.props.isFocus?e.focus():e.blur()}},{key:"__handleCellEdit__REACT_HOT_LOADER__",value:function(e){if(this.props.cellEdit.mode===_.default.CELL_EDIT_DBCLICK)if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var t=window.getSelection();t.removeAllRanges()}this.props.onEdit(this.props.rIndex+1,e.currentTarget.cellIndex,e),this.props.cellEdit.mode!==_.default.CELL_EDIT_DBCLICK&&this.props.onClick(this.props.rIndex+1,e.currentTarget.cellIndex,e)}},{key:"__handleCellClick__REACT_HOT_LOADER__",value:function(e){var t=this.props,r=t.onClick,o=t.rIndex;r&&r(o+1,e.currentTarget.cellIndex,e)}},{key:"__handleKeyDown__REACT_HOT_LOADER__",value:function(e){this.props.keyBoardNav&&this.props.onKeyDown(e)}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.columnTitle,o=e.dataAlign,n=e.hidden,a=e.cellEdit,s=e.attrs,l=e.style,u=e.isFocus,p=e.keyBoardNav,f=e.tabIndex,d=e.customNavStyle,h=e.row,y=this.props.className,b=i({textAlign:o,display:n?"none":null},l),v={};if(a&&(a.mode===_.default.CELL_EDIT_CLICK?v.onClick=this.handleCellEdit:a.mode===_.default.CELL_EDIT_DBCLICK?v.onDoubleClick=this.handleCellEdit:v.onClick=this.handleCellClick),p&&u&&(v.onKeyDown=this.handleKeyDown),u)if(d){var T="function"==typeof d?d(t,h):d;b=i({},b,T)}else y+=" default-focus-cell";return c.default.createElement("td",i({tabIndex:f,style:b,title:r,className:y},v,s),"boolean"==typeof t?t.toString():t)}}]),t}(p.Component);y.propTypes={rIndex:p.PropTypes.number,dataAlign:p.PropTypes.string,hidden:p.PropTypes.bool,className:p.PropTypes.string,columnTitle:p.PropTypes.string,children:p.PropTypes.node,onClick:p.PropTypes.func,attrs:p.PropTypes.object,style:p.PropTypes.object,isFocus:p.PropTypes.bool,onKeyDown:p.PropTypes.func,tabIndex:p.PropTypes.string,keyBoardNav:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.object]),customNavStyle:p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object]),row:p.PropTypes.any},y.defaultProps={dataAlign:"left",hidden:!1,className:"",isFocus:!1,keyBoardNav:!1};var b=y;t.default=b;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(y,"TableColumn","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableColumn.js"),__REACT_HOT_LOADER__.register(b,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableColumn.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(6),d=o(f),h=r(54),_=o(h),y=r(55),b=o(y),v=r(3),T=o(v),m=r(2),E=o(m),g=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.handleKeyPress=function(){return r.__handleKeyPress__REACT_HOT_LOADER__.apply(r,arguments)},r.handleBlur=function(){return r.__handleBlur__REACT_HOT_LOADER__.apply(r,arguments)},r.handleCustomUpdate=function(){return r.__handleCustomUpdate__REACT_HOT_LOADER__.apply(r,arguments)},r.notifyToastr=function(){return r.__notifyToastr__REACT_HOT_LOADER__.apply(r,arguments)},r.handleClick=function(){return r.__handleClick__REACT_HOT_LOADER__.apply(r,arguments)},r.timeouteClear=0;var o=r.props,s=o.fieldValue,i=o.row,l=o.className;return r.focusInEditor=r.focusInEditor.bind(r),r.state={shakeEditor:!1,className:"function"==typeof l?l(s,i):l},r}return s(t,e),u(t,[{key:"valueShortCircuit",value:function(e){return null===e||"undefined"==typeof e?"":e}},{key:"__handleKeyPress__REACT_HOT_LOADER__",value:function(e){if(13===e.keyCode||9===e.keyCode){var t="checkbox"===e.currentTarget.type?this._getCheckBoxValue(e):e.currentTarget.value;if(!this.validator(t))return;13===e.keyCode?this.props.completeEdit(t,this.props.rowIndex,this.props.colIndex):(this.props.onTab(this.props.rowIndex+1,this.props.colIndex+1,"tab",e),e.preventDefault())}else if(27===e.keyCode)this.props.completeEdit(null,this.props.rowIndex,this.props.colIndex);else if("click"===e.type&&!this.props.blurToSave){var r=e.target.parentElement.firstChild.value;if(!this.validator(r))return;this.props.completeEdit(r,this.props.rowIndex,this.props.colIndex)}}},{key:"__handleBlur__REACT_HOT_LOADER__",value:function(e){if(e.stopPropagation(),this.props.blurToSave){var t="checkbox"===e.currentTarget.type?this._getCheckBoxValue(e):e.currentTarget.value;if(!this.validator(t))return!1;this.props.completeEdit(t,this.props.rowIndex,this.props.colIndex)}}},{key:"__handleCustomUpdate__REACT_HOT_LOADER__",value:function(e){this.validator(e)&&this.props.completeEdit(e,this.props.rowIndex,this.props.colIndex)}},{key:"validator",value:function(e){var t=this,r=!0;if(t.props.editable.validator){var o=t.props.editable.validator(e,this.props.row),n="undefined"==typeof o?"undefined":l(o);if("object"!==n&&o!==!0?(r=!1,this.notifyToastr("error",o,E.default.CANCEL_TOASTR)):"object"===n&&o.isValid!==!0&&(r=!1,this.notifyToastr(o.notification.type,o.notification.msg,o.notification.title)),!r){t.clearTimeout();var a=this.props,s=a.invalidColumnClassName,i=a.row,u="function"==typeof s?s(e,i):s;return t.setState({shakeEditor:!0,className:u}),t.timeouteClear=setTimeout(function(){t.setState({shakeEditor:!1})},300),this.focusInEditor(),r}}return r}},{key:"__notifyToastr__REACT_HOT_LOADER__",value:function(e,t,r){var o=!0,n=this.props.beforeShowError;n&&(o=n(e,t,r)),o&&this.refs.notifier.notice(e,t,r)}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){0!==this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"componentDidMount",value:function(){this.focusInEditor();var e=d.default.findDOMNode(this);this.props.isFocus?e.focus():e.blur()}},{key:"componentDidUpdate",value:function(){var e=d.default.findDOMNode(this);this.props.isFocus?e.focus():e.blur()}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"focusInEditor",value:function(){"function"==typeof this.refs.inputRef.focus&&this.refs.inputRef.focus()}},{key:"__handleClick__REACT_HOT_LOADER__",value:function(e){"TD"!==e.target.tagName&&e.stopPropagation()}},{key:"render",value:function(){var e=this.props,t=e.editable,r=e.format,o=e.customEditor,n=e.isFocus,a=e.customStyleWithNav,s=e.row,l=this.state.shakeEditor,u={ref:"inputRef",onKeyDown:this.handleKeyPress,onBlur:this.handleBlur},p={position:"relative"},f=this.props.fieldValue,d=this.state.className;t.placeholder&&(u.placeholder=t.placeholder);var h=(0,T.default)({animated:l,shake:l});f=0===f?"0":f;var y=void 0;if(o){var v=i({row:s},u,{defaultValue:this.valueShortCircuit(f)},o.customEditorParameters);y=o.getElement(this.handleCustomUpdate,v)}else y=(0,_.default)(t,u,r,h,this.valueShortCircuit(f));if(n)if(a){var m="function"==typeof a?a(f,s):a;p=i({},p,m)}else d+=" default-focus-cell";return c.default.createElement("td",{ref:"td",style:p,className:d,onClick:this.handleClick},y,c.default.createElement(b.default,{ref:"notifier"}))}},{key:"_getCheckBoxValue",value:function(e){var t="",r=e.currentTarget.value.split(":");return t=e.currentTarget.checked?r[0]:r[1]}}]),t}(p.Component);g.propTypes={completeEdit:p.PropTypes.func,rowIndex:p.PropTypes.number,colIndex:p.PropTypes.number,blurToSave:p.PropTypes.bool,editable:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.object]),format:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.func]),row:p.PropTypes.any,fieldValue:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.bool,p.PropTypes.number,p.PropTypes.array,p.PropTypes.object]),className:p.PropTypes.any,beforeShowError:p.PropTypes.func,isFocus:p.PropTypes.bool,customStyleWithNav:p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object])};var O=g;t.default=O;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(g,"TableEditColumn","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableEditColumn.js"),__REACT_HOT_LOADER__.register(O,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableEditColumn.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(2),c=o(p),f=r(3),d=o(f),h=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleKeyUp=function(){return r.__handleKeyUp__REACT_HOT_LOADER__.apply(r,arguments)},r.filterObj={},r}return s(t,e),i(t,[{key:"__handleKeyUp__REACT_HOT_LOADER__",value:function(e){var t=e.currentTarget,r=t.value,o=t.name;""===r.trim()?delete this.filterObj[o]:this.filterObj[o]=r,this.props.onFilter(this.filterObj)}},{key:"render",value:function(){var e=this.props,t=e.striped,r=e.condensed,o=e.rowSelectType,n=e.columns,a=(0,d.default)("table",{"table-striped":t,"table-condensed":r}),s=null;if(o===c.default.ROW_SELECT_SINGLE||o===c.default.ROW_SELECT_MULTI){var i={width:35,paddingLeft:0,paddingRight:0};s=u.default.createElement("th",{style:i,key:-1},"Filter")}var l=n.map(function(e){var t=e.hidden,r=e.width,o=e.name,n={display:t?"none":null,width:r};return u.default.createElement("th",{key:o,style:n},u.default.createElement("div",{className:"th-inner table-header-column"},u.default.createElement("input",{size:"10",type:"text",placeholder:o,name:o,onKeyUp:this.handleKeyUp})))},this);return u.default.createElement("table",{className:a,style:{marginTop:5}},u.default.createElement("thead",null,u.default.createElement("tr",{style:{borderBottomStyle:"hidden"}},s,l)))}}]),t}(l.Component);h.propTypes={columns:l.PropTypes.array,rowSelectType:l.PropTypes.string,onFilter:l.PropTypes.func};var _=h;t.default=_;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"TableFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableFilter.js"),__REACT_HOT_LOADER__.register(_,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableFilter.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,r){if(r){var o=e.filter(function(e){return e.sortField===t});return o.length>0?o[0].order:void 0}}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(6),d=o(f),h=r(2),_=o(h),y=r(3),b=o(y),v=r(187),T=o(v),m=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"componentDidMount",value:function(){this.update(this.props.checked)}},{key:"componentWillReceiveProps",value:function(e){this.update(e.checked)}},{key:"update",value:function(e){d.default.findDOMNode(this).indeterminate="indeterminate"===e}},{key:"render",value:function(){return c.default.createElement("input",{className:"react-bs-select-all",type:"checkbox",checked:this.props.checked,onChange:this.props.onChange})}}]),t}(p.Component),E=function(e){function t(){var e,r,o,n;a(this,t);for(var i=arguments.length,l=Array(i),u=0;u<i;u++)l[u]=arguments[u];return r=o=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.getHeaderColGrouop=function(){var e;return(e=o).__getHeaderColGrouop__REACT_HOT_LOADER__.apply(e,arguments)},n=r,s(o,n)}return i(t,e),u(t,[{key:"render",value:function(){var e=(0,b.default)("react-bs-container-header","table-header-wrapper",this.props.headerContainerClass),t=(0,b.default)("table","table-hover",{"table-bordered":this.props.bordered,"table-condensed":this.props.condensed},this.props.tableHeaderClass),r=Math.max.apply(Math,n(c.default.Children.map(this.props.children,function(e){return e&&e.props.row?Number(e.props.row):0}))),o=[],a=0;o[0]=[],o[0].push([this.props.expandColumnVisible&&this.props.expandColumnBeforeSelectColumn&&c.default.createElement("th",{className:"react-bs-table-expand-cell"}," ")],[this.renderSelectRowHeader(r+1,a++)],[this.props.expandColumnVisible&&!this.props.expandColumnBeforeSelectColumn&&c.default.createElement("th",{className:"react-bs-table-expand-cell"}," ")]);var s=this.props,i=s.sortIndicator,u=s.sortList,p=s.onSort,f=s.reset;c.default.Children.forEach(this.props.children,function(e){if(null!==e&&void 0!==e){var t=e.props,n=t.dataField,s=t.dataSort,d=l(u,n,s),h=e.props.row?Number(e.props.row):0,_=e.props.rowSpan?Number(e.props.rowSpan):1;void 0===o[h]&&(o[h]=[]),_+h===r+1?o[h].push(c.default.cloneElement(e,{reset:f,key:a++,onSort:p,sort:d,sortIndicator:i,isOnlyHead:!1})):o[h].push(c.default.cloneElement(e,{key:a++,isOnlyHead:!0}))}});var d=o.map(function(e,t){return c.default.createElement("tr",{key:t},e)});return c.default.createElement("div",{ref:"container",className:e,style:this.props.style},c.default.createElement("table",{className:t},c.default.cloneElement(this.props.colGroups,{ref:"headerGrp"}),c.default.createElement("thead",{ref:"header"},d)))}},{key:"__getHeaderColGrouop__REACT_HOT_LOADER__",value:function(){return this.refs.headerGrp.childNodes}},{key:"renderSelectRowHeader",value:function(e,t){if(this.props.hideSelectColumn)return null;if(this.props.customComponent){var r=this.props.customComponent;return c.default.createElement(T.default,{key:t,rowCount:e},c.default.createElement(r,{type:"checkbox",checked:this.props.isSelectAll,indeterminate:"indeterminate"===this.props.isSelectAll,disabled:!1,onChange:this.props.onSelectAllRow,rowIndex:"Header"}))}return this.props.rowSelectType===_.default.ROW_SELECT_SINGLE?c.default.createElement(T.default,{key:t,rowCount:e}):this.props.rowSelectType===_.default.ROW_SELECT_MULTI?c.default.createElement(T.default,{key:t,rowCount:e},c.default.createElement(m,{onChange:this.props.onSelectAllRow,checked:this.props.isSelectAll})):null}}]),t}(p.Component);E.propTypes={headerContainerClass:p.PropTypes.string,tableHeaderClass:p.PropTypes.string,style:p.PropTypes.object,rowSelectType:p.PropTypes.string,onSort:p.PropTypes.func,onSelectAllRow:p.PropTypes.func,sortList:p.PropTypes.array,hideSelectColumn:p.PropTypes.bool,bordered:p.PropTypes.bool,condensed:p.PropTypes.bool,isFiltered:p.PropTypes.bool,isSelectAll:p.PropTypes.oneOf([!0,"indeterminate",!1]),sortIndicator:p.PropTypes.bool,customComponent:p.PropTypes.func,colGroups:p.PropTypes.element,reset:p.PropTypes.bool,expandColumnVisible:p.PropTypes.bool,expandColumnComponent:p.PropTypes.func,expandColumnBeforeSelectColumn:p.PropTypes.bool};var g=E;t.default=g;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(m,"Checkbox","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeader.js"),__REACT_HOT_LOADER__.register(l,"getSortOrder","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeader.js"),__REACT_HOT_LOADER__.register(E,"TableHeader","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeader.js"),__REACT_HOT_LOADER__.register(g,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeader.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(3),f=o(c),d=r(2),h=o(d),_=r(19),y=o(_),b=r(196),v=o(b),T=r(200),m=o(T),E=r(198),g=o(E),O=r(199),C=o(O),P=r(197),w=o(P),R=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleColumnClick=function(){return r.__handleColumnClick__REACT_HOT_LOADER__.apply(r,arguments)},r.handleFilter=r.handleFilter.bind(r),r}return s(t,e),l(t,[{key:"componentWillReceiveProps",value:function(e){e.reset&&this.cleanFiltered()}},{key:"__handleColumnClick__REACT_HOT_LOADER__",value:function(){if(!this.props.isOnlyHead&&this.props.dataSort){var e=this.props.sort;e=!e&&this.props.defaultASC?h.default.SORT_ASC:this.props.sort===h.default.SORT_DESC?h.default.SORT_ASC:h.default.SORT_DESC,this.props.onSort(e,this.props.dataField)}}},{key:"handleFilter",value:function(e,t){var r=this.props.filter;r.emitter.handleFilter(this.props.dataField,e,t,r)}},{key:"getFilters",value:function(){var e=this.props,t=e.headerText,r=e.children;switch(this.props.filter.type){case h.default.FILTER_TYPE.TEXT:return p.default.createElement(m.default,i({ref:"textFilter"},this.props.filter,{columnName:t||r,filterHandler:this.handleFilter}));case h.default.FILTER_TYPE.REGEX:return p.default.createElement(g.default,i({ref:"regexFilter"},this.props.filter,{columnName:t||r,filterHandler:this.handleFilter}));case h.default.FILTER_TYPE.SELECT:return p.default.createElement(C.default,i({ref:"selectFilter"},this.props.filter,{columnName:t||r,filterHandler:this.handleFilter}));case h.default.FILTER_TYPE.NUMBER:return p.default.createElement(w.default,i({ref:"numberFilter"},this.props.filter,{columnName:t||r,filterHandler:this.handleFilter}));case h.default.FILTER_TYPE.DATE:return p.default.createElement(v.default,i({ref:"dateFilter"},this.props.filter,{columnName:t||r,filterHandler:this.handleFilter}));case h.default.FILTER_TYPE.CUSTOM:var o=this.props.filter.getElement(this.handleFilter,this.props.filter.customFilterParameters);return p.default.cloneElement(o,{ref:"customFilter"})}}},{key:"componentDidMount",value:function(){this.refs["header-col"].setAttribute("data-field",this.props.dataField)}},{key:"render",value:function(){var e=void 0,t=void 0,r=this.props,o=r.headerText,n=r.dataAlign,a=r.dataField,s=r.headerAlign,l=r.headerTitle,u=r.hidden,c=r.sort,d=r.dataSort,h=r.sortIndicator,_=r.children,b=r.caretRender,v=r.className,T=r.isOnlyHead,m=r.thStyle,E=i({textAlign:s||n,display:u?"none":null},m);T||(h&&(e=d?p.default.createElement("span",{className:"order"},p.default.createElement("span",{className:"dropdown"},p.default.createElement("span",{className:"caret",style:{margin:"10px 0 10px 5px",color:"#ccc"}})),p.default.createElement("span",{className:"dropup"},p.default.createElement("span",{className:"caret",style:{margin:"10px 0",color:"#ccc"}}))):null),t=c?y.default.renderReactSortCaret(c):e,b&&(t=b(c,a)));var g=(0,f.default)("function"==typeof v?v():v,!T&&d?"sort-column":""),O={};return l&&("string"!=typeof _||o?O.title=o:O.title=_),p.default.createElement("th",i({ref:"header-col",className:g,style:E,onClick:this.handleColumnClick,rowSpan:this.props.rowSpan,colSpan:this.props.colSpan,"data-is-only-head":this.props.isOnlyHead},O),_,t,p.default.createElement("div",{onClick:function(e){return e.stopPropagation()}},this.props.filter&&!T?this.getFilters():null))}},{key:"cleanFiltered",value:function(){if(void 0!==this.props.filter)switch(this.props.filter.type){case h.default.FILTER_TYPE.TEXT:this.refs.textFilter.cleanFiltered();break;case h.default.FILTER_TYPE.REGEX:this.refs.regexFilter.cleanFiltered();break;case h.default.FILTER_TYPE.SELECT:this.refs.selectFilter.cleanFiltered();break;case h.default.FILTER_TYPE.NUMBER:this.refs.numberFilter.cleanFiltered();break;case h.default.FILTER_TYPE.DATE:this.refs.dateFilter.cleanFiltered();break;case h.default.FILTER_TYPE.CUSTOM:this.refs.customFilter.cleanFiltered()}}},{key:"applyFilter",value:function(e){if(void 0!==this.props.filter)switch(this.props.filter.type){case h.default.FILTER_TYPE.TEXT:this.refs.textFilter.applyFilter(e);break;case h.default.FILTER_TYPE.REGEX:this.refs.regexFilter.applyFilter(e);break;case h.default.FILTER_TYPE.SELECT:this.refs.selectFilter.applyFilter(e);break;case h.default.FILTER_TYPE.NUMBER:this.refs.numberFilter.applyFilter(e);break;case h.default.FILTER_TYPE.DATE:this.refs.dateFilter.applyFilter(e)}}}]),t}(u.Component),S=[];for(var A in h.default.FILTER_TYPE)S.push(h.default.FILTER_TYPE[A]);R.propTypes={dataField:u.PropTypes.string,dataAlign:u.PropTypes.string,headerAlign:u.PropTypes.string,headerTitle:u.PropTypes.bool,headerText:u.PropTypes.string,dataSort:u.PropTypes.bool,onSort:u.PropTypes.func,dataFormat:u.PropTypes.func,csvFormat:u.PropTypes.func,csvHeader:u.PropTypes.string,isKey:u.PropTypes.bool,editable:u.PropTypes.any,hidden:u.PropTypes.bool,hiddenOnInsert:u.PropTypes.bool,searchable:u.PropTypes.bool,className:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.func]),width:u.PropTypes.string,sortFunc:u.PropTypes.func,sortFuncExtraData:u.PropTypes.any,columnClassName:u.PropTypes.any,editColumnClassName:u.PropTypes.any,invalidEditColumnClassName:u.PropTypes.any,columnTitle:u.PropTypes.bool,filterFormatted:u.PropTypes.bool,filterValue:u.PropTypes.func,sort:u.PropTypes.string,caretRender:u.PropTypes.func,formatExtraData:u.PropTypes.any,csvFormatExtraData:u.PropTypes.any,filter:u.PropTypes.shape({type:u.PropTypes.oneOf(S),delay:u.PropTypes.number,options:u.PropTypes.oneOfType([u.PropTypes.object,u.PropTypes.arrayOf(u.PropTypes.number)]),numberComparators:u.PropTypes.arrayOf(u.PropTypes.string),emitter:u.PropTypes.object,placeholder:u.PropTypes.string,getElement:u.PropTypes.func,customFilterParameters:u.PropTypes.object,condition:u.PropTypes.oneOf([h.default.FILTER_COND_EQ,h.default.FILTER_COND_LIKE])}),sortIndicator:u.PropTypes.bool,export:u.PropTypes.bool,expandable:u.PropTypes.bool,tdAttr:u.PropTypes.object,tdStyle:u.PropTypes.object,thStyle:u.PropTypes.object,keyValidator:u.PropTypes.bool,defaultASC:u.PropTypes.bool},R.defaultProps={dataAlign:"left",headerAlign:void 0,headerTitle:!0,dataSort:!1,dataFormat:void 0,csvFormat:void 0,csvHeader:void 0,isKey:!1,editable:!0,onSort:void 0,hidden:!1,hiddenOnInsert:!1,searchable:!0,className:"",columnTitle:!1,width:null,sortFunc:void 0,columnClassName:"",editColumnClassName:"",invalidEditColumnClassName:"",filterFormatted:!1,filterValue:void 0,sort:void 0,formatExtraData:void 0,sortFuncExtraData:void 0,filter:void 0,sortIndicator:!0,expandable:!0,tdAttr:void 0,tdStyle:void 0,thStyle:void 0,keyValidator:!1,defaultASC:!1};var x=R;t.default=x;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"TableHeaderColumn","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeaderColumn.js"),__REACT_HOT_LOADER__.register(S,"filterTypeArray","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeaderColumn.js"),__REACT_HOT_LOADER__.register(x,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableHeaderColumn.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(3),p=o(u),c=r(1),f=o(c),d=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.rowClick=function(){return r.__rowClick__REACT_HOT_LOADER__.apply(r,arguments)},r.expandRow=function(){return r.__expandRow__REACT_HOT_LOADER__.apply(r,arguments)},r.rowDoubleClick=function(){return r.__rowDoubleClick__REACT_HOT_LOADER__.apply(r,arguments)},r.rowMouseOut=function(){return r.__rowMouseOut__REACT_HOT_LOADER__.apply(r,arguments)},r.rowMouseOver=function(){return r.__rowMouseOver__REACT_HOT_LOADER__.apply(r,arguments)},r.clickNum=0,r}return s(t,e),l(t,[{key:"__rowClick__REACT_HOT_LOADER__",value:function(e){var t=this,r=this.props.index+1,o=e.target.cellIndex;this.props.onRowClick&&this.props.onRowClick(r,o);var n=this.props,a=n.selectRow,s=n.unselectableRow,i=n.isSelected,l=n.onSelectRow,u=n.onExpandRow;a&&(a.clickToSelect&&!s?l(r,!i,e):a.clickToSelectAndEditCell&&!s?(this.clickNum++,setTimeout(function(){1===t.clickNum&&(l(r,!i,e),u(r,o)),t.clickNum=0},200)):this.expandRow(r,o))}},{key:"__expandRow__REACT_HOT_LOADER__",value:function(e,t){var r=this;this.clickNum++,setTimeout(function(){1===r.clickNum&&r.props.onExpandRow(e,t),r.clickNum=0},200)}},{key:"__rowDoubleClick__REACT_HOT_LOADER__",value:function(e){"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&this.props.onRowDoubleClick&&this.props.onRowDoubleClick(this.props.index)}},{key:"__rowMouseOut__REACT_HOT_LOADER__",value:function(e){var t=this.props.index;this.props.onRowMouseOut&&this.props.onRowMouseOut(t,e)}},{key:"__rowMouseOver__REACT_HOT_LOADER__",value:function(e){var t=this.props.index;this.props.onRowMouseOver&&this.props.onRowMouseOver(t,e)}},{key:"render",value:function(){this.clickNum=0;var e=this.props,t=e.selectRow,r=e.row,o=e.isSelected,n=e.className,a=null,s=null;t&&(a="function"==typeof t.bgColor?t.bgColor(r,o):o?t.bgColor:null,s="function"==typeof t.className?t.className(r,o):o?t.className:null);var l={style:{backgroundColor:a},className:(0,p.default)(s,n)};return f.default.createElement("tr",i({},l,{onMouseOver:this.rowMouseOver,onMouseOut:this.rowMouseOut,onClick:this.rowClick,onDoubleClick:this.rowDoubleClick}),this.props.children)}}]),t}(c.Component);d.propTypes={index:c.PropTypes.number,row:c.PropTypes.any,isSelected:c.PropTypes.bool,enableCellEdit:c.PropTypes.bool,onRowClick:c.PropTypes.func,onRowDoubleClick:c.PropTypes.func,onSelectRow:c.PropTypes.func,onExpandRow:c.PropTypes.func,onRowMouseOut:c.PropTypes.func,onRowMouseOver:c.PropTypes.func,unselectableRow:c.PropTypes.bool},d.defaultProps={onRowClick:void 0,onRowDoubleClick:void 0};var h=d;t.default=h;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(d,"TableRow","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableRow.js"),__REACT_HOT_LOADER__.register(h,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/TableRow.js"))})()},function(e,t,r){ "use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r="";if(0===e.length)return r;var o=[],n=0;t.forEach(function(e){e.row>n&&(n=e.row);for(var t=0;t<e.colSpan;t++)o.push(e)});for(var a=function(e){r+=o.map(function(t){return t.row+(t.rowSpan-1)===e?t.header:t.row===e&&t.rowSpan>1?"":void 0}).filter(function(e){return"undefined"!=typeof e}).join(",")+"\n"},s=0;s<=n;s++)a(s);return t=t.filter(function(e){return void 0!==e.field}),e.map(function(e){t.map(function(o,n){var a=o.field,s=o.format,i=o.extraData,l="undefined"!=typeof s?s(e[a],e,i):e[a],u="undefined"!=typeof l?'"'+l+'"':"";r+=u,n+1<t.length&&(r+=",")}),r+="\n"}),r}Object.defineProperty(t,"__esModule",{value:!0});var a=r(19),s=o(a);if(s.default.canUseDOM())var i=r(207),l=i.saveAs;var u=function(e,t,r){var o=n(e,t);"undefined"!=typeof window&&l(new Blob([o],{type:"text/plain;charset=utf-8"}),r,!0)},p=u;t.default=p;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(l,"saveAs","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/csv_export_util.js"),__REACT_HOT_LOADER__.register(n,"toString","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/csv_export_util.js"),__REACT_HOT_LOADER__.register(u,"exportCSV","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/csv_export_util.js"),__REACT_HOT_LOADER__.register(p,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/csv_export_util.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(2),f=o(c),d=["=",">",">=","<","<=","!="],h=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.dateComparators=r.props.dateComparators||d,r.filter=r.filter.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return s(t,e),l(t,[{key:"setDefaultDate",value:function(){var e="",t=this.props.defaultValue;return t&&t.date&&(e=i(new Date(t.date))),e}},{key:"onChangeComparator",value:function(e){var t=this.refs.inputDate.value,r=e.target.value;""!==t&&(t=new Date(t),this.props.filterHandler({date:t,comparator:r},f.default.FILTER_TYPE.DATE))}},{key:"getComparatorOptions",value:function(){var e=[];e.push(p.default.createElement("option",{key:"-1"}));for(var t=0;t<this.dateComparators.length;t++)e.push(p.default.createElement("option",{key:t,value:this.dateComparators[t]},this.dateComparators[t]));return e}},{key:"filter",value:function(e){var t=this.refs.dateFilterComparator.value,r=e.target.value;r?this.props.filterHandler({date:new Date(r),comparator:t},f.default.FILTER_TYPE.DATE):this.props.filterHandler(null,f.default.FILTER_TYPE.DATE)}},{key:"cleanFiltered",value:function(){var e=this.setDefaultDate(),t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.dateFilterComparator.value=t,this.refs.inputDate.value=e,this.props.filterHandler({date:new Date(e),comparator:t},f.default.FILTER_TYPE.DATE)}},{key:"applyFilter",value:function(e){var t=e.date,r=e.comparator;this.setState({isPlaceholderSelected:""===t}),this.refs.dateFilterComparator.value=r,this.refs.inputDate.value=i(t),this.props.filterHandler({date:t,comparator:r},f.default.FILTER_TYPE.DATE)}},{key:"componentDidMount",value:function(){var e=this.refs.dateFilterComparator.value,t=this.refs.inputDate.value;e&&t&&this.props.filterHandler({date:new Date(t),comparator:e},f.default.FILTER_TYPE.DATE)}},{key:"render",value:function(){var e=this.props,t=e.defaultValue,r=e.style,o=r.date,n=r.comparator;return p.default.createElement("div",{className:"filter date-filter"},p.default.createElement("select",{ref:"dateFilterComparator",style:n,className:"date-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:t?t.comparator:""},this.getComparatorOptions()),p.default.createElement("input",{ref:"inputDate",className:"filter date-filter-input form-control",style:o,type:"date",onChange:this.filter,defaultValue:this.setDefaultDate()}))}}]),t}(u.Component);h.propTypes={filterHandler:u.PropTypes.func.isRequired,defaultValue:u.PropTypes.shape({date:u.PropTypes.object,comparator:u.PropTypes.oneOf(d)}),style:u.PropTypes.shape({date:u.PropTypes.oneOfType([u.PropTypes.object]),comparator:u.PropTypes.oneOfType([u.PropTypes.object])}),dateComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<d.length;n++)if(d[n]===e[t][r]){o=!0;break}if(!o)return new Error("Date comparator provided is not supported.\n Use only "+d)}},columnName:u.PropTypes.string},h.defaultProps={style:{date:null,comparator:null}};var _=h;t.default=_;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(d,"legalComparators","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Date.js"),__REACT_HOT_LOADER__.register(i,"dateParser","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Date.js"),__REACT_HOT_LOADER__.register(h,"DateFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Date.js"),__REACT_HOT_LOADER__.register(_,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Date.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(3),c=o(p),f=r(2),d=o(f),h=["=",">",">=","<","<=","!="],_=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.numberComparators=r.props.numberComparators||h,r.timeout=null,r.state={isPlaceholderSelected:void 0===r.props.defaultValue||void 0===r.props.defaultValue.number||r.props.options&&r.props.options.indexOf(r.props.defaultValue.number)===-1},r.onChangeNumber=r.onChangeNumber.bind(r),r.onChangeNumberSet=r.onChangeNumberSet.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return s(t,e),i(t,[{key:"onChangeNumber",value:function(e){var t=this,r=this.refs.numberFilterComparator.value;if(""!==r){this.timeout&&clearTimeout(this.timeout);var o=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler({number:o,comparator:r},d.default.FILTER_TYPE.NUMBER)},this.props.delay)}}},{key:"onChangeNumberSet",value:function(e){var t=this.refs.numberFilterComparator.value,r=e.target.value;this.setState({isPlaceholderSelected:""===r}),""!==t&&this.props.filterHandler({number:r,comparator:t},d.default.FILTER_TYPE.NUMBER)}},{key:"onChangeComparator",value:function(e){var t=this.refs.numberFilter.value,r=e.target.value;""!==t&&this.props.filterHandler({number:t,comparator:r},d.default.FILTER_TYPE.NUMBER)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue.number:"",t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.numberFilterComparator.value=t,this.refs.numberFilter.value=e,this.props.filterHandler({number:e,comparator:t},d.default.FILTER_TYPE.NUMBER)}},{key:"applyFilter",value:function(e){var t=e.number,r=e.comparator;this.setState({isPlaceholderSelected:""===t}),this.refs.numberFilterComparator.value=r,this.refs.numberFilter.value=t,this.props.filterHandler({number:t,comparator:r},d.default.FILTER_TYPE.NUMBER)}},{key:"getComparatorOptions",value:function(){var e=[],t=this.props.withoutEmptyComparatorOption;t||e.push(u.default.createElement("option",{key:"-1"}));for(var r=0;r<this.numberComparators.length;r++)e.push(u.default.createElement("option",{key:r,value:this.numberComparators[r]},this.numberComparators[r]));return e}},{key:"getNumberOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.withoutEmptyNumberOption;o||e.push(u.default.createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+this.props.columnName+"..."));for(var n=0;n<r.length;n++)e.push(u.default.createElement("option",{key:n,value:r[n]},r[n]));return e}},{key:"componentDidMount",value:function(){var e=this.refs.numberFilterComparator.value,t=this.refs.numberFilter.value;e&&t&&this.props.filterHandler({number:t,comparator:e},d.default.FILTER_TYPE.NUMBER)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=(0,c.default)("select-filter","number-filter-input","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return u.default.createElement("div",{className:"filter number-filter"},u.default.createElement("select",{ref:"numberFilterComparator",style:this.props.style.comparator,className:"number-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:this.props.defaultValue?this.props.defaultValue.comparator:""},this.getComparatorOptions()),this.props.options?u.default.createElement("select",{ref:"numberFilter",className:e,onChange:this.onChangeNumberSet,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""},this.getNumberOptions()):u.default.createElement("input",{ref:"numberFilter",type:"number",style:this.props.style.number,className:"number-filter-input form-control",placeholder:this.props.placeholder||"Enter "+this.props.columnName+"...",onChange:this.onChangeNumber,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""}))}}]),t}(l.Component);_.propTypes={filterHandler:l.PropTypes.func.isRequired,options:l.PropTypes.arrayOf(l.PropTypes.number),defaultValue:l.PropTypes.shape({number:l.PropTypes.number,comparator:l.PropTypes.oneOf(h)}),style:l.PropTypes.shape({number:l.PropTypes.oneOfType([l.PropTypes.object]),comparator:l.PropTypes.oneOfType([l.PropTypes.object])}),delay:l.PropTypes.number,numberComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<h.length;n++)if(h[n]===e[t][r]){o=!0;break}if(!o)return new Error("Number comparator provided is not supported.\n Use only "+h)}},placeholder:l.PropTypes.string,columnName:l.PropTypes.string,withoutEmptyComparatorOption:l.PropTypes.bool,withoutEmptyNumberOption:l.PropTypes.bool},_.defaultProps={delay:d.default.FILTER_DELAY,withoutEmptyComparatorOption:!1,withoutEmptyNumberOption:!1,style:{number:null,comparator:null}};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(h,"legalComparators","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Number.js"),__REACT_HOT_LOADER__.register(_,"NumberFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Number.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Number.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(2),c=o(p),f=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.filter=r.filter.bind(r),r.timeout=null,r}return s(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c.default.FILTER_TYPE.REGEX)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c.default.FILTER_TYPE.TEXT)}},{key:"applyFilter",value:function(e){this.refs.inputText.value=e,this.props.filterHandler(e,c.default.FILTER_TYPE.REGEX)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c.default.FILTER_TYPE.REGEX)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.defaultValue,r=e.placeholder,o=e.columnName,n=e.style;return u.default.createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",style:n,onChange:this.filter,placeholder:r||"Enter Regex for "+o+"...",defaultValue:t?t:""})}}]),t}(l.Component);f.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string,style:l.PropTypes.oneOfType([l.PropTypes.object])},f.defaultProps={delay:c.default.FILTER_DELAY};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"RegexFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Regex.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Regex.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){var r=Object.keys(e);for(var o in r)if(e[o]!==t[o])return!1;return Object.keys(e).length===Object.keys(t).length}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(3),f=o(c),d=r(2),h=o(d),_=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.filter=r.filter.bind(r),r.state={isPlaceholderSelected:void 0===r.props.defaultValue||!r.props.options.hasOwnProperty(r.props.defaultValue)},r}return s(t,e),l(t,[{key:"componentWillReceiveProps",value:function(e){var t=void 0===e.defaultValue||!e.options.hasOwnProperty(e.defaultValue);this.setState({isPlaceholderSelected:t})}},{key:"componentDidUpdate",value:function(e){var t=!1;if(this.props.defaultValue!==e.defaultValue?t=!0:i(this.props.options,e.options)||(t=!0),t){var r=this.refs.selectInput.value;r&&this.props.filterHandler(r,h.default.FILTER_TYPE.SELECT)}}},{key:"filter",value:function(e){var t=e.target.value;this.setState({isPlaceholderSelected:""===t}),this.props.filterHandler(t,h.default.FILTER_TYPE.SELECT)}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:"";this.setState({isPlaceholderSelected:""===e}),this.refs.selectInput.value=e,this.props.filterHandler(e,h.default.FILTER_TYPE.SELECT)}},{key:"applyFilter",value:function(e){e+="",this.setState({isPlaceholderSelected:""===e}),this.refs.selectInput.value=e,this.props.filterHandler(e,h.default.FILTER_TYPE.SELECT)}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.placeholder,n=t.columnName,a=t.selectText,s=t.withoutEmptyOption,i=void 0!==a?a:"Select";return s||e.push(p.default.createElement("option",{key:"-1",value:""},o||i+" "+n+"...")),Object.keys(r).map(function(t){e.push(p.default.createElement("option",{key:t,value:t},r[t]+""))}),e}},{key:"componentDidMount",value:function(){var e=this.refs.selectInput.value;e&&this.props.filterHandler(e,h.default.FILTER_TYPE.SELECT)}},{key:"render",value:function(){var e=(0,f.default)("filter","select-filter","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return p.default.createElement("select",{ref:"selectInput",style:this.props.style,className:e,onChange:this.filter,defaultValue:void 0!==this.props.defaultValue?this.props.defaultValue:""},this.getOptions())}}]),t}(u.Component);_.propTypes={filterHandler:u.PropTypes.func.isRequired,options:u.PropTypes.object.isRequired,placeholder:u.PropTypes.string,columnName:u.PropTypes.string,style:u.PropTypes.oneOfType([u.PropTypes.object])};var y=_;t.default=y;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"optionsEquals","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Select.js"),__REACT_HOT_LOADER__.register(_,"SelectFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Select.js"),__REACT_HOT_LOADER__.register(y,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Select.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(2),c=o(p),f=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.filter=r.filter.bind(r),r.timeout=null,r}return s(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c.default.FILTER_TYPE.TEXT)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c.default.FILTER_TYPE.TEXT)}},{key:"applyFilter",value:function(e){this.refs.inputText.value=e,this.props.filterHandler(e,c.default.FILTER_TYPE.TEXT)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c.default.FILTER_TYPE.TEXT)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.placeholder,r=e.columnName,o=e.defaultValue,n=e.style;return u.default.createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",style:n,onChange:this.filter,placeholder:t||"Enter "+r+"...",defaultValue:o?o:""})}}]),t}(l.Component);f.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string,style:l.PropTypes.oneOfType([l.PropTypes.object])},f.defaultProps={delay:c.default.FILTER_DELAY};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"TextFilter","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Text.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filters/Text.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=r(1),u=o(l),p=r(3),c=o(p),f=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.pageBtnClick=function(){return r.__pageBtnClick__REACT_HOT_LOADER__.apply(r,arguments)},r}return s(t,e),i(t,[{key:"__pageBtnClick__REACT_HOT_LOADER__",value:function(e){e.preventDefault(),this.props.changePage(e.currentTarget.textContent)}},{key:"render",value:function(){var e=(0,c.default)({active:this.props.active,disabled:this.props.disable,hidden:this.props.hidden,"page-item":!0});return u.default.createElement("li",{className:e,title:this.props.title},u.default.createElement("a",{href:"#",onClick:this.pageBtnClick,className:"page-link"},this.props.children))}}]),t}(l.Component);f.propTypes={title:l.PropTypes.string,changePage:l.PropTypes.func,active:l.PropTypes.bool,disable:l.PropTypes.bool,hidden:l.PropTypes.bool,children:l.PropTypes.node};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"PageButton","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/PageButton.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/PageButton.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(3),f=o(c),d=r(201),h=o(d),_=r(56),y=o(_),b=r(2),v=o(b),T=function(e){function t(e){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.changePage=function(){return r.__changePage__REACT_HOT_LOADER__.apply(r,arguments)},r.changeSizePerPage=function(){return r.__changeSizePerPage__REACT_HOT_LOADER__.apply(r,arguments)},r.toggleDropDown=function(){return r.__toggleDropDown__REACT_HOT_LOADER__.apply(r,arguments)},r.state={open:r.props.open},r}return s(t,e),l(t,[{key:"componentWillReceiveProps",value:function(){var e=this.props.keepSizePerPageState;e||this.setState({open:!1})}},{key:"__changePage__REACT_HOT_LOADER__",value:function(e){var t=this.props,r=t.pageStartIndex,o=t.prePage,n=t.currPage,a=t.nextPage,s=t.lastPage,i=t.firstPage,l=t.sizePerPage,u=t.keepSizePerPageState;e=e===o?n-1<r?r:n-1:e===a?n+1>this.lastPage?this.lastPage:n+1:e===s?this.lastPage:e===i?r:parseInt(e,10),u&&this.setState({open:!1}),e!==n&&this.props.changePage(e,l)}},{key:"__changeSizePerPage__REACT_HOT_LOADER__",value:function(e){var t="string"==typeof e?parseInt(e,10):e,r=this.props.currPage;t!==this.props.sizePerPage&&(this.totalPages=Math.ceil(this.props.dataSize/t),this.lastPage=this.props.pageStartIndex+this.totalPages-1,r>this.lastPage&&(r=this.lastPage),this.props.changePage(r,t),this.props.onSizePerPageList&&this.props.onSizePerPageList(t)),this.setState({open:!1})}},{key:"__toggleDropDown__REACT_HOT_LOADER__",value:function(){this.setState({open:!this.state.open})}},{key:"render",value:function(){var e=this.props,t=e.currPage,r=e.dataSize,o=e.sizePerPage,n=e.sizePerPageList,a=e.paginationShowsTotal,s=e.pageStartIndex,i=e.paginationPanel,l=e.hidePageListOnlyOnePage;this.totalPages=Math.ceil(r/o),this.lastPage=this.props.pageStartIndex+this.totalPages-1;var u=this.makePage("function"==typeof i),c=this.makeDropDown(),f=Math.abs(v.default.PAGE_START_INDEX-s),d=(t-s)*o;d=0===r?0:d+1;var h=Math.min(o*(t+f)-1,r);h>=r&&h--;var _=a?p.default.createElement("span",null,"Showing rows ",d," to ",h+1," of ",r):null;"function"==typeof a&&(_=a(d,h+1,r));var y=i&&i({currPage:t,sizePerPage:o,sizePerPageList:n,pageStartIndex:s,changePage:this.changePage,toggleDropDown:this.toggleDropDown,changeSizePerPage:this.changeSizePerPage,components:{totalText:_,sizePerPageDropdown:c,pageList:u}}),b=l&&1===this.totalPages?"none":"block";return p.default.createElement("div",{className:"row",style:{marginTop:15}},y||p.default.createElement("div",null,p.default.createElement("div",{className:"col-md-6 col-xs-6 col-sm-6 col-lg-6"},_,n.length>1?c:null),p.default.createElement("div",{style:{display:b},className:"col-md-6 col-xs-6 col-sm-6 col-lg-6"},u)))}},{key:"makeDropDown",value:function(){var e=this,t=void 0,r=void 0,o="",n=this.props,a=n.sizePerPageDropDown,s=n.hideSizePerPage,l=n.sizePerPage,u=n.sizePerPageList;if(a){if(t=a({open:this.state.open,hideSizePerPage:s,currSizePerPage:String(l),sizePerPageList:u,toggleDropDown:this.toggleDropDown,changeSizePerPage:this.changeSizePerPage}),t.type.name!==y.default.name)return t;r=t.props}if(r||!t){var c=u.map(function(t){var r=t.text||t,n=t.value||t;return l===n&&(o=r),p.default.createElement("li",{key:r,role:"presentation"},p.default.createElement("a",{role:"menuitem",tabIndex:"-1",href:"#","data-page":n,onClick:function(t){t.preventDefault(),e.changeSizePerPage(n)}},r))});t=p.default.createElement(y.default,i({open:this.state.open,hidden:s,currSizePerPage:String(o),options:c,onClick:this.toggleDropDown},r))}return t}},{key:"makePage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.getPages(),o=function(e,t){var r=t.currPage,o=t.pageStartIndex,n=t.firstPage,a=t.prePage;return r===o&&(e===n||e===a)},n=function(t,r){var o=r.currPage,n=r.nextPage,a=r.lastPage;return o===e.lastPage&&(t===n||t===a)},a=r.filter(function(e){return!!this.props.alwaysShowAllBtns||!o(e,this.props)&&!n(e,this.props)},this).map(function(e){var t=e===this.props.currPage,r=!(!o(e,this.props)&&!n(e,this.props)),a=e+"";return e===this.props.nextPage?a=this.props.nextPageTitle:e===this.props.prePage?a=this.props.prePageTitle:e===this.props.firstPage?a=this.props.firstPageTitle:e===this.props.lastPage&&(a=this.props.lastPageTitle),p.default.createElement(h.default,{key:e,title:a,changePage:this.changePage,active:t,disable:r},e)},this),s=(0,f.default)(t?null:"react-bootstrap-table-page-btns-ul","pagination");return p.default.createElement("ul",{className:s},a)}},{key:"getLastPage",value:function(){return this.lastPage}},{key:"getPages",value:function(){var e=void 0,t=this.totalPages;if(t<=0)return[];var r=Math.max(this.props.currPage-Math.floor(this.props.paginationSize/2),this.props.pageStartIndex);t=r+this.props.paginationSize-1,t>this.lastPage&&(t=this.lastPage,r=t-this.props.paginationSize+1),e=r!==this.props.pageStartIndex&&this.totalPages>this.props.paginationSize&&this.props.withFirstAndLast?[this.props.firstPage,this.props.prePage]:this.totalPages>1||this.props.alwaysShowAllBtns?[this.props.prePage]:[];for(var o=r;o<=t;o++)o>=this.props.pageStartIndex&&e.push(o);return t<=this.lastPage&&e.length>1&&e.push(this.props.nextPage),t!==this.lastPage&&this.props.withFirstAndLast&&e.push(this.props.lastPage),e}}]),t}(u.Component);T.propTypes={currPage:u.PropTypes.number,sizePerPage:u.PropTypes.number,dataSize:u.PropTypes.number,changePage:u.PropTypes.func,sizePerPageList:u.PropTypes.array,paginationShowsTotal:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.func]),paginationSize:u.PropTypes.number,onSizePerPageList:u.PropTypes.func,prePage:u.PropTypes.string,pageStartIndex:u.PropTypes.number,hideSizePerPage:u.PropTypes.bool,alwaysShowAllBtns:u.PropTypes.bool,withFirstAndLast:u.PropTypes.bool,sizePerPageDropDown:u.PropTypes.func,paginationPanel:u.PropTypes.func,prePageTitle:u.PropTypes.string,nextPageTitle:u.PropTypes.string,firstPageTitle:u.PropTypes.string,lastPageTitle:u.PropTypes.string,hidePageListOnlyOnePage:u.PropTypes.bool,keepSizePerPageState:u.PropTypes.bool},T.defaultProps={sizePerPage:v.default.SIZE_PER_PAGE,pageStartIndex:v.default.PAGE_START_INDEX};var m=T;t.default=m;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(T,"PaginationList","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/PaginationList.js"),__REACT_HOT_LOADER__.register(m,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/pagination/PaginationList.js"))})()},function(e,t,r){"use strict";function o(e){ return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.TableDataStore=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),i=r(2),l=o(i),u=function(){function e(t){var r=this;n(this,e),this.isValidKey=function(){return r.__isValidKey__REACT_HOT_LOADER__.apply(r,arguments)},this.data=t,this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText=null,this.sortList=[],this.pageObj={},this.selected=[],this.showOnlySelected=!1}return s(e,[{key:"setProps",value:function(e){this.keyField=e.keyField,this.enablePagination=e.isPagination,this.colInfos=e.colInfos,this.remote=e.remote,this.multiColumnSearch=e.multiColumnSearch,this.strictSearch="undefined"==typeof e.strictSearch?!e.multiColumnSearch:e.strictSearch,this.multiColumnSort=e.multiColumnSort}},{key:"clean",value:function(){this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText=null,this.sortList=[],this.pageObj={},this.selected=[]}},{key:"isSearching",value:function(){return null!==this.searchText}},{key:"isFiltering",value:function(){return null!==this.filterObj}},{key:"setData",value:function(e){this.data=e,this.remote||this._refresh(!0)}},{key:"getColInfos",value:function(){return this.colInfos}},{key:"getSortInfo",value:function(){return this.sortList}},{key:"setSortInfo",value:function(e,t){if(("undefined"==typeof e?"undefined":a(e))!==("undefined"==typeof t?"undefined":a(t)))throw new Error("The type of sort field and order should be both with String or Array");if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)throw new Error("The length of sort fields and orders should be equivalent");e=e.slice().reverse(),this.sortList=t.slice().reverse().map(function(t,r){return{order:e[r],sortField:t}}),this.sortList=this.sortList.slice(0,this.multiColumnSort)}else{var r={order:e,sortField:t};if(this.multiColumnSort>1){for(var o=this.sortList.length-1,n=!1;o>=0;o--)if(this.sortList[o].sortField===t){n=!0;break}n&&(o>0?this.sortList=this.sortList.slice(0,o):this.sortList=this.sortList.slice(1)),this.sortList.unshift(r),this.sortList=this.sortList.slice(0,this.multiColumnSort)}else this.sortList=[r]}}},{key:"cleanSortInfo",value:function(){this.sortList=[]}},{key:"setSelectedRowKey",value:function(e){this.selected=e}},{key:"getRowByKey",value:function(e){for(var t=this,r=[],o=function(o){var n=t.data[o];return e&&0!==e.length?void(e.indexOf(n[t.keyField])>-1&&(e=e.filter(function(e){return e!==n[t.keyField]}),r.push(n))):"break"},n=0;n<this.data.length;n++){var a=o(n);if("break"===a)break}return r}},{key:"getSelectedRowKeys",value:function(){return this.selected}},{key:"getCurrentDisplayData",value:function(){return this.isOnFilter?this.filteredData:this.data}},{key:"_refresh",value:function(e){this.isOnFilter&&(null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),!e&&this.sortList.length>0&&this.sort()}},{key:"ignoreNonSelected",value:function(){var e=this;this.showOnlySelected=!this.showOnlySelected,this.showOnlySelected?(this.isOnFilter=!0,this.filteredData=this.data.filter(function(t){var r=e.selected.find(function(r){return t[e.keyField]===r});return"undefined"!=typeof r})):this.isOnFilter=!1}},{key:"sort",value:function(){var e=this.getCurrentDisplayData();return e=this._sort(e),this}},{key:"page",value:function(e,t){return this.pageObj.end=e*t-1,this.pageObj.start=this.pageObj.end-(t-1),this}},{key:"edit",value:function(e,t,r){var o=this.getCurrentDisplayData(),n=void 0;return this.enablePagination?(o[this.pageObj.start+t][r]=e,n=o[this.pageObj.start+t][this.keyField]):(o[t][r]=e,n=o[t][this.keyField]),this.isOnFilter&&(this.data.forEach(function(t){t[this.keyField]===n&&(t[r]=e)},this),null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),this}},{key:"addAtBegin",value:function(e){if(!e[this.keyField]||""===e[this.keyField].toString())throw new Error(this.keyField+" can't be empty value.");var t=this.getCurrentDisplayData();t.forEach(function(t){if(t[this.keyField].toString()===e[this.keyField].toString())throw new Error(this.keyField+" "+e[this.keyField]+" already exists")},this),t.unshift(e),this.isOnFilter&&this.data.unshift(e),this._refresh(!1)}},{key:"add",value:function(e){var t=this.isValidKey(e[this.keyField]);if(t)throw new Error(t);var r=this.getCurrentDisplayData();r.push(e),this.isOnFilter&&this.data.push(e),this._refresh(!1)}},{key:"__isValidKey__REACT_HOT_LOADER__",value:function(e){var t=this;if(!e||""===e.toString())return this.keyField+" can't be empty value.";var r=this.getCurrentDisplayData(),o=r.find(function(r){return r[t.keyField].toString()===e.toString()});return o?this.keyField+" "+e+" already exists":void 0}},{key:"remove",value:function(e){var t=this,r=this.getCurrentDisplayData(),o=r.filter(function(r){return e.indexOf(r[t.keyField])===-1});this.isOnFilter?(this.data=this.data.filter(function(r){return e.indexOf(r[t.keyField])===-1}),this.filteredData=o):this.data=o}},{key:"filter",value:function(e){if(0===Object.keys(e).length)this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText&&this._search(this.data);else{var t=this.data;this.filterObj=e,this.searchText&&(this._search(t),t=this.filteredData),this._filter(t)}}},{key:"filterNumber",value:function(e,t,r){var o=!0;switch(r){case"=":e!=t&&(o=!1);break;case">":e<=t&&(o=!1);break;case">=":e<t&&(o=!1);break;case"<":e>=t&&(o=!1);break;case"<=":e>t&&(o=!1);break;case"!=":e==t&&(o=!1);break;default:console.error("Number comparator provided is not supported")}return o}},{key:"filterDate",value:function e(t,r,o){if(!t)return!1;var e=r.getDate(),n=r.getMonth(),s=r.getFullYear();"object"!==("undefined"==typeof t?"undefined":a(t))&&(t=new Date(t));var i=t.getDate(),l=t.getMonth(),u=t.getFullYear(),p=!0;switch(o){case"=":e===i&&n===l&&s===u||(p=!1);break;case">":t<=r&&(p=!1);break;case">=":u<s?p=!1:u===s&&l<n?p=!1:u===s&&l===n&&i<e&&(p=!1);break;case"<":t>=r&&(p=!1);break;case"<=":u>s?p=!1:u===s&&l>n?p=!1:u===s&&l===n&&i>e&&(p=!1);break;case"!=":e===i&&n===l&&s===u&&(p=!1);break;default:console.error("Date comparator provided is not supported")}return p}},{key:"filterRegex",value:function(e,t){try{return new RegExp(t,"i").test(e)}catch(e){return!0}}},{key:"filterCustom",value:function(e,t,r,o){return null!==r&&"object"===("undefined"==typeof r?"undefined":a(r))?r.callback(e,r.callbackParameters):this.filterText(e,t,o)}},{key:"filterText",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.FILTER_COND_LIKE;return e=e.toString(),t=t.toString(),r===l.default.FILTER_COND_EQ?e===t:(e=e.toLowerCase(),t=t.toLowerCase(),!(e.indexOf(t)===-1))}},{key:"search",value:function(e){if(""===e.trim())this.filteredData=null,this.isOnFilter=!1,this.searchText=null,this.filterObj&&this._filter(this.data);else{var t=this.data;this.searchText=e,this.filterObj&&(this._filter(t),t=this.filteredData),this._search(t)}}},{key:"_filter",value:function(e){var t=this,r=this.filterObj;this.filteredData=e.filter(function(e,o){var n=!0,s=void 0;for(var i in r){var u=e[i];switch(null!==u&&void 0!==u||(u=""),r[i].type){case l.default.FILTER_TYPE.NUMBER:s=r[i].value.number;break;case l.default.FILTER_TYPE.CUSTOM:s="object"===a(r[i].value)?void 0:"string"==typeof r[i].value?r[i].value.toLowerCase():r[i].value;break;case l.default.FILTER_TYPE.DATE:s=r[i].value.date;break;case l.default.FILTER_TYPE.REGEX:s=r[i].value;break;default:s=r[i].value,void 0===s&&(s=r[i])}var p=void 0,c=void 0,f=void 0,d=void 0;switch(t.colInfos[i]&&(p=t.colInfos[i].format,c=t.colInfos[i].filterFormatted,f=t.colInfos[i].formatExtraData,d=t.colInfos[i].filterValue,c&&p?u=p(e[i],e,f,o):d&&(u=d(e[i],e))),r[i].type){case l.default.FILTER_TYPE.NUMBER:n=t.filterNumber(u,s,r[i].value.comparator);break;case l.default.FILTER_TYPE.DATE:n=t.filterDate(u,s,r[i].value.comparator);break;case l.default.FILTER_TYPE.REGEX:n=t.filterRegex(u,s);break;case l.default.FILTER_TYPE.CUSTOM:var h=r[i].props?r[i].props.cond:l.default.FILTER_COND_LIKE;n=t.filterCustom(u,s,r[i].value,h);break;default:r[i].type===l.default.FILTER_TYPE.SELECT&&c&&c&&p&&(s=p(s,e,f,o));var _=r[i].props?r[i].props.cond:l.default.FILTER_COND_LIKE;n=t.filterText(u,s,_)}if(!n)break}return n}),this.isOnFilter=!0}},{key:"_search",value:function(e){var t=this,r=void 0;r=this.multiColumnSearch||!this.strictSearch?this.searchText.trim().toLowerCase().split(/\s+/):[this.searchText.toLowerCase()];var o=r.length,n=o>1,a=n&&!this.strictSearch&&this.multiColumnSearch,s=n&&!this.strictSearch&&!this.multiColumnSearch;this.filteredData=e.filter(function(e,i){for(var l=Object.keys(e),u=n?r.slice():r,p=0,c=l.length;p<c;p++){var f=l[p],d=t.colInfos[f];if(d&&d.searchable){var h=d.format,_=d.filterFormatted,y=d.filterValue,b=d.formatExtraData,v=void 0;if(v=_&&h?h(e[f],e,b,i):y?y(e[f],e):e[f],null!==v&&"undefined"!=typeof v){v=v.toString().toLowerCase(),s&&o>u.length&&(u=r.slice());for(var T=u.length-1;T>-1;T--)if(v.indexOf(u[T])!==-1){if(a||1===u.length)return!0;u.splice(T,1)}else if(!t.multiColumnSearch)break}}}return!1}),this.isOnFilter=!0}},{key:"_sort",value:function(e){var t=this;return 0===this.sortList.length||"undefined"==typeof this.sortList[0]?e:(e.sort(function(e,r){for(var o=0,n=0;n<t.sortList.length;n++){var a=t.sortList[n],s=a.order.toLowerCase()===l.default.SORT_DESC,i=t.colInfos[a.sortField],u=i.sortFunc,p=i.sortFuncExtraData;if(u)o=u(e,r,a.order,a.sortField,p);else{var c=null===e[a.sortField]?"":e[a.sortField],f=null===r[a.sortField]?"":r[a.sortField];o=s?"string"==typeof f?f.localeCompare(c):c>f?-1:c<f?1:0:"string"==typeof c?c.localeCompare(f):c<f?-1:c>f?1:0}if(0!==o)return o}return o}),e)}},{key:"getDataIgnoringPagination",value:function(){return this.getCurrentDisplayData()}},{key:"get",value:function(){var e=this.getCurrentDisplayData();if(0===e.length)return e;var t="function"==typeof this.remote?this.remote(l.default.REMOTE)[l.default.REMOTE_PAGE]:this.remote;if(t||!this.enablePagination)return e;for(var r=[],o=this.pageObj.start;o<=this.pageObj.end&&(r.push(e[o]),o+1!==e.length);o++);return r}},{key:"getKeyField",value:function(){return this.keyField}},{key:"getDataNum",value:function(){return this.getCurrentDisplayData().length}},{key:"isChangedPage",value:function(){return!(!this.pageObj.start||!this.pageObj.end)}},{key:"isEmpty",value:function(){return 0===this.data.length||null===this.data||void 0===this.data}},{key:"getAllRowkey",value:function(){var e=this;return this.data.map(function(t){return t[e.keyField]})}}]),e}();t.TableDataStore=u;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(u,"TableDataStore","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/store/TableDataStore.js")})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=function(e){function t(){return a(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.className,r=e.sizeClass,o=e.children,a=n(e,["className","sizeClass","children"]);return c.default.createElement("div",l({className:"btn-group "+r+" "+t,role:"group"},a),o)}}]),t}(p.Component);f.propTypes={sizeClass:p.PropTypes.string,className:p.PropTypes.string},f.defaultProps={sizeClass:"btn-group-sm",className:""};var d=f;t.default=d;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"ButtonGroup","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ButtonGroup.js"),__REACT_HOT_LOADER__.register(d,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ButtonGroup.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(1),p=o(u),c=r(63),f=o(c),d=r(62),h=o(d),_=r(61),y=o(_),b="react-bs-table-insert-modal",v=function(e){function t(){var e,r,o,s;n(this,t);for(var i=arguments.length,l=Array(i),u=0;u<i;u++)l[u]=arguments[u];return r=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleSave=function(){var e;return(e=o).__handleSave__REACT_HOT_LOADER__.apply(e,arguments)},s=r,a(o,s)}return s(t,e),l(t,[{key:"__handleSave__REACT_HOT_LOADER__",value:function(){var e=this.refs.body;e.getFieldValue?this.props.onSave(e.getFieldValue()):console.error("Custom InsertModalBody should implement getFieldValue function\n and should return an object presented as the new row that user input.")}},{key:"render",value:function(){var e=this.props,t=e.headerComponent,r=e.footerComponent,o=e.bodyComponent,n=this.props,a=n.columns,s=n.validateState,l=n.ignoreEditable,u=n.onModalClose,c={columns:a,validateState:s,ignoreEditable:l};if(o=o&&o(a,s,l),t=t&&t(u,this.handleSave),r=r&&r(u,this.handleSave),o&&(o=p.default.cloneElement(o,{ref:"body"})),t&&t.type.name===f.default.name){var d={};t.props.onModalClose||(d.onModalClose=u),t.props.onSave||(d.onSave=this.handleSave),Object.keys(d).length>0&&(t=p.default.cloneElement(t,d))}else if(t&&t.type.name!==f.default.name){var _=t.props.className;"undefined"!=typeof _&&_.indexOf("modal-header")!==-1||(t=p.default.createElement("div",{className:"modal-header"},t))}if(r&&r.type.name===h.default.name){var v={};r.props.onModalClose||(v.onModalClose=u),r.props.onSave||(v.onSave=this.handleSave),Object.keys(v).length>0&&(r=p.default.cloneElement(r,v))}else if(r&&r.type.name!==h.default.name){var T=r.props.className;"undefined"!=typeof T&&T.indexOf("modal-footer")!==-1||(r=p.default.createElement("div",{className:"modal-footer"},r))}return p.default.createElement("div",{className:"modal-content "+b},t||p.default.createElement(f.default,{className:"react-bs-table-inser-modal-header",onModalClose:u}),o||p.default.createElement(y.default,i({ref:"body"},c)),r||p.default.createElement(h.default,{className:"react-bs-table-inser-modal-footer",onModalClose:u,onSave:this.handleSave}))}}]),t}(u.Component),T=v;t.default=T,v.propTypes={columns:u.PropTypes.array.isRequired,validateState:u.PropTypes.object.isRequired,ignoreEditable:u.PropTypes.bool,headerComponent:u.PropTypes.func,bodyComponent:u.PropTypes.func,footerComponent:u.PropTypes.func,onModalClose:u.PropTypes.func,onSave:u.PropTypes.func},v.defaultProps={};(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(b,"defaultModalClassName","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModal.js"),__REACT_HOT_LOADER__.register(v,"InsertModal","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModal.js"),__REACT_HOT_LOADER__.register(T,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/InsertModal.js"))})()},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){var r=[],o=!0,n=!1,a=void 0;try{for(var s,i=e[Symbol.iterator]();!(o=(s=i.next()).done)&&(r.push(s.value),!t||r.length!==t);o=!0);}catch(e){n=!0,a=e}finally{try{!o&&i.return&&i.return()}finally{if(n)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),c=o(p),f=r(213),d=o(f),h=r(2),_=o(h),y=r(55),b=o(y),v=r(205),T=o(v),m=r(60),E=o(m),g=r(58),O=o(g),C=r(59),P=o(C),w=r(65),R=o(w),S=r(64),A=o(S),x=r(57),k=o(x),D=function(e){function t(e){var r=arguments;n(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.displayCommonMessage=function(){return o.__displayCommonMessage__REACT_HOT_LOADER__.apply(o,arguments)},o.handleSaveBtnClick=function(){return o.__handleSaveBtnClick__REACT_HOT_LOADER__.apply(o,arguments)},o.handleModalClose=function(){return o.__handleModalClose__REACT_HOT_LOADER__.apply(o,arguments)},o.handleModalOpen=function(){return o.__handleModalOpen__REACT_HOT_LOADER__.apply(o,arguments)},o.handleShowOnlyToggle=function(){return o.__handleShowOnlyToggle__REACT_HOT_LOADER__.apply(o,arguments)},o.handleDropRowBtnClick=function(){return o.__handleDropRowBtnClick__REACT_HOT_LOADER__.apply(o,arguments)},o.handleDebounce=function(e,t,n){var a=void 0;return function(){var s=function(){a=null,n||e.apply(o,r)},i=n&&!a;clearTimeout(a),a=setTimeout(s,t||0),i&&e.appy(o,r)}},o.handleKeyUp=function(){return o.__handleKeyUp__REACT_HOT_LOADER__.apply(o,arguments)},o.handleExportCSV=function(){return o.__handleExportCSV__REACT_HOT_LOADER__.apply(o,arguments)},o.handleClearBtnClick=function(){return o.__handleClearBtnClick__REACT_HOT_LOADER__.apply(o,arguments)},o.timeouteClear=0,o.modalClassName,o.state={isInsertModalOpen:!1,validateState:null,shakeEditor:!1,showSelected:!1},o}return s(t,e),u(t,[{key:"componentWillMount",value:function(){var e=this,t=this.props.searchDelayTime?this.props.searchDelayTime:0;this.debounceCallback=this.handleDebounce(function(){var t=e.refs.seachInput;t&&e.props.onSearch(t.getValue())},t)}},{key:"componentWillReceiveProps",value:function(e){e.reset&&this.setSearchInput("")}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"setSearchInput",value:function(e){var t=this.refs.seachInput;t&&t.value!==e&&(t.value=e)}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"__displayCommonMessage__REACT_HOT_LOADER__",value:function(){this.refs.notifier.notice("error","Form validate errors, please checking!","Pressed ESC can cancel")}},{key:"validateNewRow",value:function(e){var t=this,r={},o=!0,n=void 0,a=void 0;return this.props.columns.forEach(function(s){s.isKey&&s.keyValidator?(n=t.props.isValidKey(e[s.field]),n&&(t.displayCommonMessage(),o=!1,r[s.field]=n)):s.editable&&s.editable.validator&&(n=s.editable.validator(e[s.field]),a="undefined"==typeof n?"undefined":l(n),"object"!==a&&n!==!0?(t.displayCommonMessage(),o=!1,r[s.field]=n):"object"===a&&n.isValid!==!0&&(t.refs.notifier.notice(n.notification.type,n.notification.msg,n.notification.title),o=!1,r[s.field]=n.notification.msg))}),!!o||(this.clearTimeout(),this.setState({validateState:r,shakeEditor:!0}),this.timeouteClear=setTimeout(function(){t.setState({shakeEditor:!1})},300),null)}},{key:"__handleSaveBtnClick__REACT_HOT_LOADER__",value:function(e){var t=this;if(this.validateNewRow(e)){var r=this.props.onAddRow(e);r?(this.refs.notifier.notice("error",r,"Pressed ESC can cancel"),this.clearTimeout(),this.setState({shakeEditor:!0,validateState:"this is hack for prevent bootstrap modal hide"}),this.timeouteClear=setTimeout(function(){t.setState({shakeEditor:!1})},300)):this.setState({validateState:null,shakeEditor:!1,isInsertModalOpen:!1})}}},{key:"__handleModalClose__REACT_HOT_LOADER__",value:function(){this.setState({isInsertModalOpen:!1})}},{key:"__handleModalOpen__REACT_HOT_LOADER__",value:function(){this.setState({isInsertModalOpen:!0})}},{key:"__handleShowOnlyToggle__REACT_HOT_LOADER__",value:function(){this.setState({showSelected:!this.state.showSelected}),this.props.onShowOnlySelected()}},{key:"__handleDropRowBtnClick__REACT_HOT_LOADER__",value:function(){this.props.onDropRow()}},{key:"handleCloseBtn",value:function(){this.refs.warning.style.display="none"}},{key:"__handleKeyUp__REACT_HOT_LOADER__",value:function(e){e.persist(),this.debounceCallback(e)}},{key:"__handleExportCSV__REACT_HOT_LOADER__",value:function(){this.props.onExportCSV()}},{key:"__handleClearBtnClick__REACT_HOT_LOADER__",value:function(){var e=this.refs.seachInput;e&&e.setValue(""),this.props.onSearch("")}},{key:"render",value:function(){this.modalClassName="bs-table-modal-sm"+t.modalSeq++;var e=null,r=null,o=null,n=null,a=null,s=null;this.props.enableInsert&&(o=this.props.insertBtn?this.renderCustomBtn(this.props.insertBtn,[this.handleModalOpen],E.default.name,"onClick",this.handleModalOpen):c.default.createElement(E.default,{btnText:this.props.insertText,onClick:this.handleModalOpen})),this.props.enableDelete&&(n=this.props.deleteBtn?this.renderCustomBtn(this.props.deleteBtn,[this.handleDropRowBtnClick],O.default.name,"onClick",this.handleDropRowBtnClick):c.default.createElement(O.default,{btnText:this.props.deleteText,onClick:this.handleDropRowBtnClick})),this.props.enableShowOnlySelected&&(s=this.props.showSelectedOnlyBtn?this.renderCustomBtn(this.props.showSelectedOnlyBtn,[this.handleShowOnlyToggle,this.state.showSelected],R.default.name,"onClick",this.handleShowOnlyToggle):c.default.createElement(R.default,{toggle:this.state.showSelected,onClick:this.handleShowOnlyToggle})),this.props.enableExportCSV&&(a=this.props.exportCSVBtn?this.renderCustomBtn(this.props.exportCSVBtn,[this.handleExportCSV],P.default.name,"onClick",this.handleExportCSV):c.default.createElement(P.default,{btnText:this.props.exportCSVText,onClick:this.handleExportCSV})),r=this.props.btnGroup?this.props.btnGroup({exportCSVBtn:a,insertBtn:o,deleteBtn:n,showSelectedOnlyBtn:s}):c.default.createElement("div",{className:"btn-group btn-group-sm",role:"group"},a,o,n,s);var l=this.renderSearchPanel(),u=i(l,3),p=u[0],f=u[1],d=u[2],h=this.props.enableInsert?this.renderInsertRowModal():null;return e=this.props.toolBar?this.props.toolBar({components:{exportCSVBtn:a,insertBtn:o,deleteBtn:n,showSelectedOnlyBtn:s,searchPanel:p,btnGroup:r,searchField:f,clearBtn:d},event:{openInsertModal:this.handleModalOpen,closeInsertModal:this.handleModalClose,dropRow:this.handleDropRowBtnClick,showOnlyToogle:this.handleShowOnlyToggle,exportCSV:this.handleExportCSV,search:this.props.onSearch}}):c.default.createElement("div",null,c.default.createElement("div",{className:"col-xs-6 col-sm-6 col-md-6 col-lg-8"},"left"===this.props.searchPosition?p:r),c.default.createElement("div",{className:"col-xs-6 col-sm-6 col-md-6 col-lg-4"},"left"===this.props.searchPosition?r:p)),c.default.createElement("div",{className:"row"},e,c.default.createElement(b.default,{ref:"notifier"}),h)}},{key:"renderSearchPanel",value:function(){if(this.props.enableSearch){var e="form-group form-group-sm react-bs-table-search-form",t=null,r=null,o=null;return this.props.clearSearch&&(t=this.props.clearSearchBtn?this.renderCustomBtn(this.props.clearSearchBtn,[this.handleClearBtnClick],k.default.name,"onClick",this.handleClearBtnClick):c.default.createElement(k.default,{onClick:this.handleClearBtnClick}),e+=" input-group input-group-sm"),this.props.searchField?(r=this.props.searchField({search:this.handleKeyUp,defaultValue:this.props.defaultSearch,placeholder:this.props.searchPlaceholder}),r=r.type.name===A.default.name?c.default.cloneElement(r,{ref:"seachInput",onKeyUp:this.handleKeyUp}):c.default.cloneElement(r,{ref:"seachInput"})):r=c.default.createElement(A.default,{ref:"seachInput",defaultValue:this.props.defaultSearch,placeholder:this.props.searchPlaceholder,onKeyUp:this.handleKeyUp}),o=this.props.searchPanel?this.props.searchPanel({searchField:r,clearBtn:t,search:this.props.onSearch,defaultValue:this.props.defaultSearch,placeholder:this.props.searchPlaceholder,clearBtnClick:this.handleClearBtnClick}):c.default.createElement("div",{className:e},r,c.default.createElement("span",{className:"input-group-btn"},t)),[o,r,t]}return[]}},{key:"renderInsertRowModal",value:function(){var e=this.state.validateState||{},t=this.props,r=t.columns,o=t.ignoreEditable,n=t.insertModalHeader,a=t.insertModalBody,s=t.insertModalFooter,i=t.insertModal,l=void 0;return l=i&&i(this.handleModalClose,this.handleSaveBtnClick,r,e,o),l||(l=c.default.createElement(T.default,{columns:r,validateState:e,ignoreEditable:o,onModalClose:this.handleModalClose,onSave:this.handleSaveBtnClick,headerComponent:n,bodyComponent:a,footerComponent:s})),c.default.createElement(d.default,{className:"react-bs-insert-modal modal-dialog",isOpen:this.state.isInsertModalOpen,onRequestClose:this.handleModalClose,contentLabel:"Modal"},l)}},{key:"renderCustomBtn",value:function(e,t,r,o,n){var a=e.apply(null,t);if(a.type.name===r&&!a.props[o]){var s={};s[o]=n,a=c.default.cloneElement(a,s)}return a}}]),t}(p.Component);D.modalSeq=0,D.propTypes={onAddRow:p.PropTypes.func,onDropRow:p.PropTypes.func,onShowOnlySelected:p.PropTypes.func,enableInsert:p.PropTypes.bool,enableDelete:p.PropTypes.bool,enableSearch:p.PropTypes.bool,enableShowOnlySelected:p.PropTypes.bool,columns:p.PropTypes.array,searchPlaceholder:p.PropTypes.string,exportCSVText:p.PropTypes.string,insertText:p.PropTypes.string,deleteText:p.PropTypes.string,saveText:p.PropTypes.string,closeText:p.PropTypes.string,clearSearch:p.PropTypes.bool,ignoreEditable:p.PropTypes.bool,defaultSearch:p.PropTypes.string,insertModalHeader:p.PropTypes.func,insertModalBody:p.PropTypes.func,insertModalFooter:p.PropTypes.func,insertModal:p.PropTypes.func,insertBtn:p.PropTypes.func,deleteBtn:p.PropTypes.func,showSelectedOnlyBtn:p.PropTypes.func,exportCSVBtn:p.PropTypes.func,clearSearchBtn:p.PropTypes.func,searchField:p.PropTypes.func,searchPanel:p.PropTypes.func,btnGroup:p.PropTypes.func,toolBar:p.PropTypes.func,searchPosition:p.PropTypes.string,reset:p.PropTypes.bool,isValidKey:p.PropTypes.func},D.defaultProps={reset:!1,enableInsert:!1,enableDelete:!1,enableSearch:!1,enableShowOnlySelected:!1,clearSearch:!1,ignoreEditable:!1,exportCSVText:_.default.EXPORT_CSV_TEXT,insertText:_.default.INSERT_BTN_TEXT,deleteText:_.default.DELETE_BTN_TEXT,saveText:_.default.SAVE_BTN_TEXT,closeText:_.default.CLOSE_BTN_TEXT};var j=D;t.default=j;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(D,"ToolBar","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ToolBar.js"),__REACT_HOT_LOADER__.register(j,"default","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/toolbar/ToolBar.js"))})()},function(e,t,r){var o,n=n||function(e){"use strict";if(!("undefined"==typeof e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},s=/constructor/i.test(e.HTMLElement)||e.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent),l=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},u="application/octet-stream",p=4e4,c=function(e){var t=function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()};setTimeout(t,p)},f=function(e,t,r){t=[].concat(t);for(var o=t.length;o--;){var n=e["on"+t[o]];if("function"==typeof n)try{n.call(e,r||e)}catch(e){l(e)}}},d=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},h=function(t,l,p){p||(t=d(t));var h,_=this,y=t.type,b=y===u,v=function(){f(_,"writestart progress write writeend".split(" "))},T=function(){if((i||b&&s)&&e.FileReader){var o=new FileReader;return o.onloadend=function(){var t=i?o.result:o.result.replace(/^data:[^;]*;/,"data:attachment/file;"),r=e.open(t,"_blank");r||(e.location.href=t),t=void 0,_.readyState=_.DONE,v()},o.readAsDataURL(t),void(_.readyState=_.INIT)}if(h||(h=r().createObjectURL(t)),b)e.location.href=h;else{var n=e.open(h,"_blank");n||(e.location.href=h)}_.readyState=_.DONE,v(),c(h)};return _.readyState=_.INIT,n?(h=r().createObjectURL(t),void setTimeout(function(){o.href=h,o.download=l,a(o),v(),c(h),_.readyState=_.DONE})):void T()},_=h.prototype,y=function(e,t,r){return new h(e,t||e.name||"download",r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return t=t||e.name||"download",r||(e=d(e)),navigator.msSaveOrOpenBlob(e,t)}:(_.abort=function(){},_.readyState=_.INIT=0,_.WRITING=1,_.DONE=2,_.error=_.onwritestart=_.onprogress=_.onwrite=_.onabort=_.onerror=_.onwriteend=null,y)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);"undefined"!=typeof e&&e.exports?e.exports.saveAs=n:null!==r(216)&&null!==r(217)&&(o=function(){return n}.call(t,r,t,e),!(void 0!==o&&(e.exports=o)));(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(n,"saveAs","/Users/allen/Node/react-bootstrap-table-new/react-bootstrap-table/src/filesaver.js"); })()},function(e,t,r){(function(t){function o(e){return e()}var n=r(1),a=r(6),s=r(215),i=n.createFactory(r(209)),l=r(210),u=r(214),p=r(6).unstable_renderSubtreeIntoContainer,c=r(67),f=s.canUseDOM?window.HTMLElement:{},d=s.canUseDOM?document.body:{appendChild:function(){}},h=n.createClass({displayName:"Modal",statics:{setAppElement:function(e){d=l.setElement(e)},injectCSS:function(){"production"!==t.env.NODE_ENV&&console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}},propTypes:{isOpen:n.PropTypes.bool.isRequired,style:n.PropTypes.shape({content:n.PropTypes.object,overlay:n.PropTypes.object}),portalClassName:n.PropTypes.string,appElement:n.PropTypes.instanceOf(f),onAfterOpen:n.PropTypes.func,onRequestClose:n.PropTypes.func,closeTimeoutMS:n.PropTypes.number,ariaHideApp:n.PropTypes.bool,shouldCloseOnOverlayClick:n.PropTypes.bool,parentSelector:n.PropTypes.func,role:n.PropTypes.string,contentLabel:n.PropTypes.string.isRequired},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}}},componentDidMount:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName;var e=o(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)},componentWillReceiveProps:function(e){var t=o(this.props.parentSelector),r=o(e.parentSelector);r!==t&&(t.removeChild(this.node),r.appendChild(this.node)),this.renderPortal(e)},componentWillUnmount:function(){this.props.ariaHideApp&&l.show(this.props.appElement),a.unmountComponentAtNode(this.node);var e=o(this.props.parentSelector);e.removeChild(this.node),u(document.body).remove("ReactModal__Body--open")},renderPortal:function(e){e.isOpen?u(document.body).add("ReactModal__Body--open"):u(document.body).remove("ReactModal__Body--open"),e.ariaHideApp&&l.toggle(e.isOpen,e.appElement),this.portal=p(this,i(c({},e,{defaultStyles:h.defaultStyles})),this.node)},render:function(){return n.DOM.noscript()}});h.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},e.exports=h}).call(t,r(30))},function(e,t,r){var o=r(1),n=o.DOM.div,a=r(211),s=r(212),i=r(67),l={overlay:{base:"ReactModal__Overlay",afterOpen:"ReactModal__Overlay--after-open",beforeClose:"ReactModal__Overlay--before-close"},content:{base:"ReactModal__Content",afterOpen:"ReactModal__Content--after-open",beforeClose:"ReactModal__Content--before-close"}};e.exports=o.createClass({displayName:"ModalPortal",shouldClose:null,getDefaultProps:function(){return{style:{overlay:{},content:{}}}},getInitialState:function(){return{afterOpen:!1,beforeClose:!1}},componentDidMount:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())},componentWillUnmount:function(){clearTimeout(this.closeTimer)},componentWillReceiveProps:function(e){!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()},componentDidUpdate:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))},setFocusAfterRender:function(e){this.focusAfterRender=e},open:function(){this.state.afterOpen&&this.state.beforeClose?(clearTimeout(this.closeTimer),this.setState({beforeClose:!1})):(a.setupScopedFocus(this.node),a.markForFocusLater(),this.setState({isOpen:!0},function(){this.setState({afterOpen:!0}),this.props.isOpen&&this.props.onAfterOpen&&this.props.onAfterOpen()}.bind(this)))},close:function(){this.ownerHandlesClose()&&(this.props.closeTimeoutMS>0?this.closeWithTimeout():this.closeWithoutTimeout())},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){this.setState({beforeClose:!0},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.props.closeTimeoutMS)}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1},this.afterClose)},afterClose:function(){a.returnFocus(),a.teardownScopedFocus()},handleKeyDown:function(e){9==e.keyCode&&s(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayMouseDown:function(e){null===this.shouldClose&&(this.shouldClose=!0)},handleOverlayMouseUp:function(e){this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentMouseDown:function(e){this.shouldClose=!1},handleContentMouseUp:function(e){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.props.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var r=l[e].base;return this.state.afterOpen&&(r+=" "+l[e].afterOpen),this.state.beforeClose&&(r+=" "+l[e].beforeClose),t?r+" "+t:r},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?n():n({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:i({},t,this.props.style.overlay||{}),onMouseDown:this.handleOverlayMouseDown,onMouseUp:this.handleOverlayMouseUp},n({ref:"content",style:i({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentMouseDown,onMouseUp:this.handleContentMouseUp,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}})},function(e,t){function r(e){if("string"==typeof e){var t=document.querySelectorAll(e);e="length"in t?t[0]:t}return l=e||l}function o(e){s(e),(e||l).setAttribute("aria-hidden","true")}function n(e){s(e),(e||l).removeAttribute("aria-hidden")}function a(e,t){e?o(t):n(t)}function s(e){if(!e&&!l)throw new Error("react-modal: You must set an element with `Modal.setAppElement(el)` to make this accessible")}function i(){l=document.body}var l="undefined"!=typeof document?document.body:null;t.toggle=a,t.setElement=r,t.show=n,t.hide=o,t.resetForTesting=i},function(e,t,r){function o(e){l=!0}function n(e){if(l){if(l=!1,!s)return;setTimeout(function(){if(!s.contains(document.activeElement)){var e=a(s)[0]||s;e.focus()}},0)}}var a=r(66),s=null,i=null,l=!1;t.markForFocusLater=function(){i=document.activeElement},t.returnFocus=function(){try{i.focus()}catch(e){console.warn("You tried to return focus to "+i+" but it is not in the DOM anymore")}i=null},t.setupScopedFocus=function(e){s=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",n,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",n))},t.teardownScopedFocus=function(){s=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",n)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",n))}},function(e,t,r){var o=r(66);e.exports=function(e,t){var r=o(e);if(!r.length)return void t.preventDefault();var n=r[t.shiftKey?0:r.length-1],a=n===document.activeElement||e===document.activeElement;if(a){t.preventDefault();var s=r[t.shiftKey?r.length-1:0];s.focus()}}},function(e,t,r){e.exports=r(208)},function(e,t){function r(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}function o(e){if(!(this instanceof o))return new o(e);e||(e={}),e.nodeType&&(e={el:e}),this.opts=e,this.el=e.el||document.body,"object"!=typeof this.el&&(this.el=document.querySelector(this.el))}e.exports=function(e){return new o(e)},o.prototype.add=function(e){var t=this.el;if(t){if(""===t.className)return t.className=e;var o=t.className.split(" ");return r(o,e)>-1?o:(o.push(e),t.className=o.join(" "),o)}},o.prototype.remove=function(e){var t=this.el;if(t&&""!==t.className){var o=t.className.split(" "),n=r(o,e);return n>-1&&o.splice(n,1),t.className=o.join(" "),o}},o.prototype.has=function(e){var t=this.el;if(t){var o=t.className.split(" ");return r(o,e)>-1}},o.prototype.toggle=function(e){var t=this.el;t&&(this.has(e)?this.remove(e):this.add(e))}},function(e,t,r){var o;/*! Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. */ !function(){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen};o=function(){return a}.call(t,r,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function n(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,n,i,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var p=new Error('Uncaught, unspecified "error" event. ('+t+")");throw p.context=t,p}if(r=this._events[e],s(r))return!1;if(o(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(a(r))for(i=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;l<n;l++)u[l].apply(this,i);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,n,s,i;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,n=-1,r===t||o(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(i=s;i-- >0;)if(r[i]===t||r[i].listener&&r[i].listener===t){n=i;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],o(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}}])});
src/components/Pill/Pill.example.js
6congyao/CGB-Dashboard
/* * Copyright (c) 2016-present, Parse, LLC * All rights reserved. * * This source code is licensed under the license found in the LICENSE file in * the root directory of this source tree. */ import React from 'react'; import Pill from 'components/Pill/Pill.react'; export const component = Pill; export const demos = [ { render: () => ( <div> <Pill value='Public Read + Write' /> <Pill value='Public Read' /> <Pill value='User: y2kjInQFr6' /> </div> ) } ];
client/modules/App/components/DevTools.js
openfocus/HTH-MERN
import React from 'react'; import { createDevTools } from 'redux-devtools'; import LogMonitor from 'redux-devtools-log-monitor'; import DockMonitor from 'redux-devtools-dock-monitor'; export default createDevTools( <DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-w" > <LogMonitor /> </DockMonitor> );
build/lib/Route.js
zeke/react-router
'use strict'; var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var assign = require('react/lib/Object.assign'); var invariant = require('react/lib/invariant'); var warning = require('react/lib/warning'); var PathUtils = require('./PathUtils'); var _currentRoute; var Route = (function () { function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) { _classCallCheck(this, Route); this.name = name; this.path = path; this.paramNames = PathUtils.extractParamNames(this.path); this.ignoreScrollBehavior = !!ignoreScrollBehavior; this.isDefault = !!isDefault; this.isNotFound = !!isNotFound; this.onEnter = onEnter; this.onLeave = onLeave; this.handler = handler; } _createClass(Route, [{ key: 'appendChild', /** * Appends the given route to this route's child routes. */ value: function appendChild(route) { invariant(route instanceof Route, 'route.appendChild must use a valid Route'); if (!this.childRoutes) this.childRoutes = []; this.childRoutes.push(route); } }, { key: 'toString', value: function toString() { var string = '<Route'; if (this.name) string += ' name="' + this.name + '"'; string += ' path="' + this.path + '">'; return string; } }], [{ key: 'createRoute', /** * Creates and returns a new route. Options may be a URL pathname string * with placeholders for named params or an object with any of the following * properties: * * - name The name of the route. This is used to lookup a * route relative to its parent route and should be * unique among all child routes of the same parent * - path A URL pathname string with optional placeholders * that specify the names of params to extract from * the URL when the path matches. Defaults to `/${name}` * when there is a name given, or the path of the parent * route, or / * - ignoreScrollBehavior True to make this route (and all descendants) ignore * the scroll behavior of the router * - isDefault True to make this route the default route among all * its siblings * - isNotFound True to make this route the "not found" route among * all its siblings * - onEnter A transition hook that will be called when the * router is going to enter this route * - onLeave A transition hook that will be called when the * router is going to leave this route * - handler A React component that will be rendered when * this route is active * - parentRoute The parent route to use for this route. This option * is automatically supplied when creating routes inside * the callback to another invocation of createRoute. You * only ever need to use this when declaring routes * independently of one another to manually piece together * the route hierarchy * * The callback may be used to structure your route hierarchy. Any call to * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect * inside the callback automatically uses this route as its parent. */ value: function createRoute(options, callback) { options = options || {}; if (typeof options === 'string') options = { path: options }; var parentRoute = _currentRoute; if (parentRoute) { warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored'); } else { parentRoute = options.parentRoute; } var name = options.name; var path = options.path || name; if (path && !(options.isDefault || options.isNotFound)) { if (PathUtils.isAbsolute(path)) { if (parentRoute) { invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path); } } else if (parentRoute) { // Relative paths extend their parent. path = PathUtils.join(parentRoute.path, path); } else { path = '/' + path; } } else { path = parentRoute ? parentRoute.path : '/'; } if (options.isNotFound && !/\*$/.test(path)) path += '*'; // Auto-append * to the path of not found routes. var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); if (parentRoute) { if (route.isDefault) { invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute); parentRoute.defaultRoute = route; } else if (route.isNotFound) { invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute); parentRoute.notFoundRoute = route; } parentRoute.appendChild(route); } // Any routes created in the callback // use this route as their parent. if (typeof callback === 'function') { var currentRoute = _currentRoute; _currentRoute = route; callback.call(route, route); _currentRoute = currentRoute; } return route; } }, { key: 'createDefaultRoute', /** * Creates and returns a route that is rendered when its parent matches * the current URL. */ value: function createDefaultRoute(options) { return Route.createRoute(assign({}, options, { isDefault: true })); } }, { key: 'createNotFoundRoute', /** * Creates and returns a route that is rendered when its parent matches * the current URL but none of its siblings do. */ value: function createNotFoundRoute(options) { return Route.createRoute(assign({}, options, { isNotFound: true })); } }, { key: 'createRedirect', /** * Creates and returns a route that automatically redirects the transition * to another route. In addition to the normal options to createRoute, this * function accepts the following options: * * - from An alias for the `path` option. Defaults to * * - to The path/route/route name to redirect to * - params The params to use in the redirect URL. Defaults * to using the current params * - query The query to use in the redirect URL. Defaults * to using the current query */ value: function createRedirect(options) { return Route.createRoute(assign({}, options, { path: options.path || options.from || '*', onEnter: function onEnter(transition, params, query) { transition.redirect(options.to, options.params || params, options.query || query); } })); } }]); return Route; })(); module.exports = Route;
ajax/libs/mobx-react/4.0.0/index.js
BenjaminVanRyseghem/cdnjs
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("mobx"), require("react"), require("react-dom")); else if(typeof define === 'function' && define.amd) define(["mobx", "react", "react-dom"], factory); else if(typeof exports === 'object') exports["mobxReact"] = factory(require("mobx"), require("react"), require("react-dom")); else root["mobxReact"] = factory(root["mobx"], root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.reactiveComponent = exports.PropTypes = exports.propTypes = exports.inject = exports.Provider = exports.useStaticRendering = exports.trackComponents = exports.componentByNodeRegistery = exports.renderReporter = exports.Observer = exports.observer = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _arguments = arguments; var _observer = __webpack_require__(1); Object.defineProperty(exports, 'observer', { enumerable: true, get: function get() { return _observer.observer; } }); Object.defineProperty(exports, 'Observer', { enumerable: true, get: function get() { return _observer.Observer; } }); Object.defineProperty(exports, 'renderReporter', { enumerable: true, get: function get() { return _observer.renderReporter; } }); Object.defineProperty(exports, 'componentByNodeRegistery', { enumerable: true, get: function get() { return _observer.componentByNodeRegistery; } }); Object.defineProperty(exports, 'trackComponents', { enumerable: true, get: function get() { return _observer.trackComponents; } }); Object.defineProperty(exports, 'useStaticRendering', { enumerable: true, get: function get() { return _observer.useStaticRendering; } }); var _Provider = __webpack_require__(8); Object.defineProperty(exports, 'Provider', { enumerable: true, get: function get() { return _interopRequireDefault(_Provider).default; } }); var _inject = __webpack_require__(6); Object.defineProperty(exports, 'inject', { enumerable: true, get: function get() { return _interopRequireDefault(_inject).default; } }); var _mobx = __webpack_require__(2); var _mobx2 = _interopRequireDefault(_mobx); var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(4); var _reactNative = __webpack_require__(9); var _propTypes = __webpack_require__(10); var propTypes = _interopRequireWildcard(_propTypes); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var TARGET_LIB_NAME = void 0; if (true) TARGET_LIB_NAME = 'mobx-react'; if (false) TARGET_LIB_NAME = 'mobx-react/native'; if (false) TARGET_LIB_NAME = 'mobx-react/custom'; if (!_mobx2.default) throw new Error(TARGET_LIB_NAME + ' requires the MobX package'); if (!_react2.default) throw new Error(TARGET_LIB_NAME + ' requires React to be available'); if (("browser") === 'browser' && typeof _reactDom.unstable_batchedUpdates === "function") _mobx2.default.extras.setReactionScheduler(_reactDom.unstable_batchedUpdates); if (false) _mobx2.default.extras.setReactionScheduler(_reactNative.unstable_batchedUpdates); exports.propTypes = propTypes; exports.PropTypes = propTypes; exports.default = module.exports; /* Deprecated */ var reactiveComponent = exports.reactiveComponent = function reactiveComponent() { console.warn('[mobx-react] `reactiveComponent` has been renamed to `observer` ' + 'and will be removed in 1.1.'); return observer.apply(null, _arguments); }; /* DevTool support */ if ((typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ? 'undefined' : _typeof(__MOBX_DEVTOOLS_GLOBAL_HOOK__)) === 'object') { __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(module.exports, _mobx2.default); } /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Observer = exports.renderReporter = exports.componentByNodeRegistery = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; exports.trackComponents = trackComponents; exports.useStaticRendering = useStaticRendering; exports.observer = observer; var _mobx = __webpack_require__(2); var _mobx2 = _interopRequireDefault(_mobx); var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); var _EventEmitter = __webpack_require__(5); var _EventEmitter2 = _interopRequireDefault(_EventEmitter); var _inject = __webpack_require__(6); var _inject2 = _interopRequireDefault(_inject); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * dev tool support */ var isDevtoolsEnabled = false; var isUsingStaticRendering = false; var warnedAboutObserverInjectDeprecation = false; // WeakMap<Node, Object>; var componentByNodeRegistery = exports.componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined; var renderReporter = exports.renderReporter = new _EventEmitter2.default(); function findDOMNode(component) { if (_reactDom2.default) return _reactDom2.default.findDOMNode(component); return null; } function reportRendering(component) { var node = findDOMNode(component); if (node && componentByNodeRegistery) componentByNodeRegistery.set(node, component); renderReporter.emit({ event: 'render', renderTime: component.__$mobRenderEnd - component.__$mobRenderStart, totalTime: Date.now() - component.__$mobRenderStart, component: component, node: node }); } function trackComponents() { if (typeof WeakMap === "undefined") throw new Error("[mobx-react] tracking components is not supported in this browser."); if (!isDevtoolsEnabled) isDevtoolsEnabled = true; } function useStaticRendering(useStaticRendering) { isUsingStaticRendering = useStaticRendering; } /** * Utilities */ function patch(target, funcName) { var base = target[funcName]; var mixinFunc = reactiveMixin[funcName]; if (!base) { target[funcName] = mixinFunc; } else { target[funcName] = function () { base.apply(this, arguments); mixinFunc.apply(this, arguments); }; } } function isObjectShallowModified(prev, next) { if (null == prev || null == next || (typeof prev === 'undefined' ? 'undefined' : _typeof(prev)) !== "object" || (typeof next === 'undefined' ? 'undefined' : _typeof(next)) !== "object") { return prev !== next; } var keys = Object.keys(prev); if (keys.length !== Object.keys(next).length) { return true; } var key = void 0; for (var i = keys.length - 1; i >= 0, key = keys[i]; i--) { if (next[key] !== prev[key]) { return true; } } return false; } /** * ReactiveMixin */ var reactiveMixin = { componentWillMount: function componentWillMount() { var _this = this; if (isUsingStaticRendering === true) return; // Generate friendly name for debugging var initialName = this.displayName || this.name || this.constructor && (this.constructor.displayName || this.constructor.name) || "<component>"; var rootNodeID = this._reactInternalInstance && this._reactInternalInstance._rootNodeID; /** * If props are shallowly modified, react will render anyway, * so atom.reportChanged() should not result in yet another re-render */ var skipRender = false; /** * forceUpdate will re-assign this.props. We don't want that to cause a loop, * so detect these changes */ var isForcingUpdate = false; function makePropertyObservableReference(propName) { var valueHolder = this[propName]; var atom = new _mobx2.default.Atom("reactive " + propName); Object.defineProperty(this, propName, { configurable: true, enumerable: true, get: function get() { atom.reportObserved(); return valueHolder; }, set: function set(v) { if (!isForcingUpdate && isObjectShallowModified(valueHolder, v)) { valueHolder = v; skipRender = true; atom.reportChanged(); skipRender = false; } else { valueHolder = v; } } }); } // make this.props an observable reference, see #124 makePropertyObservableReference.call(this, "props"); // make state an observable reference makePropertyObservableReference.call(this, "state"); // wire up reactive render var baseRender = this.render.bind(this); var reaction = null; var isRenderingPending = false; var initialRender = function initialRender() { reaction = new _mobx2.default.Reaction(initialName + '#' + rootNodeID + '.render()', function () { if (!isRenderingPending) { // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js) // This unidiomatic React usage but React will correctly warn about this so we continue as usual // See #85 / Pull #44 isRenderingPending = true; if (typeof _this.componentWillReact === "function") _this.componentWillReact(); // TODO: wrap in action? if (_this.__$mobxIsUnmounted !== true) { // If we are unmounted at this point, componentWillReact() had a side effect causing the component to unmounted // TODO: remove this check? Then react will properly warn about the fact that this should not happen? See #73 // However, people also claim this migth happen during unit tests.. var hasError = true; try { isForcingUpdate = true; if (!skipRender) _react2.default.Component.prototype.forceUpdate.call(_this); hasError = false; } finally { isForcingUpdate = false; if (hasError) reaction.dispose(); } } } }); reactiveRender.$mobx = reaction; _this.render = reactiveRender; return reactiveRender(); }; var reactiveRender = function reactiveRender() { isRenderingPending = false; var rendering = undefined; reaction.track(function () { if (isDevtoolsEnabled) { _this.__$mobRenderStart = Date.now(); } rendering = _mobx2.default.extras.allowStateChanges(false, baseRender); if (isDevtoolsEnabled) { _this.__$mobRenderEnd = Date.now(); } }); return rendering; }; this.render = initialRender; }, componentWillUnmount: function componentWillUnmount() { if (isUsingStaticRendering === true) return; this.render.$mobx && this.render.$mobx.dispose(); this.__$mobxIsUnmounted = true; if (isDevtoolsEnabled) { var node = findDOMNode(this); if (node && componentByNodeRegistery) { componentByNodeRegistery.delete(node); } renderReporter.emit({ event: 'destroy', component: this, node: node }); } }, componentDidMount: function componentDidMount() { if (isDevtoolsEnabled) { reportRendering(this); } }, componentDidUpdate: function componentDidUpdate() { if (isDevtoolsEnabled) { reportRendering(this); } }, shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { if (isUsingStaticRendering) { console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."); } // update on any state changes (as is the default) if (this.state !== nextState) { return true; } // update if props are shallowly not equal, inspired by PureRenderMixin // we could return just 'false' here, and avoid the `skipRender` checks etc // however, it is nicer if lifecycle events are triggered like usually, // so we return true here if props are shallowly modified. return isObjectShallowModified(this.props, nextProps); } }; /** * Observer function / decorator */ function observer(arg1, arg2) { if (typeof arg1 === "string") { throw new Error("Store names should be provided as array"); } if (Array.isArray(arg1)) { // component needs stores if (!warnedAboutObserverInjectDeprecation) { warnedAboutObserverInjectDeprecation = true; console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`'); } if (!arg2) { // invoked as decorator return function (componentClass) { return observer(arg1, componentClass); }; } else { return _inject2.default.apply(null, arg1)(observer(arg2)); } } var componentClass = arg1; if (componentClass.isMobxInjector === true) { console.warn('Mobx observer: You are trying to use \'observer\' on a component that already has \'inject\'. Please apply \'observer\' before applying \'inject\''); } // Stateless function component: // If it is function but doesn't seem to be a react class constructor, // wrap it to a react class automatically if (typeof componentClass === "function" && (!componentClass.prototype || !componentClass.prototype.render) && !componentClass.isReactClass && !_react2.default.Component.isPrototypeOf(componentClass)) { return observer(_react2.default.createClass({ displayName: componentClass.displayName || componentClass.name, propTypes: componentClass.propTypes, contextTypes: componentClass.contextTypes, getDefaultProps: function getDefaultProps() { return componentClass.defaultProps; }, render: function render() { return componentClass.call(this, this.props, this.context); } })); } if (!componentClass) { throw new Error("Please pass a valid component to 'observer'"); } var target = componentClass.prototype || componentClass; ["componentWillMount", "componentWillUnmount", "componentDidMount", "componentDidUpdate"].forEach(function (funcName) { patch(target, funcName); }); if (!target.shouldComponentUpdate) { target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate; } componentClass.isMobXReactObserver = true; return componentClass; } // TODO: support injection somehow as well? var Observer = exports.Observer = observer(function (_ref) { var children = _ref.children; return children(); }); Observer.propTypes = { children: _react2.default.PropTypes.func.isRequired }; /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }, /* 3 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }, /* 4 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_4__; /***/ }, /* 5 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var EventEmitter = function () { function EventEmitter() { _classCallCheck(this, EventEmitter); this.listeners = []; } _createClass(EventEmitter, [{ key: "on", value: function on(cb) { var _this = this; this.listeners.push(cb); return function () { var index = _this.listeners.indexOf(cb); if (index !== -1) _this.listeners.splice(index, 1); }; } }, { key: "emit", value: function emit(data) { this.listeners.forEach(function (fn) { return fn(data); }); } }]); return EventEmitter; }(); exports.default = EventEmitter; /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; exports.default = inject; var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); var _hoistNonReactStatics = __webpack_require__(7); var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); var _observer = __webpack_require__(1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var injectorContextTypes = { mobxStores: _react.PropTypes.object }; Object.seal(injectorContextTypes); var proxiedInjectorProps = { contextTypes: { get: function get() { return injectorContextTypes; }, set: function set(_) { console.warn("Mobx Injector: you are trying to attach `contextTypes` on an component decorated with `inject` (or `observer`) HOC. Please specify the contextTypes on the wrapped component instead. It is accessible through the `wrappedComponent`"); }, configurable: true, enumerable: false }, isMobxInjector: { value: true, writable: true, configurable: true, enumerable: true } }; /** * Store Injection */ function createStoreInjector(grabStoresFn, component, injectNames) { var displayName = "inject-" + (component.displayName || component.name || component.constructor && component.constructor.name || "Unknown"); if (injectNames) displayName += "-with-" + injectNames; var Injector = _react2.default.createClass({ displayName: displayName, storeRef: function storeRef(instance) { this.wrappedInstance = instance; }, render: function render() { // Optimization: it might be more efficient to apply the mapper function *outside* the render method // (if the mapper is a function), that could avoid expensive(?) re-rendering of the injector component // See this test: 'using a custom injector is not too reactive' in inject.js var newProps = {}; for (var key in this.props) { if (this.props.hasOwnProperty(key)) { newProps[key] = this.props[key]; } }var additionalProps = grabStoresFn(this.context.mobxStores || {}, newProps, this.context) || {}; for (var _key in additionalProps) { newProps[_key] = additionalProps[_key]; } newProps.ref = this.storeRef; return _react2.default.createElement(component, newProps); } }); // Static fields from component should be visible on the generated Injector (0, _hoistNonReactStatics2.default)(Injector, component); Injector.wrappedComponent = component; Object.defineProperties(Injector, proxiedInjectorProps); return Injector; } function grabStoresByName(storeNames) { return function (baseStores, nextProps) { storeNames.forEach(function (storeName) { if (storeName in nextProps) // prefer props over stores return; if (!(storeName in baseStores)) throw new Error("MobX observer: Store '" + storeName + "' is not available! Make sure it is provided by some Provider"); nextProps[storeName] = baseStores[storeName]; }); return nextProps; }; } /** * higher order component that injects stores to a child. * takes either a varargs list of strings, which are stores read from the context, * or a function that manually maps the available stores from the context to props: * storesToProps(mobxStores, props, context) => newProps */ function inject() /* fn(stores, nextProps) or ...storeNames */{ var _arguments = arguments; var grabStoresFn = void 0; if (typeof arguments[0] === "function") { grabStoresFn = arguments[0]; return function (componentClass) { var injected = createStoreInjector(grabStoresFn, componentClass); injected.isMobxInjector = false; // supress warning // mark the Injector as observer, to make it react to expressions in `grabStoresFn`, // see #111 injected = (0, _observer.observer)(injected); injected.isMobxInjector = true; // restore warning return injected; }; } else { var _ret = function () { var storeNames = []; for (var i = 0; i < _arguments.length; i++) { storeNames[i] = _arguments[i]; }grabStoresFn = grabStoresByName(storeNames); return { v: function v(componentClass) { return createStoreInjector(grabStoresFn, componentClass, storeNames.join("-")); } }; }(); if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; } } /***/ }, /* 7 */ /***/ function(module, exports) { /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ 'use strict'; var REACT_STATICS = { childContextTypes: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, mixins: true, propTypes: true, type: true }; var KNOWN_STATICS = { name: true, length: true, prototype: true, caller: true, arguments: true, arity: true }; var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function'; module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) { if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components var keys = Object.getOwnPropertyNames(sourceComponent); /* istanbul ignore else */ if (isGetOwnPropertySymbolsAvailable) { keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent)); } for (var i = 0; i < keys.length; ++i) { if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) { try { targetComponent[keys[i]] = sourceComponent[keys[i]]; } catch (error) { } } } } return targetComponent; }; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _class, _temp; var _react = __webpack_require__(3); 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 specialReactKeys = { children: true, key: true, ref: true }; var Provider = (_temp = _class = function (_Component) { _inherits(Provider, _Component); function Provider() { _classCallCheck(this, Provider); return _possibleConstructorReturn(this, Object.getPrototypeOf(Provider).apply(this, arguments)); } _createClass(Provider, [{ key: "render", value: function render() { return _react2.default.Children.only(this.props.children); } }, { key: "getChildContext", value: function getChildContext() { var stores = {}; // inherit stores var baseStores = this.context.mobxStores; if (baseStores) for (var key in baseStores) { stores[key] = baseStores[key]; } // add own stores for (var _key in this.props) { if (!specialReactKeys[_key]) stores[_key] = this.props[_key]; }return { mobxStores: stores }; } }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps(nextProps) { // Maybe this warning is to aggressive? if (Object.keys(nextProps).length !== Object.keys(this.props).length) console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"); for (var key in nextProps) { if (!specialReactKeys[key] && this.props[key] !== nextProps[key]) console.warn("MobX Provider: Provided store '" + key + "' has changed. Please avoid replacing stores as the change might not propagate to all children"); } } }]); return Provider; }(_react.Component), _class.contextTypes = { mobxStores: _react.PropTypes.object }, _class.childContextTypes = { mobxStores: _react.PropTypes.object.isRequired }, _temp); exports.default = Provider; /***/ }, /* 9 */ /***/ function(module, exports) { module.exports = null /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.objectOrObservableObject = exports.arrayOrObservableArrayOf = exports.arrayOrObservableArray = exports.observableObject = exports.observableMap = exports.observableArrayOf = exports.observableArray = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _mobx = __webpack_require__(2); // Copied from React.PropTypes function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { rest[_key - 6] = arguments[_key]; } return (0, _mobx.untracked)(function () { componentName = componentName || '<<anonymous>>'; propFullName = propFullName || propName; if (props[propName] == null) { if (isRequired) { var actual = props[propName] === null ? 'null' : 'undefined'; return new Error('The ' + location + ' `' + propFullName + '` is marked as required ' + 'in `' + componentName + '`, but its value is `' + actual + '`.'); } return null; } else { return validate.apply(undefined, [props, propName, componentName, location, propFullName].concat(rest)); } }); } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } // Copied from React.PropTypes function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } return false; } // Copied from React.PropTypes function getPropType(propValue) { var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue); if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // Copied from React.PropTypes function getPreciseType(propValue) { var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } function createObservableTypeCheckerCreator(allowNativeType, mobxType) { return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) { return (0, _mobx.untracked)(function () { if (allowNativeType) { if (getPropType(props[propName]) === mobxType.toLowerCase()) return null; } var mobxChecker = void 0; switch (mobxType) { case 'Array': mobxChecker = _mobx.isObservableArray;break; case 'Object': mobxChecker = _mobx.isObservableObject;break; case 'Map': mobxChecker = _mobx.isObservableMap;break; default: throw new Error('Unexpected mobxType: ' + mobxType); } var propValue = props[propName]; if (!mobxChecker(propValue)) { var preciseType = getPreciseType(propValue); var nativeTypeExpectationMessage = allowNativeType ? ' or javascript `' + mobxType.toLowerCase() + '`' : ''; return new Error('Invalid prop `' + propFullName + '` of type `' + preciseType + '` supplied to' + ' `' + componentName + '`, expected `mobx.Observable' + mobxType + '`' + nativeTypeExpectationMessage + '.'); } return null; }); }); } function createObservableArrayOfTypeChecker(allowNativeType, typeChecker) { return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) { for (var _len2 = arguments.length, rest = Array(_len2 > 5 ? _len2 - 5 : 0), _key2 = 5; _key2 < _len2; _key2++) { rest[_key2 - 5] = arguments[_key2]; } return (0, _mobx.untracked)(function () { if (typeof typeChecker !== 'function') { return new Error('Property `' + propFullName + '` of component `' + componentName + '` has ' + 'invalid PropType notation.'); } var error = createObservableTypeCheckerCreator(allowNativeType, 'Array')(props, propName, componentName); if (error instanceof Error) return error; var propValue = props[propName]; for (var i = 0; i < propValue.length; i++) { error = typeChecker.apply(undefined, [propValue, i, componentName, location, propFullName + '[' + i + ']'].concat(rest)); if (error instanceof Error) return error; } return null; }); }); } var observableArray = exports.observableArray = createObservableTypeCheckerCreator(false, 'Array'); var observableArrayOf = exports.observableArrayOf = createObservableArrayOfTypeChecker.bind(null, false); var observableMap = exports.observableMap = createObservableTypeCheckerCreator(false, 'Map'); var observableObject = exports.observableObject = createObservableTypeCheckerCreator(false, 'Object'); var arrayOrObservableArray = exports.arrayOrObservableArray = createObservableTypeCheckerCreator(true, 'Array'); var arrayOrObservableArrayOf = exports.arrayOrObservableArrayOf = createObservableArrayOfTypeChecker.bind(null, true); var objectOrObservableObject = exports.objectOrObservableObject = createObservableTypeCheckerCreator(true, 'Object'); /***/ } /******/ ]) }); ;
src/Orchard.Web/Modules/Orchard.jQuery/Scripts/jquery-1.11.1.min.js
BrianAckerman/Lost-Arts-Astrology
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px") },cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
src/core/LoginLogout/component.js
dlennox24/ricro-app-template
import Avatar from '@material-ui/core/Avatar'; import CircularProgress from '@material-ui/core/CircularProgress'; import Portal from '@material-ui/core/Portal'; import Snackbar from '@material-ui/core/Snackbar'; import withStyles from '@material-ui/core/styles/withStyles'; import axios from 'axios'; import IconAccountCircle from 'mdi-material-ui/AccountCircle'; import IconLoginVariant from 'mdi-material-ui/LoginVariant'; import IconLogoutVariant from 'mdi-material-ui/LogoutVariant'; import PropTypes from 'prop-types'; import React from 'react'; import userDefaultProfileImg from '../../assets/img/default-profile.svg'; import IconSnackbarContent from '../../component/IconSnackbarContent'; import UserProfile from '../../component/UserProfile'; import NavList from '../Nav/NavList'; import styles from './styles'; const hasLoginSuccess = window.location.hash === '#login-success'; const loadingProgressCircle = <CircularProgress color="secondary" size={24} />; class LoginLogoutComponent extends React.Component { state = { isLoginLoading: false, isLogoutLoading: false, isUserProfileOpen: false, snackbar: { open: false, variant: null, message: '', }, }; handleOpenUserProfile = () => { this.setState({ isUserProfileOpen: true, }); }; handleCloseUserProfile = () => { this.setState({ isUserProfileOpen: false, }); }; handleToggleDropDown = () => { this.setState(state => ({ isDropDownOpen: !state.isDropDownOpen, })); }; handleSnackbarClose = () => { this.setState(state => ({ snackbar: { ...state.snackbar, open: false, }, })); }; handleLogin = () => { /* * When a user logs in and they don't have a current Shibboleth session * they are redirected to the Shibboleth login page. When they are returned * by the login page (auth.host+auth.loginPath) the application cannot know if it * should perform a login check again (unless hasAutoLogin is true in * config). * * To get around this the login page '#login-success' appended to the end * of the url as a hash value. The app checks window.location.hash to see * if it should perform a login check and then rests the hash value to * remove it from the url. * * Doesn't use api.axios instance because the baseURL of api.axios points * to the current version of the API. Authentication is at least one level * higher. */ this.setState({ isLoginLoading: true }); const { auth } = this.props; axios .get(auth.host + auth.loginPath, { withCredentials: true }) .then(response => { if (response.data.status === 'redirect') { const redirect = response.data.result.includes('?') ? `${response.data.result}&` : `${response.data.result}?`; window.location = `${redirect}return=${window.location.href}`; } this.props.handleLogin(response.data.result); if (hasLoginSuccess) { // resets window.location.hash to remove unneeded #login-success window.history.replaceState(null, null, ' '); } this.setState({ isLoginLoading: false, snackbar: { open: true, variant: 'success', message: 'Successfully logged in!', }, }); }) .catch(() => { this.setState({ isLoginLoading: false, snackbar: { open: true, variant: 'error', message: 'Failed to login. Please contact us if this error persists.', }, }); }); }; checkIsShibbolethLoggedIn = () => { this.setState({ isLoginLoading: true }); const { auth } = this.props; axios .get(auth.host + auth.shibPath) .then(response => { if (response.data.status === 'success') { this.props.handleLogin(response.data.result); this.setState({ snackbar: { open: true, variant: 'info', message: 'Single sign-on session detected. Automatically logged in!', }, }); } this.setState({ isLoginLoading: false }); }) .catch(() => { this.setState({ isLoginLoading: false }); }); }; handleLogout = () => { this.setState({ isLogoutLoading: true }); const { auth } = this.props; axios .get(auth.host + auth.logoutPath, { withCredentials: true }) .then(() => { this.props.handleLogout(); this.setState({ isLogoutLoading: false, snackbar: { open: true, variant: 'success', message: 'Successfully logged out! You must fully close your browser to logout completely.', }, }); }) .catch(() => { this.setState({ isLogoutLoading: false, snackbar: { open: true, variant: 'error', message: 'Failed to logout. Please contact us if this error persists.', }, }); }); }; createNavItems = () => { const { isLoginLoading, isLogoutLoading } = this.state; const { user } = this.props; return [ [ { name: this.isLoggedIn() ? user.displayName : 'Login', icon: isLoginLoading ? loadingProgressCircle : this.createLoginIcons(), onClick: this.isLoggedIn() ? null : this.handleLogin, disabled: isLoginLoading, dense: true, subNav: !this.isLoggedIn() ? null : [ [ { name: 'Account', icon: <IconAccountCircle />, onClick: this.handleOpenUserProfile, }, { name: 'Logout', icon: isLogoutLoading ? loadingProgressCircle : <IconLogoutVariant />, onClick: this.handleLogout, disabled: isLogoutLoading, }, ], ], }, ], ]; }; createLoginIcons = () => { const { api, classes, user } = this.props; return this.isLoggedIn() ? ( <Avatar className={classes.profileAvatar} alt={`${user.displayName}'s profile image`} src={ user.profileImage ? (api.host + user.profileImage).replace('large', 'icon') : userDefaultProfileImg } /> ) : ( <IconLoginVariant /> ); }; isLoggedIn = () => Boolean(this.props.user !== 'loggedout' && this.props.user != null); componentDidMount = () => { if (hasLoginSuccess || this.props.hasAutoLogin) { this.handleLogin(); } else { this.checkIsShibbolethLoggedIn(); } }; render() { const { user } = this.props; const { isUserProfileOpen, snackbar } = this.state; return ( <React.Fragment> <NavList nav={this.createNavItems()} listProps={{ disablePadding: true }} /> {this.isLoggedIn() && ( <UserProfile variant="dialog" user={user} open={isUserProfileOpen} onClose={this.handleCloseUserProfile} /> )} <Portal> <Snackbar anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }} open={snackbar.open} autoHideDuration={6000} onClose={this.handleSnackbarClose} > <IconSnackbarContent variant={snackbar.variant} onClose={this.handleSnackbarClose} message={snackbar.message} disableAction /> </Snackbar> </Portal> </React.Fragment> ); } } LoginLogoutComponent.propTypes = { api: PropTypes.object.isRequired, // redux state auth: PropTypes.object.isRequired, // redux state classes: PropTypes.object.isRequired, // MUI withStyles() handleLogin: PropTypes.func.isRequired, // redux - index.js:mapDispatchToProps handleLogout: PropTypes.func.isRequired, // redux - index.js:mapDispatchToProps hasAutoLogin: PropTypes.bool.isRequired, // redux state user: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), // redux state }; export default withStyles(styles)(LoginLogoutComponent);
node_modules/bson/browser_build/bson.js
VahapZTL/OyunCeviri-EasyTranslation
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(1); module.exports = __webpack_require__(298); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {"use strict"; __webpack_require__(2); __webpack_require__(293); __webpack_require__(295); if (global._babelPolyfill) { throw new Error("only one instance of babel-polyfill is allowed"); } global._babelPolyfill = true; var DEFINE_PROPERTY = "defineProperty"; function define(O, key, value) { O[key] || Object[DEFINE_PROPERTY](O, key, { writable: true, configurable: true, value: value }); } define(String.prototype, "padLeft", "".padStart); define(String.prototype, "padRight", "".padEnd); "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) { [][key] && define(Array, key, Function.call.bind([][key])); }); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(3); __webpack_require__(52); __webpack_require__(53); __webpack_require__(54); __webpack_require__(55); __webpack_require__(57); __webpack_require__(60); __webpack_require__(61); __webpack_require__(62); __webpack_require__(63); __webpack_require__(64); __webpack_require__(65); __webpack_require__(66); __webpack_require__(67); __webpack_require__(68); __webpack_require__(70); __webpack_require__(72); __webpack_require__(74); __webpack_require__(76); __webpack_require__(79); __webpack_require__(80); __webpack_require__(81); __webpack_require__(85); __webpack_require__(87); __webpack_require__(89); __webpack_require__(92); __webpack_require__(93); __webpack_require__(94); __webpack_require__(95); __webpack_require__(97); __webpack_require__(98); __webpack_require__(99); __webpack_require__(100); __webpack_require__(101); __webpack_require__(102); __webpack_require__(103); __webpack_require__(105); __webpack_require__(106); __webpack_require__(107); __webpack_require__(109); __webpack_require__(110); __webpack_require__(111); __webpack_require__(113); __webpack_require__(114); __webpack_require__(115); __webpack_require__(116); __webpack_require__(117); __webpack_require__(118); __webpack_require__(119); __webpack_require__(120); __webpack_require__(121); __webpack_require__(122); __webpack_require__(123); __webpack_require__(124); __webpack_require__(125); __webpack_require__(126); __webpack_require__(131); __webpack_require__(132); __webpack_require__(136); __webpack_require__(137); __webpack_require__(138); __webpack_require__(139); __webpack_require__(141); __webpack_require__(142); __webpack_require__(143); __webpack_require__(144); __webpack_require__(145); __webpack_require__(146); __webpack_require__(147); __webpack_require__(148); __webpack_require__(149); __webpack_require__(150); __webpack_require__(151); __webpack_require__(152); __webpack_require__(153); __webpack_require__(154); __webpack_require__(155); __webpack_require__(156); __webpack_require__(157); __webpack_require__(159); __webpack_require__(160); __webpack_require__(166); __webpack_require__(167); __webpack_require__(169); __webpack_require__(170); __webpack_require__(171); __webpack_require__(175); __webpack_require__(176); __webpack_require__(177); __webpack_require__(178); __webpack_require__(179); __webpack_require__(181); __webpack_require__(182); __webpack_require__(183); __webpack_require__(184); __webpack_require__(187); __webpack_require__(189); __webpack_require__(190); __webpack_require__(191); __webpack_require__(193); __webpack_require__(195); __webpack_require__(197); __webpack_require__(198); __webpack_require__(199); __webpack_require__(201); __webpack_require__(202); __webpack_require__(203); __webpack_require__(204); __webpack_require__(211); __webpack_require__(214); __webpack_require__(215); __webpack_require__(217); __webpack_require__(218); __webpack_require__(221); __webpack_require__(222); __webpack_require__(224); __webpack_require__(225); __webpack_require__(226); __webpack_require__(227); __webpack_require__(228); __webpack_require__(229); __webpack_require__(230); __webpack_require__(231); __webpack_require__(232); __webpack_require__(233); __webpack_require__(234); __webpack_require__(235); __webpack_require__(236); __webpack_require__(237); __webpack_require__(238); __webpack_require__(239); __webpack_require__(240); __webpack_require__(241); __webpack_require__(242); __webpack_require__(244); __webpack_require__(245); __webpack_require__(246); __webpack_require__(247); __webpack_require__(248); __webpack_require__(249); __webpack_require__(251); __webpack_require__(252); __webpack_require__(253); __webpack_require__(254); __webpack_require__(255); __webpack_require__(256); __webpack_require__(257); __webpack_require__(258); __webpack_require__(260); __webpack_require__(261); __webpack_require__(263); __webpack_require__(264); __webpack_require__(265); __webpack_require__(266); __webpack_require__(269); __webpack_require__(270); __webpack_require__(271); __webpack_require__(272); __webpack_require__(273); __webpack_require__(274); __webpack_require__(275); __webpack_require__(276); __webpack_require__(278); __webpack_require__(279); __webpack_require__(280); __webpack_require__(281); __webpack_require__(282); __webpack_require__(283); __webpack_require__(284); __webpack_require__(285); __webpack_require__(286); __webpack_require__(287); __webpack_require__(288); __webpack_require__(291); __webpack_require__(292); module.exports = __webpack_require__(9); /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // ECMAScript 6 symbols shim var global = __webpack_require__(4) , has = __webpack_require__(5) , DESCRIPTORS = __webpack_require__(6) , $export = __webpack_require__(8) , redefine = __webpack_require__(18) , META = __webpack_require__(22).KEY , $fails = __webpack_require__(7) , shared = __webpack_require__(23) , setToStringTag = __webpack_require__(24) , uid = __webpack_require__(19) , wks = __webpack_require__(25) , wksExt = __webpack_require__(26) , wksDefine = __webpack_require__(27) , keyOf = __webpack_require__(29) , enumKeys = __webpack_require__(42) , isArray = __webpack_require__(45) , anObject = __webpack_require__(12) , toIObject = __webpack_require__(32) , toPrimitive = __webpack_require__(16) , createDesc = __webpack_require__(17) , _create = __webpack_require__(46) , gOPNExt = __webpack_require__(49) , $GOPD = __webpack_require__(51) , $DP = __webpack_require__(11) , $keys = __webpack_require__(30) , 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 = typeof $Symbol == 'function' , QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = DESCRIPTORS && $fails(function(){ return _create(dP({}, 'a', { get: function(){ return dP(this, 'a', {value: 7}).a; } })).a != 7; }) ? function(it, key, D){ var protoDesc = gOPD(ObjectProto, key); if(protoDesc)delete ObjectProto[key]; dP(it, key, D); if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); } : dP; var wrap = function(tag){ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ return typeof it == 'symbol'; } : function(it){ return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D){ if(it === ObjectProto)$defineProperty(OPSymbols, key, D); anObject(it); key = toPrimitive(key, true); anObject(D); if(has(AllSymbols, key)){ if(!D.enumerable){ if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); it[HIDDEN][key] = true; } else { if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; D = _create(D, {enumerable: createDesc(0, false)}); } return setSymbolDesc(it, key, D); } return dP(it, key, D); }; var $defineProperties = function defineProperties(it, P){ anObject(it); var keys = enumKeys(P = toIObject(P)) , i = 0 , l = keys.length , key; while(l > i)$defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P){ return P === undefined ? _create(it) : $defineProperties(_create(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key){ var E = isEnum.call(this, key = toPrimitive(key, true)); if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ it = toIObject(it); key = toPrimitive(key, true); if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; var D = gOPD(it, key); if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it){ var names = gOPN(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ var IS_OP = it === ObjectProto , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); } return result; }; // 19.4.1.1 Symbol([description]) if(!USE_NATIVE){ $Symbol = function Symbol(){ if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); var tag = uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function(value){ if(this === ObjectProto)$set.call(OPSymbols, value); if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; setSymbolDesc(this, tag, createDesc(1, value)); }; if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); return wrap(tag); }; redefine($Symbol[PROTOTYPE], 'toString', function toString(){ return this._k; }); $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; __webpack_require__(50).f = gOPNExt.f = $getOwnPropertyNames; __webpack_require__(44).f = $propertyIsEnumerable; __webpack_require__(43).f = $getOwnPropertySymbols; if(DESCRIPTORS && !__webpack_require__(28)){ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } wksExt.f = function(name){ return wrap(wks(name)); } } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); for(var symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 '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 keyFor(key){ if(isSymbol(key))return keyOf(SymbolRegistry, key); throw TypeError(key + ' is not a symbol!'); }, useSetter: function(){ setter = true; }, useSimple: function(){ setter = false; } }); $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 _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it){ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined var args = [it] , i = 1 , replacer, $replacer; while(arguments.length > i)args.push(arguments[i++]); replacer = args[1]; if(typeof replacer == 'function')$replacer = replacer; if($replacer || !isArray(replacer))replacer = function(key, value){ if($replacer)value = $replacer.call(this, key, value); if(!isSymbol(value))return value; }; args[1] = replacer; return _stringify.apply($JSON, args); } }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(10)($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', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); /***/ }, /* 4 */ /***/ function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }, /* 5 */ /***/ function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(7)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, /* 7 */ /***/ function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , core = __webpack_require__(9) , hide = __webpack_require__(10) , redefine = __webpack_require__(18) , ctx = __webpack_require__(20) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var 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 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target)redefine(target, key, out, type & $export.U); // export if(exports[key] != out)hide(exports, key, exp); if(IS_PROTO && expProto[key] != out)expProto[key] = out; } }; global.core = core; // 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; /***/ }, /* 9 */ /***/ function(module, exports) { var core = module.exports = {version: '2.4.0'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11) , createDesc = __webpack_require__(17); module.exports = __webpack_require__(6) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { var anObject = __webpack_require__(12) , IE8_DOM_DEFINE = __webpack_require__(14) , toPrimitive = __webpack_require__(16) , dP = Object.defineProperty; exports.f = __webpack_require__(6) ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); if(IE8_DOM_DEFINE)try { return dP(O, P, Attributes); } catch(e){ /* empty */ } if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); if('value' in Attributes)O[P] = Attributes.value; return O; }; /***/ }, /* 12 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }, /* 13 */ /***/ function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(6) && !__webpack_require__(7)(function(){ return Object.defineProperty(__webpack_require__(15)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13) , document = __webpack_require__(4).document // in old IE typeof document.createElement is 'object' , is = isObject(document) && isObject(document.createElement); module.exports = function(it){ return is ? document.createElement(it) : {}; }; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(13); // 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 && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }, /* 17 */ /***/ function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , hide = __webpack_require__(10) , has = __webpack_require__(5) , SRC = __webpack_require__(19)('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); __webpack_require__(9).inspectSource = function(it){ return $toString.call(it); }; (module.exports = function(O, key, val, safe){ var isFunction = typeof val == 'function'; if(isFunction)has(val, 'name') || hide(val, 'name', key); if(O[key] === val)return; if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if(O === global){ O[key] = val; } else { if(!safe){ delete O[key]; hide(O, key, val); } else { if(O[key])O[key] = val; else hide(O, key, val); } } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString(){ return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }, /* 19 */ /***/ function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(21); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }, /* 21 */ /***/ function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { var META = __webpack_require__(19)('meta') , isObject = __webpack_require__(13) , has = __webpack_require__(5) , setDesc = __webpack_require__(11).f , id = 0; var isExtensible = Object.isExtensible || function(){ return true; }; var FREEZE = !__webpack_require__(7)(function(){ return isExtensible(Object.preventExtensions({})); }); var setMeta = function(it){ setDesc(it, META, {value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs }}); }; var fastKey = function(it, create){ // return primitive with prefix if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? '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 object ID } return it[META].i; }; var getWeak = function(it, create){ if(!has(it, META)){ // can't set metadata to uncaught frozen object if(!isExtensible(it))return true; // not necessary to add metadata if(!create)return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function(it){ if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { var def = __webpack_require__(11).f , has = __webpack_require__(5) , TAG = __webpack_require__(25)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { var store = __webpack_require__(23)('wks') , uid = __webpack_require__(19) , Symbol = __webpack_require__(4).Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { exports.f = __webpack_require__(25); /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , core = __webpack_require__(9) , LIBRARY = __webpack_require__(28) , wksExt = __webpack_require__(26) , defineProperty = __webpack_require__(11).f; module.exports = function(name){ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); }; /***/ }, /* 28 */ /***/ function(module, exports) { module.exports = false; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(30) , toIObject = __webpack_require__(32); module.exports = function(object, el){ var O = toIObject(object) , keys = getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; }; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(31) , enumBugKeys = __webpack_require__(41); module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { var has = __webpack_require__(5) , toIObject = __webpack_require__(32) , arrayIndexOf = __webpack_require__(36)(false) , IE_PROTO = __webpack_require__(40)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) , i = 0 , result = [] , key; for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); // Don't enum bug & hidden keys while(names.length > i)if(has(O, key = names[i++])){ ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }, /* 32 */ /***/ function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(33) , defined = __webpack_require__(35); module.exports = function(it){ return IObject(defined(it)); }; /***/ }, /* 33 */ /***/ function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(34); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }, /* 34 */ /***/ function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }, /* 35 */ /***/ function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }, /* 36 */ /***/ function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(32) , toLength = __webpack_require__(37) , toIndex = __webpack_require__(39); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) , length = toLength(O.length) , index = toIndex(fromIndex, length) , value; // Array#includes uses SameValueZero equality algorithm if(IS_INCLUDES && el != el)while(length > index){ value = O[index++]; if(value != value)return true; // Array#toIndex ignores holes, Array#includes - not } else for(;length > index; index++)if(IS_INCLUDES || index in O){ if(O[index] === el)return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; /***/ }, /* 37 */ /***/ function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(38) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }, /* 38 */ /***/ 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); }; /***/ }, /* 39 */ /***/ function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(38) , max = Math.max , min = Math.min; module.exports = function(index, length){ index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { var shared = __webpack_require__(23)('keys') , uid = __webpack_require__(19); module.exports = function(key){ return shared[key] || (shared[key] = uid(key)); }; /***/ }, /* 41 */ /***/ function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }, /* 42 */ /***/ function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols var getKeys = __webpack_require__(30) , gOPS = __webpack_require__(43) , pIE = __webpack_require__(44); module.exports = function(it){ var result = getKeys(it) , getSymbols = gOPS.f; if(getSymbols){ var symbols = getSymbols(it) , isEnum = pIE.f , i = 0 , key; while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); } return result; }; /***/ }, /* 43 */ /***/ function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }, /* 44 */ /***/ function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }, /* 45 */ /***/ function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__(34); module.exports = Array.isArray || function isArray(arg){ return cof(arg) == 'Array'; }; /***/ }, /* 46 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(12) , dPs = __webpack_require__(47) , enumBugKeys = __webpack_require__(41) , IE_PROTO = __webpack_require__(40)('IE_PROTO') , Empty = function(){ /* empty */ } , PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(15)('iframe') , i = enumBugKeys.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; __webpack_require__(48).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; while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties){ var result; if(O !== null){ Empty[PROTOTYPE] = anObject(O); result = new Empty; Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }, /* 47 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11) , anObject = __webpack_require__(12) , getKeys = __webpack_require__(30); module.exports = __webpack_require__(6) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); var keys = getKeys(Properties) , length = keys.length , i = 0 , P; while(length > i)dP.f(O, P = keys[i++], Properties[P]); return O; }; /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(4).document && document.documentElement; /***/ }, /* 49 */ /***/ function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __webpack_require__(32) , gOPN = __webpack_require__(50).f , toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it){ try { return gOPN(it); } catch(e){ return windowNames.slice(); } }; module.exports.f = function getOwnPropertyNames(it){ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); }; /***/ }, /* 50 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = __webpack_require__(31) , hiddenKeys = __webpack_require__(41).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ return $keys(O, hiddenKeys); }; /***/ }, /* 51 */ /***/ function(module, exports, __webpack_require__) { var pIE = __webpack_require__(44) , createDesc = __webpack_require__(17) , toIObject = __webpack_require__(32) , toPrimitive = __webpack_require__(16) , has = __webpack_require__(5) , IE8_DOM_DEFINE = __webpack_require__(14) , gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__(6) ? gOPD : function getOwnPropertyDescriptor(O, P){ O = toIObject(O); P = toPrimitive(P, true); if(IE8_DOM_DEFINE)try { return gOPD(O, P); } catch(e){ /* empty */ } if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }, /* 52 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) $export($export.S, 'Object', {create: __webpack_require__(46)}); /***/ }, /* 53 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) $export($export.S + $export.F * !__webpack_require__(6), 'Object', {defineProperty: __webpack_require__(11).f}); /***/ }, /* 54 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8); // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) $export($export.S + $export.F * !__webpack_require__(6), 'Object', {defineProperties: __webpack_require__(47)}); /***/ }, /* 55 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) var toIObject = __webpack_require__(32) , $getOwnPropertyDescriptor = __webpack_require__(51).f; __webpack_require__(56)('getOwnPropertyDescriptor', function(){ return function getOwnPropertyDescriptor(it, key){ return $getOwnPropertyDescriptor(toIObject(it), key); }; }); /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(8) , core = __webpack_require__(9) , fails = __webpack_require__(7); 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); }; /***/ }, /* 57 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.9 Object.getPrototypeOf(O) var toObject = __webpack_require__(58) , $getPrototypeOf = __webpack_require__(59); __webpack_require__(56)('getPrototypeOf', function(){ return function getPrototypeOf(it){ return $getPrototypeOf(toObject(it)); }; }); /***/ }, /* 58 */ /***/ function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(35); module.exports = function(it){ return Object(defined(it)); }; /***/ }, /* 59 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(5) , toObject = __webpack_require__(58) , IE_PROTO = __webpack_require__(40)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ O = toObject(O); if(has(O, IE_PROTO))return O[IE_PROTO]; if(typeof O.constructor == 'function' && O instanceof O.constructor){ return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }, /* 60 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 Object.keys(O) var toObject = __webpack_require__(58) , $keys = __webpack_require__(30); __webpack_require__(56)('keys', function(){ return function keys(it){ return $keys(toObject(it)); }; }); /***/ }, /* 61 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.7 Object.getOwnPropertyNames(O) __webpack_require__(56)('getOwnPropertyNames', function(){ return __webpack_require__(49).f; }); /***/ }, /* 62 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.5 Object.freeze(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(22).onFreeze; __webpack_require__(56)('freeze', function($freeze){ return function freeze(it){ return $freeze && isObject(it) ? $freeze(meta(it)) : it; }; }); /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(22).onFreeze; __webpack_require__(56)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(meta(it)) : it; }; }); /***/ }, /* 64 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.15 Object.preventExtensions(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(22).onFreeze; __webpack_require__(56)('preventExtensions', function($preventExtensions){ return function preventExtensions(it){ return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; }; }); /***/ }, /* 65 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.12 Object.isFrozen(O) var isObject = __webpack_require__(13); __webpack_require__(56)('isFrozen', function($isFrozen){ return function isFrozen(it){ return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; }; }); /***/ }, /* 66 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.13 Object.isSealed(O) var isObject = __webpack_require__(13); __webpack_require__(56)('isSealed', function($isSealed){ return function isSealed(it){ return isObject(it) ? $isSealed ? $isSealed(it) : false : true; }; }); /***/ }, /* 67 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.11 Object.isExtensible(O) var isObject = __webpack_require__(13); __webpack_require__(56)('isExtensible', function($isExtensible){ return function isExtensible(it){ return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; }; }); /***/ }, /* 68 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(8); $export($export.S + $export.F, 'Object', {assign: __webpack_require__(69)}); /***/ }, /* 69 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(30) , gOPS = __webpack_require__(43) , pIE = __webpack_require__(44) , toObject = __webpack_require__(58) , IObject = __webpack_require__(33) , $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__(7)(function(){ var A = {} , B = {} , S = Symbol() , K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function(k){ B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source){ // eslint-disable-line no-unused-vars var T = toObject(target) , aLen = arguments.length , index = 1 , getSymbols = gOPS.f , isEnum = pIE.f; while(aLen > index){ var S = IObject(arguments[index++]) , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) , length = keys.length , j = 0 , key; while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; } return T; } : $assign; /***/ }, /* 70 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.10 Object.is(value1, value2) var $export = __webpack_require__(8); $export($export.S, 'Object', {is: __webpack_require__(71)}); /***/ }, /* 71 */ /***/ function(module, exports) { // 7.2.9 SameValue(x, y) module.exports = Object.is || function is(x, y){ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; /***/ }, /* 72 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.19 Object.setPrototypeOf(O, proto) var $export = __webpack_require__(8); $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(73).set}); /***/ }, /* 73 */ /***/ 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__(13) , anObject = __webpack_require__(12); var check = function(O, proto){ anObject(O); if(!isObject(proto) && proto !== null)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__(20)(Function.call, __webpack_require__(51).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch(e){ buggy = true; } return function setPrototypeOf(O, proto){ check(O, proto); if(buggy)O.__proto__ = proto; else set(O, proto); return O; }; }({}, false) : undefined), check: check }; /***/ }, /* 74 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 19.1.3.6 Object.prototype.toString() var classof = __webpack_require__(75) , test = {}; test[__webpack_require__(25)('toStringTag')] = 'z'; if(test + '' != '[object z]'){ __webpack_require__(18)(Object.prototype, 'toString', function toString(){ return '[object ' + classof(this) + ']'; }, true); } /***/ }, /* 75 */ /***/ function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(34) , TAG = __webpack_require__(25)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function(it, key){ try { return it[key]; } catch(e){ /* empty */ } }; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }, /* 76 */ /***/ function(module, exports, __webpack_require__) { // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) var $export = __webpack_require__(8); $export($export.P, 'Function', {bind: __webpack_require__(77)}); /***/ }, /* 77 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var aFunction = __webpack_require__(21) , isObject = __webpack_require__(13) , invoke = __webpack_require__(78) , arraySlice = [].slice , factories = {}; var construct = function(F, len, args){ if(!(len in factories)){ for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); } return factories[len](F, args); }; module.exports = Function.bind || function bind(that /*, args... */){ var fn = aFunction(this) , partArgs = arraySlice.call(arguments, 1); var bound = function(/* args... */){ var args = partArgs.concat(arraySlice.call(arguments)); return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); }; if(isObject(fn.prototype))bound.prototype = fn.prototype; return bound; }; /***/ }, /* 78 */ /***/ function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 module.exports = function(fn, args, that){ var un = that === undefined; switch(args.length){ case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }, /* 79 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11).f , createDesc = __webpack_require__(17) , has = __webpack_require__(5) , FProto = Function.prototype , nameRE = /^\s*function ([^ (]*)/ , NAME = 'name'; var isExtensible = Object.isExtensible || function(){ return true; }; // 19.2.4.2 name NAME in FProto || __webpack_require__(6) && dP(FProto, NAME, { configurable: true, get: function(){ try { var that = this , name = ('' + that).match(nameRE)[1]; has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name)); return name; } catch(e){ return ''; } } }); /***/ }, /* 80 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isObject = __webpack_require__(13) , getPrototypeOf = __webpack_require__(59) , HAS_INSTANCE = __webpack_require__(25)('hasInstance') , FunctionProto = Function.prototype; // 19.2.3.6 Function.prototype[@@hasInstance](V) if(!(HAS_INSTANCE in FunctionProto))__webpack_require__(11).f(FunctionProto, HAS_INSTANCE, {value: function(O){ if(typeof this != 'function' || !isObject(O))return false; if(!isObject(this.prototype))return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while(O = getPrototypeOf(O))if(this.prototype === O)return true; return false; }}); /***/ }, /* 81 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , $parseInt = __webpack_require__(82); // 18.2.5 parseInt(string, radix) $export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt}); /***/ }, /* 82 */ /***/ function(module, exports, __webpack_require__) { var $parseInt = __webpack_require__(4).parseInt , $trim = __webpack_require__(83).trim , ws = __webpack_require__(84) , hex = /^[\-+]?0[xX]/; module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){ var string = $trim(String(str), 3); return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); } : $parseInt; /***/ }, /* 83 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , defined = __webpack_require__(35) , fails = __webpack_require__(7) , spaces = __webpack_require__(84) , space = '[' + spaces + ']' , non = '\u200b\u0085' , ltrim = RegExp('^' + space + space + '*') , rtrim = RegExp(space + space + '*$'); var exporter = function(KEY, exec, ALIAS){ var exp = {}; var FORCE = fails(function(){ return !!spaces[KEY]() || non[KEY]() != non; }); var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; if(ALIAS)exp[ALIAS] = fn; $export($export.P + $export.F * FORCE, 'String', exp); }; // 1 -> String#trimLeft // 2 -> String#trimRight // 3 -> String#trim var trim = exporter.trim = function(string, TYPE){ string = String(defined(string)); if(TYPE & 1)string = string.replace(ltrim, ''); if(TYPE & 2)string = string.replace(rtrim, ''); return string; }; module.exports = exporter; /***/ }, /* 84 */ /***/ function(module, exports) { module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }, /* 85 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , $parseFloat = __webpack_require__(86); // 18.2.4 parseFloat(string) $export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat}); /***/ }, /* 86 */ /***/ function(module, exports, __webpack_require__) { var $parseFloat = __webpack_require__(4).parseFloat , $trim = __webpack_require__(83).trim; module.exports = 1 / $parseFloat(__webpack_require__(84) + '-0') !== -Infinity ? function parseFloat(str){ var string = $trim(String(str), 3) , result = $parseFloat(string); return result === 0 && string.charAt(0) == '-' ? -0 : result; } : $parseFloat; /***/ }, /* 87 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(4) , has = __webpack_require__(5) , cof = __webpack_require__(34) , inheritIfRequired = __webpack_require__(88) , toPrimitive = __webpack_require__(16) , fails = __webpack_require__(7) , gOPN = __webpack_require__(50).f , gOPD = __webpack_require__(51).f , dP = __webpack_require__(11).f , $trim = __webpack_require__(83).trim , NUMBER = 'Number' , $Number = global[NUMBER] , Base = $Number , proto = $Number.prototype // Opera ~12 has broken Object#toString , BROKEN_COF = cof(__webpack_require__(46)(proto)) == NUMBER , TRIM = 'trim' in String.prototype; // 7.1.3 ToNumber(argument) var toNumber = function(argument){ var it = toPrimitive(argument, false); if(typeof it == 'string' && it.length > 2){ it = TRIM ? it.trim() : $trim(it, 3); var first = it.charCodeAt(0) , third, radix, maxCode; if(first === 43 || first === 45){ third = it.charCodeAt(2); if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix } else if(first === 48){ switch(it.charCodeAt(1)){ case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i default : return +it; } for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){ code = digits.charCodeAt(i); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if(code < 48 || code > maxCode)return NaN; } return parseInt(digits, radix); } } return +it; }; if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){ $Number = function Number(value){ var it = arguments.length < 1 ? 0 : value , that = this; return that instanceof $Number // check on 1..constructor(foo) case && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER) ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); }; for(var keys = __webpack_require__(6) ? gOPN(Base) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES6 (in case, if modules with ES6 Number statics required before): 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' ).split(','), j = 0, key; keys.length > j; j++){ if(has(Base, key = keys[j]) && !has($Number, key)){ dP($Number, key, gOPD(Base, key)); } } $Number.prototype = proto; proto.constructor = $Number; __webpack_require__(18)(global, NUMBER, $Number); } /***/ }, /* 88 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13) , setPrototypeOf = __webpack_require__(73).set; module.exports = function(that, target, C){ var P, S = target.constructor; if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){ setPrototypeOf(that, P); } return that; }; /***/ }, /* 89 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toInteger = __webpack_require__(38) , aNumberValue = __webpack_require__(90) , repeat = __webpack_require__(91) , $toFixed = 1..toFixed , floor = Math.floor , data = [0, 0, 0, 0, 0, 0] , ERROR = 'Number.toFixed: incorrect invocation!' , ZERO = '0'; var multiply = function(n, c){ var i = -1 , c2 = c; while(++i < 6){ c2 += n * data[i]; data[i] = c2 % 1e7; c2 = floor(c2 / 1e7); } }; var divide = function(n){ var i = 6 , c = 0; while(--i >= 0){ c += data[i]; data[i] = floor(c / n); c = (c % n) * 1e7; } }; var numToString = function(){ var i = 6 , s = ''; while(--i >= 0){ if(s !== '' || i === 0 || data[i] !== 0){ var t = String(data[i]); s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; } } return s; }; var pow = function(x, n, acc){ return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); }; var log = function(x){ var n = 0 , x2 = x; while(x2 >= 4096){ n += 12; x2 /= 4096; } while(x2 >= 2){ n += 1; x2 /= 2; } return n; }; $export($export.P + $export.F * (!!$toFixed && ( 0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128..toFixed(0) !== '1000000000000000128' ) || !__webpack_require__(7)(function(){ // V8 ~ Android 4.3- $toFixed.call({}); })), 'Number', { toFixed: function toFixed(fractionDigits){ var x = aNumberValue(this, ERROR) , f = toInteger(fractionDigits) , s = '' , m = ZERO , e, z, j, k; if(f < 0 || f > 20)throw RangeError(ERROR); if(x != x)return 'NaN'; if(x <= -1e21 || x >= 1e21)return String(x); if(x < 0){ s = '-'; x = -x; } if(x > 1e-21){ e = log(x * pow(2, 69, 1)) - 69; z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); z *= 0x10000000000000; e = 52 - e; if(e > 0){ multiply(0, z); j = f; while(j >= 7){ multiply(1e7, 0); j -= 7; } multiply(pow(10, j, 1), 0); j = e - 1; while(j >= 23){ divide(1 << 23); j -= 23; } divide(1 << j); multiply(1, 1); divide(2); m = numToString(); } else { multiply(0, z); multiply(1 << -e, 0); m = numToString() + repeat.call(ZERO, f); } } if(f > 0){ k = m.length; m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); } else { m = s + m; } return m; } }); /***/ }, /* 90 */ /***/ function(module, exports, __webpack_require__) { var cof = __webpack_require__(34); module.exports = function(it, msg){ if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg); return +it; }; /***/ }, /* 91 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var toInteger = __webpack_require__(38) , defined = __webpack_require__(35); module.exports = function repeat(count){ var str = String(defined(this)) , res = '' , n = toInteger(count); if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; return res; }; /***/ }, /* 92 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $fails = __webpack_require__(7) , aNumberValue = __webpack_require__(90) , $toPrecision = 1..toPrecision; $export($export.P + $export.F * ($fails(function(){ // IE7- return $toPrecision.call(1, undefined) !== '1'; }) || !$fails(function(){ // V8 ~ Android 4.3- $toPrecision.call({}); })), 'Number', { toPrecision: function toPrecision(precision){ var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); } }); /***/ }, /* 93 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.1 Number.EPSILON var $export = __webpack_require__(8); $export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); /***/ }, /* 94 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.2 Number.isFinite(number) var $export = __webpack_require__(8) , _isFinite = __webpack_require__(4).isFinite; $export($export.S, 'Number', { isFinite: function isFinite(it){ return typeof it == 'number' && _isFinite(it); } }); /***/ }, /* 95 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var $export = __webpack_require__(8); $export($export.S, 'Number', {isInteger: __webpack_require__(96)}); /***/ }, /* 96 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var isObject = __webpack_require__(13) , floor = Math.floor; module.exports = function isInteger(it){ return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }, /* 97 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.4 Number.isNaN(number) var $export = __webpack_require__(8); $export($export.S, 'Number', { isNaN: function isNaN(number){ return number != number; } }); /***/ }, /* 98 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.5 Number.isSafeInteger(number) var $export = __webpack_require__(8) , isInteger = __webpack_require__(96) , abs = Math.abs; $export($export.S, 'Number', { isSafeInteger: function isSafeInteger(number){ return isInteger(number) && abs(number) <= 0x1fffffffffffff; } }); /***/ }, /* 99 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.6 Number.MAX_SAFE_INTEGER var $export = __webpack_require__(8); $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); /***/ }, /* 100 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.10 Number.MIN_SAFE_INTEGER var $export = __webpack_require__(8); $export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); /***/ }, /* 101 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , $parseFloat = __webpack_require__(86); // 20.1.2.12 Number.parseFloat(string) $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat}); /***/ }, /* 102 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , $parseInt = __webpack_require__(82); // 20.1.2.13 Number.parseInt(string, radix) $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt}); /***/ }, /* 103 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.3 Math.acosh(x) var $export = __webpack_require__(8) , log1p = __webpack_require__(104) , sqrt = Math.sqrt , $acosh = Math.acosh; $export($export.S + $export.F * !($acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 && Math.floor($acosh(Number.MAX_VALUE)) == 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && $acosh(Infinity) == Infinity ), 'Math', { acosh: function acosh(x){ return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); } }); /***/ }, /* 104 */ /***/ function(module, exports) { // 20.2.2.20 Math.log1p(x) module.exports = Math.log1p || function log1p(x){ return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); }; /***/ }, /* 105 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.5 Math.asinh(x) var $export = __webpack_require__(8) , $asinh = Math.asinh; function asinh(x){ return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); } // Tor Browser bug: Math.asinh(0) -> -0 $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh}); /***/ }, /* 106 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.7 Math.atanh(x) var $export = __webpack_require__(8) , $atanh = Math.atanh; // Tor Browser bug: Math.atanh(-0) -> 0 $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { atanh: function atanh(x){ return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; } }); /***/ }, /* 107 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.9 Math.cbrt(x) var $export = __webpack_require__(8) , sign = __webpack_require__(108); $export($export.S, 'Math', { cbrt: function cbrt(x){ return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); } }); /***/ }, /* 108 */ /***/ function(module, exports) { // 20.2.2.28 Math.sign(x) module.exports = Math.sign || function sign(x){ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; }; /***/ }, /* 109 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.11 Math.clz32(x) var $export = __webpack_require__(8); $export($export.S, 'Math', { clz32: function clz32(x){ return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; } }); /***/ }, /* 110 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.12 Math.cosh(x) var $export = __webpack_require__(8) , exp = Math.exp; $export($export.S, 'Math', { cosh: function cosh(x){ return (exp(x = +x) + exp(-x)) / 2; } }); /***/ }, /* 111 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.14 Math.expm1(x) var $export = __webpack_require__(8) , $expm1 = __webpack_require__(112); $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1}); /***/ }, /* 112 */ /***/ function(module, exports) { // 20.2.2.14 Math.expm1(x) var $expm1 = Math.expm1; module.exports = (!$expm1 // Old FF bug || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x){ return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; } : $expm1; /***/ }, /* 113 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.16 Math.fround(x) var $export = __webpack_require__(8) , sign = __webpack_require__(108) , pow = Math.pow , EPSILON = pow(2, -52) , EPSILON32 = pow(2, -23) , MAX32 = pow(2, 127) * (2 - EPSILON32) , MIN32 = pow(2, -126); var roundTiesToEven = function(n){ return n + 1 / EPSILON - 1 / EPSILON; }; $export($export.S, 'Math', { fround: function fround(x){ var $abs = Math.abs(x) , $sign = sign(x) , a, result; if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; a = (1 + EPSILON32 / EPSILON) * $abs; result = a - (a - $abs); if(result > MAX32 || result != result)return $sign * Infinity; return $sign * result; } }); /***/ }, /* 114 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) var $export = __webpack_require__(8) , abs = Math.abs; $export($export.S, 'Math', { hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars var sum = 0 , i = 0 , aLen = arguments.length , larg = 0 , arg, div; while(i < aLen){ arg = abs(arguments[i++]); if(larg < arg){ div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if(arg > 0){ div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * Math.sqrt(sum); } }); /***/ }, /* 115 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.18 Math.imul(x, y) var $export = __webpack_require__(8) , $imul = Math.imul; // some WebKit versions fails with big numbers, some has wrong arity $export($export.S + $export.F * __webpack_require__(7)(function(){ return $imul(0xffffffff, 5) != -5 || $imul.length != 2; }), 'Math', { imul: function imul(x, y){ var UINT16 = 0xffff , xn = +x , yn = +y , xl = UINT16 & xn , yl = UINT16 & yn; return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); } }); /***/ }, /* 116 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.21 Math.log10(x) var $export = __webpack_require__(8); $export($export.S, 'Math', { log10: function log10(x){ return Math.log(x) / Math.LN10; } }); /***/ }, /* 117 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.20 Math.log1p(x) var $export = __webpack_require__(8); $export($export.S, 'Math', {log1p: __webpack_require__(104)}); /***/ }, /* 118 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.22 Math.log2(x) var $export = __webpack_require__(8); $export($export.S, 'Math', { log2: function log2(x){ return Math.log(x) / Math.LN2; } }); /***/ }, /* 119 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.28 Math.sign(x) var $export = __webpack_require__(8); $export($export.S, 'Math', {sign: __webpack_require__(108)}); /***/ }, /* 120 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.30 Math.sinh(x) var $export = __webpack_require__(8) , expm1 = __webpack_require__(112) , exp = Math.exp; // V8 near Chromium 38 has a problem with very small numbers $export($export.S + $export.F * __webpack_require__(7)(function(){ return !Math.sinh(-2e-17) != -2e-17; }), 'Math', { sinh: function sinh(x){ return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); } }); /***/ }, /* 121 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.33 Math.tanh(x) var $export = __webpack_require__(8) , expm1 = __webpack_require__(112) , exp = Math.exp; $export($export.S, 'Math', { tanh: function tanh(x){ var a = expm1(x = +x) , b = expm1(-x); return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); } }); /***/ }, /* 122 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.34 Math.trunc(x) var $export = __webpack_require__(8); $export($export.S, 'Math', { trunc: function trunc(it){ return (it > 0 ? Math.floor : Math.ceil)(it); } }); /***/ }, /* 123 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , toIndex = __webpack_require__(39) , fromCharCode = String.fromCharCode , $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars var res = [] , aLen = arguments.length , i = 0 , code; while(aLen > i){ code = +arguments[i++]; if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); } }); /***/ }, /* 124 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , toIObject = __webpack_require__(32) , toLength = __webpack_require__(37); $export($export.S, 'String', { // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function raw(callSite){ var tpl = toIObject(callSite.raw) , len = toLength(tpl.length) , aLen = arguments.length , res = [] , i = 0; while(len > i){ res.push(String(tpl[i++])); if(i < aLen)res.push(String(arguments[i])); } return res.join(''); } }); /***/ }, /* 125 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 21.1.3.25 String.prototype.trim() __webpack_require__(83)('trim', function($trim){ return function trim(){ return $trim(this, 3); }; }); /***/ }, /* 126 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $at = __webpack_require__(127)(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__(128)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var O = this._t , index = this._i , point; if(index >= O.length)return {value: undefined, done: true}; point = $at(O, index); this._i += point.length; return {value: point, done: false}; }); /***/ }, /* 127 */ /***/ function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(38) , defined = __webpack_require__(35); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }, /* 128 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var LIBRARY = __webpack_require__(28) , $export = __webpack_require__(8) , redefine = __webpack_require__(18) , hide = __webpack_require__(10) , has = __webpack_require__(5) , Iterators = __webpack_require__(129) , $iterCreate = __webpack_require__(130) , setToStringTag = __webpack_require__(24) , getPrototypeOf = __webpack_require__(59) , ITERATOR = __webpack_require__(25)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' , VALUES = 'values'; var returnThis = function(){ return this; }; module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined , $anyNative = NAME == 'Array' ? proto.entries || $native : $native , methods, key, IteratorPrototype; // Fix native if($anyNative){ IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); if(IteratorPrototype !== Object.prototype){ // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if(FORCED)for(key in methods){ if(!(key in proto))redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }, /* 129 */ /***/ function(module, exports) { module.exports = {}; /***/ }, /* 130 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var create = __webpack_require__(46) , descriptor = __webpack_require__(17) , setToStringTag = __webpack_require__(24) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __webpack_require__(10)(IteratorPrototype, __webpack_require__(25)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }, /* 131 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $at = __webpack_require__(127)(false); $export($export.P, 'String', { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: function codePointAt(pos){ return $at(this, pos); } }); /***/ }, /* 132 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) 'use strict'; var $export = __webpack_require__(8) , toLength = __webpack_require__(37) , context = __webpack_require__(133) , ENDS_WITH = 'endsWith' , $endsWith = ''[ENDS_WITH]; $export($export.P + $export.F * __webpack_require__(135)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString /*, endPosition = @length */){ var that = context(this, searchString, ENDS_WITH) , endPosition = arguments.length > 1 ? arguments[1] : undefined , len = toLength(that.length) , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) , search = String(searchString); return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); /***/ }, /* 133 */ /***/ function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(134) , defined = __webpack_require__(35); module.exports = function(that, searchString, NAME){ if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }, /* 134 */ /***/ function(module, exports, __webpack_require__) { // 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(13) , cof = __webpack_require__(34) , MATCH = __webpack_require__(25)('match'); module.exports = function(it){ var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); }; /***/ }, /* 135 */ /***/ function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(25)('match'); module.exports = function(KEY){ var re = /./; try { '/./'[KEY](re); } catch(e){ try { re[MATCH] = false; return !'/./'[KEY](re); } catch(f){ /* empty */ } } return true; }; /***/ }, /* 136 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.7 String.prototype.includes(searchString, position = 0) 'use strict'; var $export = __webpack_require__(8) , context = __webpack_require__(133) , INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__(135)(INCLUDES), 'String', { includes: function includes(searchString /*, position = 0 */){ return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }, /* 137 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8); $export($export.P, 'String', { // 21.1.3.13 String.prototype.repeat(count) repeat: __webpack_require__(91) }); /***/ }, /* 138 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) 'use strict'; var $export = __webpack_require__(8) , toLength = __webpack_require__(37) , context = __webpack_require__(133) , STARTS_WITH = 'startsWith' , $startsWith = ''[STARTS_WITH]; $export($export.P + $export.F * __webpack_require__(135)(STARTS_WITH), 'String', { startsWith: function startsWith(searchString /*, position = 0 */){ var that = context(this, searchString, STARTS_WITH) , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) , search = String(searchString); return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); /***/ }, /* 139 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.2 String.prototype.anchor(name) __webpack_require__(140)('anchor', function(createHTML){ return function anchor(name){ return createHTML(this, 'a', 'name', name); } }); /***/ }, /* 140 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , fails = __webpack_require__(7) , defined = __webpack_require__(35) , quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) var createHTML = function(string, tag, attribute, value) { var S = String(defined(string)) , p1 = '<' + tag; if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"'; return p1 + '>' + S + '</' + tag + '>'; }; module.exports = function(NAME, exec){ var O = {}; O[NAME] = exec(createHTML); $export($export.P + $export.F * fails(function(){ var test = ''[NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }), 'String', O); }; /***/ }, /* 141 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.3 String.prototype.big() __webpack_require__(140)('big', function(createHTML){ return function big(){ return createHTML(this, 'big', '', ''); } }); /***/ }, /* 142 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.4 String.prototype.blink() __webpack_require__(140)('blink', function(createHTML){ return function blink(){ return createHTML(this, 'blink', '', ''); } }); /***/ }, /* 143 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.5 String.prototype.bold() __webpack_require__(140)('bold', function(createHTML){ return function bold(){ return createHTML(this, 'b', '', ''); } }); /***/ }, /* 144 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.6 String.prototype.fixed() __webpack_require__(140)('fixed', function(createHTML){ return function fixed(){ return createHTML(this, 'tt', '', ''); } }); /***/ }, /* 145 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.7 String.prototype.fontcolor(color) __webpack_require__(140)('fontcolor', function(createHTML){ return function fontcolor(color){ return createHTML(this, 'font', 'color', color); } }); /***/ }, /* 146 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.8 String.prototype.fontsize(size) __webpack_require__(140)('fontsize', function(createHTML){ return function fontsize(size){ return createHTML(this, 'font', 'size', size); } }); /***/ }, /* 147 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.9 String.prototype.italics() __webpack_require__(140)('italics', function(createHTML){ return function italics(){ return createHTML(this, 'i', '', ''); } }); /***/ }, /* 148 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.10 String.prototype.link(url) __webpack_require__(140)('link', function(createHTML){ return function link(url){ return createHTML(this, 'a', 'href', url); } }); /***/ }, /* 149 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.11 String.prototype.small() __webpack_require__(140)('small', function(createHTML){ return function small(){ return createHTML(this, 'small', '', ''); } }); /***/ }, /* 150 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.12 String.prototype.strike() __webpack_require__(140)('strike', function(createHTML){ return function strike(){ return createHTML(this, 'strike', '', ''); } }); /***/ }, /* 151 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.13 String.prototype.sub() __webpack_require__(140)('sub', function(createHTML){ return function sub(){ return createHTML(this, 'sub', '', ''); } }); /***/ }, /* 152 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.14 String.prototype.sup() __webpack_require__(140)('sup', function(createHTML){ return function sup(){ return createHTML(this, 'sup', '', ''); } }); /***/ }, /* 153 */ /***/ function(module, exports, __webpack_require__) { // 20.3.3.1 / 15.9.4.4 Date.now() var $export = __webpack_require__(8); $export($export.S, 'Date', {now: function(){ return new Date().getTime(); }}); /***/ }, /* 154 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toObject = __webpack_require__(58) , toPrimitive = __webpack_require__(16); $export($export.P + $export.F * __webpack_require__(7)(function(){ return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1; }), 'Date', { toJSON: function toJSON(key){ var O = toObject(this) , pv = toPrimitive(O); return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); } }); /***/ }, /* 155 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() var $export = __webpack_require__(8) , fails = __webpack_require__(7) , getTime = Date.prototype.getTime; var lz = function(num){ return num > 9 ? num : '0' + num; }; // PhantomJS / old WebKit has a broken implementations $export($export.P + $export.F * (fails(function(){ return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z'; }) || !fails(function(){ new Date(NaN).toISOString(); })), 'Date', { toISOString: function toISOString(){ if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value'); var d = this , y = d.getUTCFullYear() , m = d.getUTCMilliseconds() , s = y < 0 ? '-' : y > 9999 ? '+' : ''; return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; } }); /***/ }, /* 156 */ /***/ function(module, exports, __webpack_require__) { var DateProto = Date.prototype , INVALID_DATE = 'Invalid Date' , TO_STRING = 'toString' , $toString = DateProto[TO_STRING] , getTime = DateProto.getTime; if(new Date(NaN) + '' != INVALID_DATE){ __webpack_require__(18)(DateProto, TO_STRING, function toString(){ var value = getTime.call(this); return value === value ? $toString.call(this) : INVALID_DATE; }); } /***/ }, /* 157 */ /***/ function(module, exports, __webpack_require__) { var TO_PRIMITIVE = __webpack_require__(25)('toPrimitive') , proto = Date.prototype; if(!(TO_PRIMITIVE in proto))__webpack_require__(10)(proto, TO_PRIMITIVE, __webpack_require__(158)); /***/ }, /* 158 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var anObject = __webpack_require__(12) , toPrimitive = __webpack_require__(16) , NUMBER = 'number'; module.exports = function(hint){ if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint'); return toPrimitive(anObject(this), hint != NUMBER); }; /***/ }, /* 159 */ /***/ function(module, exports, __webpack_require__) { // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) var $export = __webpack_require__(8); $export($export.S, 'Array', {isArray: __webpack_require__(45)}); /***/ }, /* 160 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var ctx = __webpack_require__(20) , $export = __webpack_require__(8) , toObject = __webpack_require__(58) , call = __webpack_require__(161) , isArrayIter = __webpack_require__(162) , toLength = __webpack_require__(37) , createProperty = __webpack_require__(163) , getIterFn = __webpack_require__(164); $export($export.S + $export.F * !__webpack_require__(165)(function(iter){ Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = toObject(arrayLike) , C = typeof this == 'function' ? this : Array , aLen = arguments.length , mapfn = aLen > 1 ? arguments[1] : undefined , mapping = mapfn !== undefined , index = 0 , iterFn = getIterFn(O) , length, result, step, iterator; if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); } } else { length = toLength(O.length); for(result = new C(length); length > index; index++){ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); } } result.length = index; return result; } }); /***/ }, /* 161 */ /***/ function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error var anObject = __webpack_require__(12); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined)anObject(ret.call(iterator)); throw e; } }; /***/ }, /* 162 */ /***/ function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(129) , ITERATOR = __webpack_require__(25)('iterator') , ArrayProto = Array.prototype; module.exports = function(it){ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }, /* 163 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $defineProperty = __webpack_require__(11) , createDesc = __webpack_require__(17); module.exports = function(object, index, value){ if(index in object)$defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; /***/ }, /* 164 */ /***/ function(module, exports, __webpack_require__) { var classof = __webpack_require__(75) , ITERATOR = __webpack_require__(25)('iterator') , Iterators = __webpack_require__(129); module.exports = __webpack_require__(9).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }, /* 165 */ /***/ function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(25)('iterator') , SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function(){ SAFE_CLOSING = true; }; Array.from(riter, function(){ throw 2; }); } catch(e){ /* empty */ } module.exports = function(exec, skipClosing){ if(!skipClosing && !SAFE_CLOSING)return false; var safe = false; try { var arr = [7] , iter = arr[ITERATOR](); iter.next = function(){ return {done: safe = true}; }; arr[ITERATOR] = function(){ return iter; }; exec(arr); } catch(e){ /* empty */ } return safe; }; /***/ }, /* 166 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , createProperty = __webpack_require__(163); // WebKit Array.of isn't generic $export($export.S + $export.F * __webpack_require__(7)(function(){ function F(){} return !(Array.of.call(F) instanceof F); }), 'Array', { // 22.1.2.3 Array.of( ...items) of: function of(/* ...args */){ var index = 0 , aLen = arguments.length , result = new (typeof this == 'function' ? this : Array)(aLen); while(aLen > index)createProperty(result, index, arguments[index++]); result.length = aLen; return result; } }); /***/ }, /* 167 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.13 Array.prototype.join(separator) var $export = __webpack_require__(8) , toIObject = __webpack_require__(32) , arrayJoin = [].join; // fallback for not array-like strings $export($export.P + $export.F * (__webpack_require__(33) != Object || !__webpack_require__(168)(arrayJoin)), 'Array', { join: function join(separator){ return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); } }); /***/ }, /* 168 */ /***/ function(module, exports, __webpack_require__) { var fails = __webpack_require__(7); module.exports = function(method, arg){ return !!method && fails(function(){ arg ? method.call(null, function(){}, 1) : method.call(null); }); }; /***/ }, /* 169 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , html = __webpack_require__(48) , cof = __webpack_require__(34) , toIndex = __webpack_require__(39) , toLength = __webpack_require__(37) , arraySlice = [].slice; // fallback for not array-like ES3 strings and DOM objects $export($export.P + $export.F * __webpack_require__(7)(function(){ if(html)arraySlice.call(html); }), 'Array', { slice: function slice(begin, end){ var len = toLength(this.length) , klass = cof(this); end = end === undefined ? len : end; if(klass == 'Array')return arraySlice.call(this, begin, end); var start = toIndex(begin, len) , upTo = toIndex(end, len) , size = toLength(upTo - start) , cloned = Array(size) , i = 0; for(; i < size; i++)cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i]; return cloned; } }); /***/ }, /* 170 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , aFunction = __webpack_require__(21) , toObject = __webpack_require__(58) , fails = __webpack_require__(7) , $sort = [].sort , test = [1, 2, 3]; $export($export.P + $export.F * (fails(function(){ // IE8- test.sort(undefined); }) || !fails(function(){ // V8 bug test.sort(null); // Old WebKit }) || !__webpack_require__(168)($sort)), 'Array', { // 22.1.3.25 Array.prototype.sort(comparefn) sort: function sort(comparefn){ return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn)); } }); /***/ }, /* 171 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $forEach = __webpack_require__(172)(0) , STRICT = __webpack_require__(168)([].forEach, true); $export($export.P + $export.F * !STRICT, 'Array', { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: function forEach(callbackfn /* , thisArg */){ return $forEach(this, callbackfn, arguments[1]); } }); /***/ }, /* 172 */ /***/ function(module, exports, __webpack_require__) { // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__(20) , IObject = __webpack_require__(33) , toObject = __webpack_require__(58) , toLength = __webpack_require__(37) , asc = __webpack_require__(173); module.exports = function(TYPE, $create){ var IS_MAP = TYPE == 1 , IS_FILTER = TYPE == 2 , IS_SOME = TYPE == 3 , IS_EVERY = TYPE == 4 , IS_FIND_INDEX = TYPE == 6 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX , create = $create || asc; return function($this, callbackfn, that){ var O = toObject($this) , self = IObject(O) , f = ctx(callbackfn, that, 3) , length = toLength(self.length) , index = 0 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined , val, res; for(;length > index; index++)if(NO_HOLES || index in self){ val = self[index]; res = f(val, index, O); if(TYPE){ if(IS_MAP)result[index] = res; // map else if(res)switch(TYPE){ case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if(IS_EVERY)return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }, /* 173 */ /***/ function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var speciesConstructor = __webpack_require__(174); module.exports = function(original, length){ return new (speciesConstructor(original))(length); }; /***/ }, /* 174 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13) , isArray = __webpack_require__(45) , SPECIES = __webpack_require__(25)('species'); module.exports = function(original){ var C; if(isArray(original)){ C = original.constructor; // cross-realm fallback if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; if(isObject(C)){ C = C[SPECIES]; if(C === null)C = undefined; } } return C === undefined ? Array : C; }; /***/ }, /* 175 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $map = __webpack_require__(172)(1); $export($export.P + $export.F * !__webpack_require__(168)([].map, true), 'Array', { // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) map: function map(callbackfn /* , thisArg */){ return $map(this, callbackfn, arguments[1]); } }); /***/ }, /* 176 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $filter = __webpack_require__(172)(2); $export($export.P + $export.F * !__webpack_require__(168)([].filter, true), 'Array', { // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) filter: function filter(callbackfn /* , thisArg */){ return $filter(this, callbackfn, arguments[1]); } }); /***/ }, /* 177 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $some = __webpack_require__(172)(3); $export($export.P + $export.F * !__webpack_require__(168)([].some, true), 'Array', { // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) some: function some(callbackfn /* , thisArg */){ return $some(this, callbackfn, arguments[1]); } }); /***/ }, /* 178 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $every = __webpack_require__(172)(4); $export($export.P + $export.F * !__webpack_require__(168)([].every, true), 'Array', { // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) every: function every(callbackfn /* , thisArg */){ return $every(this, callbackfn, arguments[1]); } }); /***/ }, /* 179 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $reduce = __webpack_require__(180); $export($export.P + $export.F * !__webpack_require__(168)([].reduce, true), 'Array', { // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) reduce: function reduce(callbackfn /* , initialValue */){ return $reduce(this, callbackfn, arguments.length, arguments[1], false); } }); /***/ }, /* 180 */ /***/ function(module, exports, __webpack_require__) { var aFunction = __webpack_require__(21) , toObject = __webpack_require__(58) , IObject = __webpack_require__(33) , toLength = __webpack_require__(37); module.exports = function(that, callbackfn, aLen, memo, isRight){ aFunction(callbackfn); var O = toObject(that) , self = IObject(O) , length = toLength(O.length) , index = isRight ? length - 1 : 0 , i = isRight ? -1 : 1; if(aLen < 2)for(;;){ if(index in self){ memo = self[index]; index += i; break; } index += i; if(isRight ? index < 0 : length <= index){ throw TypeError('Reduce of empty array with no initial value'); } } for(;isRight ? index >= 0 : length > index; index += i)if(index in self){ memo = callbackfn(memo, self[index], index, O); } return memo; }; /***/ }, /* 181 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $reduce = __webpack_require__(180); $export($export.P + $export.F * !__webpack_require__(168)([].reduceRight, true), 'Array', { // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: function reduceRight(callbackfn /* , initialValue */){ return $reduce(this, callbackfn, arguments.length, arguments[1], true); } }); /***/ }, /* 182 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $indexOf = __webpack_require__(36)(false) , $native = [].indexOf , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), 'Array', { // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: function indexOf(searchElement /*, fromIndex = 0 */){ return NEGATIVE_ZERO // convert -0 to +0 ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]); } }); /***/ }, /* 183 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toIObject = __webpack_require__(32) , toInteger = __webpack_require__(38) , toLength = __webpack_require__(37) , $native = [].lastIndexOf , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), 'Array', { // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){ // convert -0 to +0 if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0; var O = toIObject(this) , length = toLength(O.length) , index = length - 1; if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1])); if(index < 0)index = length + index; for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0; return -1; } }); /***/ }, /* 184 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var $export = __webpack_require__(8); $export($export.P, 'Array', {copyWithin: __webpack_require__(185)}); __webpack_require__(186)('copyWithin'); /***/ }, /* 185 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 'use strict'; var toObject = __webpack_require__(58) , toIndex = __webpack_require__(39) , toLength = __webpack_require__(37); module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ var O = toObject(this) , len = toLength(O.length) , to = toIndex(target, len) , from = toIndex(start, len) , end = arguments.length > 2 ? arguments[2] : undefined , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) , inc = 1; if(from < to && to < from + count){ inc = -1; from += count - 1; to += count - 1; } while(count-- > 0){ if(from in O)O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }; /***/ }, /* 186 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = __webpack_require__(25)('unscopables') , ArrayProto = Array.prototype; if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(10)(ArrayProto, UNSCOPABLES, {}); module.exports = function(key){ ArrayProto[UNSCOPABLES][key] = true; }; /***/ }, /* 187 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var $export = __webpack_require__(8); $export($export.P, 'Array', {fill: __webpack_require__(188)}); __webpack_require__(186)('fill'); /***/ }, /* 188 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 'use strict'; var toObject = __webpack_require__(58) , toIndex = __webpack_require__(39) , toLength = __webpack_require__(37); module.exports = function fill(value /*, start = 0, end = @length */){ var O = toObject(this) , length = toLength(O.length) , aLen = arguments.length , index = toIndex(aLen > 1 ? arguments[1] : undefined, length) , end = aLen > 2 ? arguments[2] : undefined , endPos = end === undefined ? length : toIndex(end, length); while(endPos > index)O[index++] = value; return O; }; /***/ }, /* 189 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) var $export = __webpack_require__(8) , $find = __webpack_require__(172)(5) , KEY = 'find' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { find: function find(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(186)(KEY); /***/ }, /* 190 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) var $export = __webpack_require__(8) , $find = __webpack_require__(172)(6) , KEY = 'findIndex' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { findIndex: function findIndex(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(186)(KEY); /***/ }, /* 191 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(192)('Array'); /***/ }, /* 192 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(4) , dP = __webpack_require__(11) , DESCRIPTORS = __webpack_require__(6) , SPECIES = __webpack_require__(25)('species'); module.exports = function(KEY){ var C = global[KEY]; if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, { configurable: true, get: function(){ return this; } }); }; /***/ }, /* 193 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var addToUnscopables = __webpack_require__(186) , step = __webpack_require__(194) , Iterators = __webpack_require__(129) , toIObject = __webpack_require__(32); // 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__(128)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var O = this._t , kind = this._k , index = this._i++; if(!O || index >= O.length){ this._t = undefined; return step(1); } if(kind == 'keys' )return step(0, index); if(kind == 'values')return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }, /* 194 */ /***/ function(module, exports) { module.exports = function(done, value){ return {value: value, done: !!done}; }; /***/ }, /* 195 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , inheritIfRequired = __webpack_require__(88) , dP = __webpack_require__(11).f , gOPN = __webpack_require__(50).f , isRegExp = __webpack_require__(134) , $flags = __webpack_require__(196) , $RegExp = global.RegExp , Base = $RegExp , proto = $RegExp.prototype , re1 = /a/g , re2 = /a/g // "new" creates a new object, old webkit buggy here , CORRECT_NEW = new $RegExp(re1) !== re1; if(__webpack_require__(6) && (!CORRECT_NEW || __webpack_require__(7)(function(){ re2[__webpack_require__(25)('match')] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; }))){ $RegExp = function RegExp(p, f){ var tiRE = this instanceof $RegExp , piRE = isRegExp(p) , fiU = f === undefined; return !tiRE && piRE && p.constructor === $RegExp && fiU ? p : inheritIfRequired(CORRECT_NEW ? new Base(piRE && !fiU ? p.source : p, f) : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) , tiRE ? this : proto, $RegExp); }; var proxy = function(key){ key in $RegExp || dP($RegExp, key, { configurable: true, get: function(){ return Base[key]; }, set: function(it){ Base[key] = it; } }); }; for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]); proto.constructor = $RegExp; $RegExp.prototype = proto; __webpack_require__(18)(global, 'RegExp', $RegExp); } __webpack_require__(192)('RegExp'); /***/ }, /* 196 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 21.2.5.3 get RegExp.prototype.flags var anObject = __webpack_require__(12); module.exports = function(){ var that = anObject(this) , result = ''; if(that.global) result += 'g'; if(that.ignoreCase) result += 'i'; if(that.multiline) result += 'm'; if(that.unicode) result += 'u'; if(that.sticky) result += 'y'; return result; }; /***/ }, /* 197 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(198); var anObject = __webpack_require__(12) , $flags = __webpack_require__(196) , DESCRIPTORS = __webpack_require__(6) , TO_STRING = 'toString' , $toString = /./[TO_STRING]; var define = function(fn){ __webpack_require__(18)(RegExp.prototype, TO_STRING, fn, true); }; // 21.2.5.14 RegExp.prototype.toString() if(__webpack_require__(7)(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){ define(function toString(){ var R = anObject(this); return '/'.concat(R.source, '/', 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); }); // FF44- RegExp#toString has a wrong name } else if($toString.name != TO_STRING){ define(function toString(){ return $toString.call(this); }); } /***/ }, /* 198 */ /***/ function(module, exports, __webpack_require__) { // 21.2.5.3 get RegExp.prototype.flags() if(__webpack_require__(6) && /./g.flags != 'g')__webpack_require__(11).f(RegExp.prototype, 'flags', { configurable: true, get: __webpack_require__(196) }); /***/ }, /* 199 */ /***/ function(module, exports, __webpack_require__) { // @@match logic __webpack_require__(200)('match', 1, function(defined, MATCH, $match){ // 21.1.3.11 String.prototype.match(regexp) return [function match(regexp){ 'use strict'; var O = defined(this) , fn = regexp == undefined ? undefined : regexp[MATCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, $match]; }); /***/ }, /* 200 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var hide = __webpack_require__(10) , redefine = __webpack_require__(18) , fails = __webpack_require__(7) , defined = __webpack_require__(35) , wks = __webpack_require__(25); module.exports = function(KEY, length, exec){ var SYMBOL = wks(KEY) , fns = exec(defined, SYMBOL, ''[KEY]) , strfn = fns[0] , rxfn = fns[1]; if(fails(function(){ var O = {}; O[SYMBOL] = function(){ return 7; }; return ''[KEY](O) != 7; })){ redefine(String.prototype, KEY, strfn); hide(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function(string, arg){ return rxfn.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function(string){ return rxfn.call(string, this); } ); } }; /***/ }, /* 201 */ /***/ function(module, exports, __webpack_require__) { // @@replace logic __webpack_require__(200)('replace', 2, function(defined, REPLACE, $replace){ // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) return [function replace(searchValue, replaceValue){ 'use strict'; var O = defined(this) , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue); }, $replace]; }); /***/ }, /* 202 */ /***/ function(module, exports, __webpack_require__) { // @@search logic __webpack_require__(200)('search', 1, function(defined, SEARCH, $search){ // 21.1.3.15 String.prototype.search(regexp) return [function search(regexp){ 'use strict'; var O = defined(this) , fn = regexp == undefined ? undefined : regexp[SEARCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, $search]; }); /***/ }, /* 203 */ /***/ function(module, exports, __webpack_require__) { // @@split logic __webpack_require__(200)('split', 2, function(defined, SPLIT, $split){ 'use strict'; var isRegExp = __webpack_require__(134) , _split = $split , $push = [].push , $SPLIT = 'split' , LENGTH = 'length' , LAST_INDEX = 'lastIndex'; if( 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH] ){ var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group // based on es5-shim implementation, need to rework it $split = function(separator, limit){ var string = String(this); if(separator === undefined && limit === 0)return []; // If `separator` is not a regex, use native split if(!isRegExp(separator))return _split.call(string, separator, limit); var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var separator2, match, lastIndex, lastLength, i; // Doesn't need flags gy, but they don't hurt if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); while(match = separatorCopy.exec(string)){ // `separatorCopy.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0][LENGTH]; if(lastIndex > lastLastIndex){ output.push(string.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){ for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined; }); if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1)); lastLength = match[0][LENGTH]; lastLastIndex = lastIndex; if(output[LENGTH] >= splitLimit)break; } if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop } if(lastLastIndex === string[LENGTH]){ if(lastLength || !separatorCopy.test(''))output.push(''); } else output.push(string.slice(lastLastIndex)); return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; }; // Chakra, V8 } else if('0'[$SPLIT](undefined, 0)[LENGTH]){ $split = function(separator, limit){ return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); }; } // 21.1.3.17 String.prototype.split(separator, limit) return [function split(separator, limit){ var O = defined(this) , fn = separator == undefined ? undefined : separator[SPLIT]; return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); }, $split]; }); /***/ }, /* 204 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var LIBRARY = __webpack_require__(28) , global = __webpack_require__(4) , ctx = __webpack_require__(20) , classof = __webpack_require__(75) , $export = __webpack_require__(8) , isObject = __webpack_require__(13) , aFunction = __webpack_require__(21) , anInstance = __webpack_require__(205) , forOf = __webpack_require__(206) , speciesConstructor = __webpack_require__(207) , task = __webpack_require__(208).set , microtask = __webpack_require__(209)() , PROMISE = 'Promise' , TypeError = global.TypeError , process = global.process , $Promise = global[PROMISE] , process = global.process , isNode = classof(process) == 'process' , empty = function(){ /* empty */ } , Internal, GenericPromiseCapability, Wrapper; var USE_NATIVE = !!function(){ try { // correct subclassing with @@species support var promise = $Promise.resolve(1) , FakePromise = (promise.constructor = {})[__webpack_require__(25)('species')] = function(exec){ exec(empty, empty); }; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; } catch(e){ /* empty */ } }(); // helpers var sameConstructor = function(a, b){ // with library wrapper special case return a === b || a === $Promise && b === Wrapper; }; var isThenable = function(it){ var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var newPromiseCapability = function(C){ return sameConstructor($Promise, C) ? new PromiseCapability(C) : new GenericPromiseCapability(C); }; var PromiseCapability = GenericPromiseCapability = function(C){ var resolve, reject; this.promise = new C(function($$resolve, $$reject){ if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); }; var perform = function(exec){ try { exec(); } catch(e){ return {error: e}; } }; var notify = function(promise, isReject){ if(promise._n)return; promise._n = true; var chain = promise._c; microtask(function(){ var value = promise._v , ok = promise._s == 1 , i = 0; var run = function(reaction){ var handler = ok ? reaction.ok : reaction.fail , resolve = reaction.resolve , reject = reaction.reject , domain = reaction.domain , result, then; try { if(handler){ if(!ok){ if(promise._h == 2)onHandleUnhandled(promise); promise._h = 1; } if(handler === true)result = value; else { if(domain)domain.enter(); result = handler(value); if(domain)domain.exit(); } if(result === reaction.promise){ reject(TypeError('Promise-chain cycle')); } else if(then = isThenable(result)){ then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch(e){ reject(e); } }; while(chain.length > i)run(chain[i++]); // variable length - can't use forEach promise._c = []; promise._n = false; if(isReject && !promise._h)onUnhandled(promise); }); }; var onUnhandled = function(promise){ task.call(global, function(){ var value = promise._v , abrupt, handler, console; if(isUnhandled(promise)){ abrupt = perform(function(){ if(isNode){ process.emit('unhandledRejection', value, promise); } else if(handler = global.onunhandledrejection){ handler({promise: promise, reason: value}); } else if((console = global.console) && console.error){ console.error('Unhandled promise rejection', value); } }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if(abrupt)throw abrupt.error; }); }; var isUnhandled = function(promise){ if(promise._h == 1)return false; var chain = promise._a || promise._c , i = 0 , reaction; while(chain.length > i){ reaction = chain[i++]; if(reaction.fail || !isUnhandled(reaction.promise))return false; } return true; }; var onHandleUnhandled = function(promise){ task.call(global, function(){ var handler; if(isNode){ process.emit('rejectionHandled', promise); } else if(handler = global.onrejectionhandled){ handler({promise: promise, reason: promise._v}); } }); }; var $reject = function(value){ var promise = this; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap promise._v = value; promise._s = 2; if(!promise._a)promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function(value){ var promise = this , then; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap try { if(promise === value)throw TypeError("Promise can't be resolved itself"); if(then = isThenable(value)){ microtask(function(){ var wrapper = {_w: promise, _d: false}; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); } catch(e){ $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify(promise, false); } } catch(e){ $reject.call({_w: promise, _d: false}, e); // wrap } }; // constructor polyfill if(!USE_NATIVE){ // 25.4.3.1 Promise(executor) $Promise = function Promise(executor){ anInstance(this, $Promise, PROMISE, '_h'); aFunction(executor); Internal.call(this); try { executor(ctx($resolve, this, 1), ctx($reject, this, 1)); } catch(err){ $reject.call(this, err); } }; Internal = function Promise(executor){ this._c = []; // <- awaiting reactions this._a = undefined; // <- checked in isUnhandled reactions this._s = 0; // <- state this._d = false; // <- done this._v = undefined; // <- value this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; Internal.prototype = __webpack_require__(210)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected){ var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process.domain : undefined; this._c.push(reaction); if(this._a)this._a.push(reaction); if(this._s)notify(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function(onRejected){ return this.then(undefined, onRejected); } }); PromiseCapability = function(){ var promise = new Internal; this.promise = promise; this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); __webpack_require__(24)($Promise, PROMISE); __webpack_require__(192)(PROMISE); Wrapper = __webpack_require__(9)[PROMISE]; // statics $export($export.S + $export.F * !USE_NATIVE, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r){ var capability = newPromiseCapability(this) , $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x){ // instanceof instead of internal slot check because we should fix it without replacement native Promise core if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; var capability = newPromiseCapability(this) , $$resolve = capability.resolve; $$resolve(x); return capability.promise; } }); $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(165)(function(iter){ $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable){ var C = this , capability = newPromiseCapability(C) , resolve = capability.resolve , reject = capability.reject; var abrupt = perform(function(){ var values = [] , index = 0 , remaining = 1; forOf(iterable, false, function(promise){ var $index = index++ , alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function(value){ if(alreadyCalled)return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if(abrupt)reject(abrupt.error); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable){ var C = this , capability = newPromiseCapability(C) , reject = capability.reject; var abrupt = perform(function(){ forOf(iterable, false, function(promise){ C.resolve(promise).then(capability.resolve, reject); }); }); if(abrupt)reject(abrupt.error); return capability.promise; } }); /***/ }, /* 205 */ /***/ function(module, exports) { module.exports = function(it, Constructor, name, forbiddenField){ if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }, /* 206 */ /***/ function(module, exports, __webpack_require__) { var ctx = __webpack_require__(20) , call = __webpack_require__(161) , isArrayIter = __webpack_require__(162) , anObject = __webpack_require__(12) , toLength = __webpack_require__(37) , getIterFn = __webpack_require__(164) , BREAK = {} , RETURN = {}; var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) , f = ctx(fn, that, entries ? 2 : 1) , index = 0 , length, step, iterator, result; if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if(result === BREAK || result === RETURN)return result; } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ result = call(iterator, f, step.value, entries); if(result === BREAK || result === RETURN)return result; } }; exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }, /* 207 */ /***/ function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(12) , aFunction = __webpack_require__(21) , SPECIES = __webpack_require__(25)('species'); module.exports = function(O, D){ var C = anObject(O).constructor, S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }, /* 208 */ /***/ function(module, exports, __webpack_require__) { var ctx = __webpack_require__(20) , invoke = __webpack_require__(78) , html = __webpack_require__(48) , cel = __webpack_require__(15) , global = __webpack_require__(4) , process = global.process , setTask = global.setImmediate , clearTask = global.clearImmediate , MessageChannel = global.MessageChannel , counter = 0 , queue = {} , ONREADYSTATECHANGE = 'onreadystatechange' , defer, channel, port; var run = function(){ var id = +this; if(queue.hasOwnProperty(id)){ var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function(event){ run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if(!setTask || !clearTask){ setTask = function setImmediate(fn){ var args = [], i = 1; while(arguments.length > i)args.push(arguments[i++]); queue[++counter] = function(){ invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id){ delete queue[id]; }; // Node.js 0.8- if(__webpack_require__(34)(process) == 'process'){ defer = function(id){ process.nextTick(ctx(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if(MessageChannel){ channel = new MessageChannel; port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ defer = function(id){ global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); // IE8- } else if(ONREADYSTATECHANGE in cel('script')){ defer = function(id){ html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function(id){ setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }, /* 209 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , macrotask = __webpack_require__(208).set , Observer = global.MutationObserver || global.WebKitMutationObserver , process = global.process , Promise = global.Promise , isNode = __webpack_require__(34)(process) == 'process'; module.exports = function(){ var head, last, notify; var flush = function(){ var parent, fn; if(isNode && (parent = process.domain))parent.exit(); while(head){ fn = head.fn; head = head.next; try { fn(); } catch(e){ if(head)notify(); else last = undefined; throw e; } } last = undefined; if(parent)parent.enter(); }; // Node.js if(isNode){ notify = function(){ process.nextTick(flush); }; // browsers with MutationObserver } else if(Observer){ var toggle = true , node = document.createTextNode(''); new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new notify = function(){ node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if(Promise && Promise.resolve){ var promise = Promise.resolve(); notify = function(){ promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function(){ // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } return function(fn){ var task = {fn: fn, next: undefined}; if(last)last.next = task; if(!head){ head = task; notify(); } last = task; }; }; /***/ }, /* 210 */ /***/ function(module, exports, __webpack_require__) { var redefine = __webpack_require__(18); module.exports = function(target, src, safe){ for(var key in src)redefine(target, key, src[key], safe); return target; }; /***/ }, /* 211 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var strong = __webpack_require__(212); // 23.1 Map Objects module.exports = __webpack_require__(213)('Map', function(get){ return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.1.3.6 Map.prototype.get(key) get: function get(key){ var entry = strong.getEntry(this, key); return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function set(key, value){ return strong.def(this, key === 0 ? 0 : key, value); } }, strong, true); /***/ }, /* 212 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var dP = __webpack_require__(11).f , create = __webpack_require__(46) , redefineAll = __webpack_require__(210) , ctx = __webpack_require__(20) , anInstance = __webpack_require__(205) , defined = __webpack_require__(35) , forOf = __webpack_require__(206) , $iterDefine = __webpack_require__(128) , step = __webpack_require__(194) , setSpecies = __webpack_require__(192) , DESCRIPTORS = __webpack_require__(6) , fastKey = __webpack_require__(22).fastKey , SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function(that, key){ // fast case var index = fastKey(key), entry; if(index !== 'F')return that._i[index]; // frozen object case for(entry = that._f; entry; entry = entry.n){ if(entry.k == key)return entry; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = create(null); // index that._f = undefined; // first entry that._l = undefined; // last entry that[SIZE] = 0; // size if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear(){ for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ entry.r = true; if(entry.p)entry.p = entry.p.n = undefined; delete data[entry.i]; } that._f = that._l = undefined; that[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var that = this , entry = getEntry(that, key); if(entry){ var next = entry.n , prev = entry.p; delete that._i[entry.i]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that._f == entry)that._f = next; if(that._l == entry)that._l = prev; that[SIZE]--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /*, that = undefined */){ anInstance(this, C, 'forEach'); var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) , entry; while(entry = entry ? entry.n : this._f){ f(entry.v, entry.k, this); // revert to the last existing entry while(entry && entry.r)entry = entry.p; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key){ return !!getEntry(this, key); } }); if(DESCRIPTORS)dP(C.prototype, 'size', { get: function(){ return defined(this[SIZE]); } }); return C; }, def: function(that, key, value){ var entry = getEntry(that, key) , prev, index; // change existing entry if(entry){ entry.v = value; // create new entry } else { that._l = entry = { i: index = fastKey(key, true), // <- index k: key, // <- key v: value, // <- value p: prev = that._l, // <- previous entry n: undefined, // <- next entry r: false // <- removed }; if(!that._f)that._f = entry; if(prev)prev.n = entry; that[SIZE]++; // add to index if(index !== 'F')that._i[index] = entry; } return that; }, getEntry: getEntry, setStrong: function(C, NAME, IS_MAP){ // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 $iterDefine(C, NAME, function(iterated, kind){ this._t = iterated; // target this._k = kind; // kind this._l = undefined; // previous }, function(){ var that = this , kind = that._k , entry = that._l; // revert to the last existing entry while(entry && entry.r)entry = entry.p; // get next entry if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ // or finish the iteration that._t = undefined; return step(1); } // return step by kind if(kind == 'keys' )return step(0, entry.k); if(kind == 'values')return step(0, entry.v); return step(0, [entry.k, entry.v]); }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(NAME); } }; /***/ }, /* 213 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(4) , $export = __webpack_require__(8) , redefine = __webpack_require__(18) , redefineAll = __webpack_require__(210) , meta = __webpack_require__(22) , forOf = __webpack_require__(206) , anInstance = __webpack_require__(205) , isObject = __webpack_require__(13) , fails = __webpack_require__(7) , $iterDetect = __webpack_require__(165) , setToStringTag = __webpack_require__(24) , inheritIfRequired = __webpack_require__(88); module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ var Base = global[NAME] , C = Base , ADDER = IS_MAP ? 'set' : 'add' , proto = C && C.prototype , O = {}; var fixMethod = function(KEY){ var fn = proto[KEY]; redefine(proto, KEY, KEY == 'delete' ? function(a){ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'has' ? function has(a){ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'get' ? function get(a){ return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } ); }; if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ new C().entries().next(); }))){ // create collection constructor C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { var instance = new C // early implementations not supports chaining , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) // most early implementations doesn't supports iterables, most modern - not close it correctly , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new // for early implementations -0 and +0 not the same , BUGGY_ZERO = !IS_WEAK && fails(function(){ // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new C() , index = 5; while(index--)$instance[ADDER](index, index); return !$instance.has(-0); }); if(!ACCEPT_ITERABLES){ C = wrapper(function(target, iterable){ anInstance(target, C, NAME); var that = inheritIfRequired(new Base, target, C); if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); return that; }); C.prototype = proto; proto.constructor = C; } if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); // weak collections should not contains .clear method if(IS_WEAK && proto.clear)delete proto.clear; } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F * (C != Base), O); if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }, /* 214 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var strong = __webpack_require__(212); // 23.2 Set Objects module.exports = __webpack_require__(213)('Set', function(get){ return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.2.3.1 Set.prototype.add(value) add: function add(value){ return strong.def(this, value = value === 0 ? 0 : value, value); } }, strong); /***/ }, /* 215 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var each = __webpack_require__(172)(0) , redefine = __webpack_require__(18) , meta = __webpack_require__(22) , assign = __webpack_require__(69) , weak = __webpack_require__(216) , isObject = __webpack_require__(13) , getWeak = meta.getWeak , isExtensible = Object.isExtensible , uncaughtFrozenStore = weak.ufstore , tmp = {} , InternalMap; var wrapper = function(get){ return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }; var methods = { // 23.3.3.3 WeakMap.prototype.get(key) get: function get(key){ if(isObject(key)){ var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).get(key); return data ? data[this._i] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function set(key, value){ return weak.def(this, key, value); } }; // 23.3 WeakMap Objects var $WeakMap = module.exports = __webpack_require__(213)('WeakMap', wrapper, methods, weak, true, true); // IE11 WeakMap frozen keys fix if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ InternalMap = weak.getConstructor(wrapper); assign(InternalMap.prototype, methods); meta.NEED = true; each(['delete', 'has', 'get', 'set'], function(key){ var proto = $WeakMap.prototype , method = proto[key]; redefine(proto, key, function(a, b){ // store frozen objects on internal weakmap shim if(isObject(a) && !isExtensible(a)){ if(!this._f)this._f = new InternalMap; var result = this._f[key](a, b); return key == 'set' ? this : result; // store all the rest on native weakmap } return method.call(this, a, b); }); }); } /***/ }, /* 216 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var redefineAll = __webpack_require__(210) , getWeak = __webpack_require__(22).getWeak , anObject = __webpack_require__(12) , isObject = __webpack_require__(13) , anInstance = __webpack_require__(205) , forOf = __webpack_require__(206) , createArrayMethod = __webpack_require__(172) , $has = __webpack_require__(5) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) , id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function(that){ return that._l || (that._l = new UncaughtFrozenStore); }; var UncaughtFrozenStore = function(){ this.a = []; }; var findUncaughtFrozen = function(store, key){ return arrayFind(store.a, function(it){ return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function(key){ var entry = findUncaughtFrozen(this, key); if(entry)return entry[1]; }, has: function(key){ return !!findUncaughtFrozen(this, key); }, set: function(key, value){ var entry = findUncaughtFrozen(this, key); if(entry)entry[1] = value; else this.a.push([key, value]); }, 'delete': function(key){ var index = arrayFindIndex(this.a, function(it){ return it[0] === key; }); if(~index)this.a.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = id++; // collection id that._l = undefined; // leak store for uncaught frozen objects if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this)['delete'](key); return data && $has(data, this._i) && delete data[this._i]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function has(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).has(key); return data && $has(data, this._i); } }); return C; }, def: function(that, key, value){ var data = getWeak(anObject(key), true); if(data === true)uncaughtFrozenStore(that).set(key, value); else data[that._i] = value; return that; }, ufstore: uncaughtFrozenStore }; /***/ }, /* 217 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var weak = __webpack_require__(216); // 23.4 WeakSet Objects __webpack_require__(213)('WeakSet', function(get){ return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.4.3.1 WeakSet.prototype.add(value) add: function add(value){ return weak.def(this, value, true); } }, weak, false, true); /***/ }, /* 218 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , $typed = __webpack_require__(219) , buffer = __webpack_require__(220) , anObject = __webpack_require__(12) , toIndex = __webpack_require__(39) , toLength = __webpack_require__(37) , isObject = __webpack_require__(13) , ArrayBuffer = __webpack_require__(4).ArrayBuffer , speciesConstructor = __webpack_require__(207) , $ArrayBuffer = buffer.ArrayBuffer , $DataView = buffer.DataView , $isView = $typed.ABV && ArrayBuffer.isView , $slice = $ArrayBuffer.prototype.slice , VIEW = $typed.VIEW , ARRAY_BUFFER = 'ArrayBuffer'; $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer}); $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { // 24.1.3.1 ArrayBuffer.isView(arg) isView: function isView(it){ return $isView && $isView(it) || isObject(it) && VIEW in it; } }); $export($export.P + $export.U + $export.F * __webpack_require__(7)(function(){ return !new $ArrayBuffer(2).slice(1, undefined).byteLength; }), ARRAY_BUFFER, { // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) slice: function slice(start, end){ if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix var len = anObject(this).byteLength , first = toIndex(start, len) , final = toIndex(end === undefined ? len : end, len) , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first)) , viewS = new $DataView(this) , viewT = new $DataView(result) , index = 0; while(first < final){ viewT.setUint8(index++, viewS.getUint8(first++)); } return result; } }); __webpack_require__(192)(ARRAY_BUFFER); /***/ }, /* 219 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(4) , hide = __webpack_require__(10) , uid = __webpack_require__(19) , TYPED = uid('typed_array') , VIEW = uid('view') , ABV = !!(global.ArrayBuffer && global.DataView) , CONSTR = ABV , i = 0, l = 9, Typed; var TypedArrayConstructors = ( 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' ).split(','); while(i < l){ if(Typed = global[TypedArrayConstructors[i++]]){ hide(Typed.prototype, TYPED, true); hide(Typed.prototype, VIEW, true); } else CONSTR = false; } module.exports = { ABV: ABV, CONSTR: CONSTR, TYPED: TYPED, VIEW: VIEW }; /***/ }, /* 220 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(4) , DESCRIPTORS = __webpack_require__(6) , LIBRARY = __webpack_require__(28) , $typed = __webpack_require__(219) , hide = __webpack_require__(10) , redefineAll = __webpack_require__(210) , fails = __webpack_require__(7) , anInstance = __webpack_require__(205) , toInteger = __webpack_require__(38) , toLength = __webpack_require__(37) , gOPN = __webpack_require__(50).f , dP = __webpack_require__(11).f , arrayFill = __webpack_require__(188) , setToStringTag = __webpack_require__(24) , ARRAY_BUFFER = 'ArrayBuffer' , DATA_VIEW = 'DataView' , PROTOTYPE = 'prototype' , WRONG_LENGTH = 'Wrong length!' , WRONG_INDEX = 'Wrong index!' , $ArrayBuffer = global[ARRAY_BUFFER] , $DataView = global[DATA_VIEW] , Math = global.Math , RangeError = global.RangeError , Infinity = global.Infinity , BaseBuffer = $ArrayBuffer , abs = Math.abs , pow = Math.pow , floor = Math.floor , log = Math.log , LN2 = Math.LN2 , BUFFER = 'buffer' , BYTE_LENGTH = 'byteLength' , BYTE_OFFSET = 'byteOffset' , $BUFFER = DESCRIPTORS ? '_b' : BUFFER , $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH , $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; // IEEE754 conversions based on https://github.com/feross/ieee754 var packIEEE754 = function(value, mLen, nBytes){ var buffer = Array(nBytes) , eLen = nBytes * 8 - mLen - 1 , eMax = (1 << eLen) - 1 , eBias = eMax >> 1 , rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0 , i = 0 , s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0 , e, m, c; value = abs(value) if(value != value || value === Infinity){ m = value != value ? 1 : 0; e = eMax; } else { e = floor(log(value) / LN2); if(value * (c = pow(2, -e)) < 1){ e--; c *= 2; } if(e + eBias >= 1){ value += rt / c; } else { value += rt * pow(2, 1 - eBias); } if(value * c >= 2){ e++; c /= 2; } if(e + eBias >= eMax){ m = 0; e = eMax; } else if(e + eBias >= 1){ m = (value * c - 1) * pow(2, mLen); e = e + eBias; } else { m = value * pow(2, eBias - 1) * pow(2, mLen); e = 0; } } for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); e = e << mLen | m; eLen += mLen; for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); buffer[--i] |= s * 128; return buffer; }; var unpackIEEE754 = function(buffer, mLen, nBytes){ var eLen = nBytes * 8 - mLen - 1 , eMax = (1 << eLen) - 1 , eBias = eMax >> 1 , nBits = eLen - 7 , i = nBytes - 1 , s = buffer[i--] , e = s & 127 , m; s >>= 7; for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); m = e & (1 << -nBits) - 1; e >>= -nBits; nBits += mLen; for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); if(e === 0){ e = 1 - eBias; } else if(e === eMax){ return m ? NaN : s ? -Infinity : Infinity; } else { m = m + pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * pow(2, e - mLen); }; var unpackI32 = function(bytes){ return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; }; var packI8 = function(it){ return [it & 0xff]; }; var packI16 = function(it){ return [it & 0xff, it >> 8 & 0xff]; }; var packI32 = function(it){ return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; }; var packF64 = function(it){ return packIEEE754(it, 52, 8); }; var packF32 = function(it){ return packIEEE754(it, 23, 4); }; var addGetter = function(C, key, internal){ dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }}); }; var get = function(view, bytes, index, isLittleEndian){ var numIndex = +index , intIndex = toInteger(numIndex); if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b , start = intIndex + view[$OFFSET] , pack = store.slice(start, start + bytes); return isLittleEndian ? pack : pack.reverse(); }; var set = function(view, bytes, index, conversion, value, isLittleEndian){ var numIndex = +index , intIndex = toInteger(numIndex); if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b , start = intIndex + view[$OFFSET] , pack = conversion(+value); for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; }; var validateArrayBufferArguments = function(that, length){ anInstance(that, $ArrayBuffer, ARRAY_BUFFER); var numberLength = +length , byteLength = toLength(numberLength); if(numberLength != byteLength)throw RangeError(WRONG_LENGTH); return byteLength; }; if(!$typed.ABV){ $ArrayBuffer = function ArrayBuffer(length){ var byteLength = validateArrayBufferArguments(this, length); this._b = arrayFill.call(Array(byteLength), 0); this[$LENGTH] = byteLength; }; $DataView = function DataView(buffer, byteOffset, byteLength){ anInstance(this, $DataView, DATA_VIEW); anInstance(buffer, $ArrayBuffer, DATA_VIEW); var bufferLength = buffer[$LENGTH] , offset = toInteger(byteOffset); if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH); this[$BUFFER] = buffer; this[$OFFSET] = offset; this[$LENGTH] = byteLength; }; if(DESCRIPTORS){ addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); addGetter($DataView, BUFFER, '_b'); addGetter($DataView, BYTE_LENGTH, '_l'); addGetter($DataView, BYTE_OFFSET, '_o'); } redefineAll($DataView[PROTOTYPE], { getInt8: function getInt8(byteOffset){ return get(this, 1, byteOffset)[0] << 24 >> 24; }, getUint8: function getUint8(byteOffset){ return get(this, 1, byteOffset)[0]; }, getInt16: function getInt16(byteOffset /*, littleEndian */){ var bytes = get(this, 2, byteOffset, arguments[1]); return (bytes[1] << 8 | bytes[0]) << 16 >> 16; }, getUint16: function getUint16(byteOffset /*, littleEndian */){ var bytes = get(this, 2, byteOffset, arguments[1]); return bytes[1] << 8 | bytes[0]; }, getInt32: function getInt32(byteOffset /*, littleEndian */){ return unpackI32(get(this, 4, byteOffset, arguments[1])); }, getUint32: function getUint32(byteOffset /*, littleEndian */){ return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; }, getFloat32: function getFloat32(byteOffset /*, littleEndian */){ return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); }, getFloat64: function getFloat64(byteOffset /*, littleEndian */){ return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); }, setInt8: function setInt8(byteOffset, value){ set(this, 1, byteOffset, packI8, value); }, setUint8: function setUint8(byteOffset, value){ set(this, 1, byteOffset, packI8, value); }, setInt16: function setInt16(byteOffset, value /*, littleEndian */){ set(this, 2, byteOffset, packI16, value, arguments[2]); }, setUint16: function setUint16(byteOffset, value /*, littleEndian */){ set(this, 2, byteOffset, packI16, value, arguments[2]); }, setInt32: function setInt32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packI32, value, arguments[2]); }, setUint32: function setUint32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packI32, value, arguments[2]); }, setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packF32, value, arguments[2]); }, setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){ set(this, 8, byteOffset, packF64, value, arguments[2]); } }); } else { if(!fails(function(){ new $ArrayBuffer; // eslint-disable-line no-new }) || !fails(function(){ new $ArrayBuffer(.5); // eslint-disable-line no-new })){ $ArrayBuffer = function ArrayBuffer(length){ return new BaseBuffer(validateArrayBufferArguments(this, length)); }; var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){ if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]); }; if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer; } // iOS Safari 7.x bug var view = new $DataView(new $ArrayBuffer(2)) , $setInt8 = $DataView[PROTOTYPE].setInt8; view.setInt8(0, 2147483648); view.setInt8(1, 2147483649); if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], { setInt8: function setInt8(byteOffset, value){ $setInt8.call(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value){ $setInt8.call(this, byteOffset, value << 24 >> 24); } }, true); } setToStringTag($ArrayBuffer, ARRAY_BUFFER); setToStringTag($DataView, DATA_VIEW); hide($DataView[PROTOTYPE], $typed.VIEW, true); exports[ARRAY_BUFFER] = $ArrayBuffer; exports[DATA_VIEW] = $DataView; /***/ }, /* 221 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8); $export($export.G + $export.W + $export.F * !__webpack_require__(219).ABV, { DataView: __webpack_require__(220).DataView }); /***/ }, /* 222 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Int8', 1, function(init){ return function Int8Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 223 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; if(__webpack_require__(6)){ var LIBRARY = __webpack_require__(28) , global = __webpack_require__(4) , fails = __webpack_require__(7) , $export = __webpack_require__(8) , $typed = __webpack_require__(219) , $buffer = __webpack_require__(220) , ctx = __webpack_require__(20) , anInstance = __webpack_require__(205) , propertyDesc = __webpack_require__(17) , hide = __webpack_require__(10) , redefineAll = __webpack_require__(210) , toInteger = __webpack_require__(38) , toLength = __webpack_require__(37) , toIndex = __webpack_require__(39) , toPrimitive = __webpack_require__(16) , has = __webpack_require__(5) , same = __webpack_require__(71) , classof = __webpack_require__(75) , isObject = __webpack_require__(13) , toObject = __webpack_require__(58) , isArrayIter = __webpack_require__(162) , create = __webpack_require__(46) , getPrototypeOf = __webpack_require__(59) , gOPN = __webpack_require__(50).f , getIterFn = __webpack_require__(164) , uid = __webpack_require__(19) , wks = __webpack_require__(25) , createArrayMethod = __webpack_require__(172) , createArrayIncludes = __webpack_require__(36) , speciesConstructor = __webpack_require__(207) , ArrayIterators = __webpack_require__(193) , Iterators = __webpack_require__(129) , $iterDetect = __webpack_require__(165) , setSpecies = __webpack_require__(192) , arrayFill = __webpack_require__(188) , arrayCopyWithin = __webpack_require__(185) , $DP = __webpack_require__(11) , $GOPD = __webpack_require__(51) , dP = $DP.f , gOPD = $GOPD.f , RangeError = global.RangeError , TypeError = global.TypeError , Uint8Array = global.Uint8Array , ARRAY_BUFFER = 'ArrayBuffer' , SHARED_BUFFER = 'Shared' + ARRAY_BUFFER , BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT' , PROTOTYPE = 'prototype' , ArrayProto = Array[PROTOTYPE] , $ArrayBuffer = $buffer.ArrayBuffer , $DataView = $buffer.DataView , arrayForEach = createArrayMethod(0) , arrayFilter = createArrayMethod(2) , arraySome = createArrayMethod(3) , arrayEvery = createArrayMethod(4) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) , arrayIncludes = createArrayIncludes(true) , arrayIndexOf = createArrayIncludes(false) , arrayValues = ArrayIterators.values , arrayKeys = ArrayIterators.keys , arrayEntries = ArrayIterators.entries , arrayLastIndexOf = ArrayProto.lastIndexOf , arrayReduce = ArrayProto.reduce , arrayReduceRight = ArrayProto.reduceRight , arrayJoin = ArrayProto.join , arraySort = ArrayProto.sort , arraySlice = ArrayProto.slice , arrayToString = ArrayProto.toString , arrayToLocaleString = ArrayProto.toLocaleString , ITERATOR = wks('iterator') , TAG = wks('toStringTag') , TYPED_CONSTRUCTOR = uid('typed_constructor') , DEF_CONSTRUCTOR = uid('def_constructor') , ALL_CONSTRUCTORS = $typed.CONSTR , TYPED_ARRAY = $typed.TYPED , VIEW = $typed.VIEW , WRONG_LENGTH = 'Wrong length!'; var $map = createArrayMethod(1, function(O, length){ return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); }); var LITTLE_ENDIAN = fails(function(){ return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; }); var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){ new Uint8Array(1).set({}); }); var strictToLength = function(it, SAME){ if(it === undefined)throw TypeError(WRONG_LENGTH); var number = +it , length = toLength(it); if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH); return length; }; var toOffset = function(it, BYTES){ var offset = toInteger(it); if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!'); return offset; }; var validate = function(it){ if(isObject(it) && TYPED_ARRAY in it)return it; throw TypeError(it + ' is not a typed array!'); }; var allocate = function(C, length){ if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){ throw TypeError('It is not a typed array constructor!'); } return new C(length); }; var speciesFromList = function(O, list){ return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); }; var fromList = function(C, list){ var index = 0 , length = list.length , result = allocate(C, length); while(length > index)result[index] = list[index++]; return result; }; var addGetter = function(it, key, internal){ dP(it, key, {get: function(){ return this._d[internal]; }}); }; var $from = function from(source /*, mapfn, thisArg */){ var O = toObject(source) , aLen = arguments.length , mapfn = aLen > 1 ? arguments[1] : undefined , mapping = mapfn !== undefined , iterFn = getIterFn(O) , i, length, values, result, step, iterator; if(iterFn != undefined && !isArrayIter(iterFn)){ for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){ values.push(step.value); } O = values; } if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2); for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){ result[i] = mapping ? mapfn(O[i], i) : O[i]; } return result; }; var $of = function of(/*...items*/){ var index = 0 , length = arguments.length , result = allocate(this, length); while(length > index)result[index] = arguments[index++]; return result; }; // iOS Safari 6.x fails here var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); }); var $toLocaleString = function toLocaleString(){ return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); }; var proto = { copyWithin: function copyWithin(target, start /*, end */){ return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }, every: function every(callbackfn /*, thisArg */){ return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars return arrayFill.apply(validate(this), arguments); }, filter: function filter(callbackfn /*, thisArg */){ return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined)); }, find: function find(predicate /*, thisArg */){ return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, findIndex: function findIndex(predicate /*, thisArg */){ return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, forEach: function forEach(callbackfn /*, thisArg */){ arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, indexOf: function indexOf(searchElement /*, fromIndex */){ return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, includes: function includes(searchElement /*, fromIndex */){ return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, join: function join(separator){ // eslint-disable-line no-unused-vars return arrayJoin.apply(validate(this), arguments); }, lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars return arrayLastIndexOf.apply(validate(this), arguments); }, map: function map(mapfn /*, thisArg */){ return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); }, reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars return arrayReduce.apply(validate(this), arguments); }, reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars return arrayReduceRight.apply(validate(this), arguments); }, reverse: function reverse(){ var that = this , length = validate(that).length , middle = Math.floor(length / 2) , index = 0 , value; while(index < middle){ value = that[index]; that[index++] = that[--length]; that[length] = value; } return that; }, some: function some(callbackfn /*, thisArg */){ return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, sort: function sort(comparefn){ return arraySort.call(validate(this), comparefn); }, subarray: function subarray(begin, end){ var O = validate(this) , length = O.length , $begin = toIndex(begin, length); return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toIndex(end, length)) - $begin) ); } }; var $slice = function slice(start, end){ return speciesFromList(this, arraySlice.call(validate(this), start, end)); }; var $set = function set(arrayLike /*, offset */){ validate(this); var offset = toOffset(arguments[1], 1) , length = this.length , src = toObject(arrayLike) , len = toLength(src.length) , index = 0; if(len + offset > length)throw RangeError(WRONG_LENGTH); while(index < len)this[offset + index] = src[index++]; }; var $iterators = { entries: function entries(){ return arrayEntries.call(validate(this)); }, keys: function keys(){ return arrayKeys.call(validate(this)); }, values: function values(){ return arrayValues.call(validate(this)); } }; var isTAIndex = function(target, key){ return isObject(target) && target[TYPED_ARRAY] && typeof key != 'symbol' && key in target && String(+key) == String(key); }; var $getDesc = function getOwnPropertyDescriptor(target, key){ return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key); }; var $setDesc = function defineProperty(target, key, desc){ if(isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set') // TODO: add validation descriptor w/o calling accessors && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable) ){ target[key] = desc.value; return target; } else return dP(target, key, desc); }; if(!ALL_CONSTRUCTORS){ $GOPD.f = $getDesc; $DP.f = $setDesc; } $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { getOwnPropertyDescriptor: $getDesc, defineProperty: $setDesc }); if(fails(function(){ arrayToString.call({}); })){ arrayToString = arrayToLocaleString = function toString(){ return arrayJoin.call(this); } } var $TypedArrayPrototype$ = redefineAll({}, proto); redefineAll($TypedArrayPrototype$, $iterators); hide($TypedArrayPrototype$, ITERATOR, $iterators.values); redefineAll($TypedArrayPrototype$, { slice: $slice, set: $set, constructor: function(){ /* noop */ }, toString: arrayToString, toLocaleString: $toLocaleString }); addGetter($TypedArrayPrototype$, 'buffer', 'b'); addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); addGetter($TypedArrayPrototype$, 'byteLength', 'l'); addGetter($TypedArrayPrototype$, 'length', 'e'); dP($TypedArrayPrototype$, TAG, { get: function(){ return this[TYPED_ARRAY]; } }); module.exports = function(KEY, BYTES, wrapper, CLAMPED){ CLAMPED = !!CLAMPED; var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array' , ISNT_UINT8 = NAME != 'Uint8Array' , GETTER = 'get' + KEY , SETTER = 'set' + KEY , TypedArray = global[NAME] , Base = TypedArray || {} , TAC = TypedArray && getPrototypeOf(TypedArray) , FORCED = !TypedArray || !$typed.ABV , O = {} , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; var getter = function(that, index){ var data = that._d; return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); }; var setter = function(that, index, value){ var data = that._d; if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); }; var addElement = function(that, index){ dP(that, index, { get: function(){ return getter(this, index); }, set: function(value){ return setter(this, index, value); }, enumerable: true }); }; if(FORCED){ TypedArray = wrapper(function(that, data, $offset, $length){ anInstance(that, TypedArray, NAME, '_d'); var index = 0 , offset = 0 , buffer, byteLength, length, klass; if(!isObject(data)){ length = strictToLength(data, true) byteLength = length * BYTES; buffer = new $ArrayBuffer(byteLength); } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ buffer = data; offset = toOffset($offset, BYTES); var $len = data.byteLength; if($length === undefined){ if($len % BYTES)throw RangeError(WRONG_LENGTH); byteLength = $len - offset; if(byteLength < 0)throw RangeError(WRONG_LENGTH); } else { byteLength = toLength($length) * BYTES; if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH); } length = byteLength / BYTES; } else if(TYPED_ARRAY in data){ return fromList(TypedArray, data); } else { return $from.call(TypedArray, data); } hide(that, '_d', { b: buffer, o: offset, l: byteLength, e: length, v: new $DataView(buffer) }); while(index < length)addElement(that, index++); }); TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); hide(TypedArrayPrototype, 'constructor', TypedArray); } else if(!$iterDetect(function(iter){ // V8 works with iterators, but fails in many other cases // https://code.google.com/p/v8/issues/detail?id=4552 new TypedArray(null); // eslint-disable-line no-new new TypedArray(iter); // eslint-disable-line no-new }, true)){ TypedArray = wrapper(function(that, data, $offset, $length){ anInstance(that, TypedArray, NAME); var klass; // `ws` module bug, temporarily remove validation length for Uint8Array // https://github.com/websockets/ws/pull/645 if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8)); if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data); } if(TYPED_ARRAY in data)return fromList(TypedArray, data); return $from.call(TypedArray, data); }); arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){ if(!(key in TypedArray))hide(TypedArray, key, Base[key]); }); TypedArray[PROTOTYPE] = TypedArrayPrototype; if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray; } var $nativeIterator = TypedArrayPrototype[ITERATOR] , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined) , $iterator = $iterators.values; hide(TypedArray, TYPED_CONSTRUCTOR, true); hide(TypedArrayPrototype, TYPED_ARRAY, NAME); hide(TypedArrayPrototype, VIEW, true); hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){ dP(TypedArrayPrototype, TAG, { get: function(){ return NAME; } }); } O[NAME] = TypedArray; $export($export.G + $export.W + $export.F * (TypedArray != Base), O); $export($export.S, NAME, { BYTES_PER_ELEMENT: BYTES, from: $from, of: $of }); if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); $export($export.P, NAME, proto); setSpecies(NAME); $export($export.P + $export.F * FORCED_SET, NAME, {set: $set}); $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString}); $export($export.P + $export.F * fails(function(){ new TypedArray(1).slice(); }), NAME, {slice: $slice}); $export($export.P + $export.F * (fails(function(){ return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString() }) || !fails(function(){ TypedArrayPrototype.toLocaleString.call([1, 2]); })), NAME, {toLocaleString: $toLocaleString}); Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator); }; } else module.exports = function(){ /* empty */ }; /***/ }, /* 224 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Uint8', 1, function(init){ return function Uint8Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 225 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Uint8', 1, function(init){ return function Uint8ClampedArray(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }, true); /***/ }, /* 226 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Int16', 2, function(init){ return function Int16Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 227 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Uint16', 2, function(init){ return function Uint16Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 228 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Int32', 4, function(init){ return function Int32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 229 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Uint32', 4, function(init){ return function Uint32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 230 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Float32', 4, function(init){ return function Float32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 231 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(223)('Float64', 8, function(init){ return function Float64Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) var $export = __webpack_require__(8) , aFunction = __webpack_require__(21) , anObject = __webpack_require__(12) , rApply = (__webpack_require__(4).Reflect || {}).apply , fApply = Function.apply; // MS Edge argumentsList argument is optional $export($export.S + $export.F * !__webpack_require__(7)(function(){ rApply(function(){}); }), 'Reflect', { apply: function apply(target, thisArgument, argumentsList){ var T = aFunction(target) , L = anObject(argumentsList); return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); } }); /***/ }, /* 233 */ /***/ function(module, exports, __webpack_require__) { // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) var $export = __webpack_require__(8) , create = __webpack_require__(46) , aFunction = __webpack_require__(21) , anObject = __webpack_require__(12) , isObject = __webpack_require__(13) , fails = __webpack_require__(7) , bind = __webpack_require__(77) , rConstruct = (__webpack_require__(4).Reflect || {}).construct; // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function(){ function F(){} return !(rConstruct(function(){}, [], F) instanceof F); }); var ARGS_BUG = !fails(function(){ rConstruct(function(){}); }); $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { construct: function construct(Target, args /*, newTarget*/){ aFunction(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget); if(Target == newTarget){ // w/o altered newTarget, optimization for 0-4 arguments switch(args.length){ case 0: return new Target; case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; $args.push.apply($args, args); return new (bind.apply(Target, $args)); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype , instance = create(isObject(proto) ? proto : Object.prototype) , result = Function.apply.call(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }, /* 234 */ /***/ function(module, exports, __webpack_require__) { // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) var dP = __webpack_require__(11) , $export = __webpack_require__(8) , anObject = __webpack_require__(12) , toPrimitive = __webpack_require__(16); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false $export($export.S + $export.F * __webpack_require__(7)(function(){ Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2}); }), 'Reflect', { defineProperty: function defineProperty(target, propertyKey, attributes){ anObject(target); propertyKey = toPrimitive(propertyKey, true); anObject(attributes); try { dP.f(target, propertyKey, attributes); return true; } catch(e){ return false; } } }); /***/ }, /* 235 */ /***/ function(module, exports, __webpack_require__) { // 26.1.4 Reflect.deleteProperty(target, propertyKey) var $export = __webpack_require__(8) , gOPD = __webpack_require__(51).f , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { deleteProperty: function deleteProperty(target, propertyKey){ var desc = gOPD(anObject(target), propertyKey); return desc && !desc.configurable ? false : delete target[propertyKey]; } }); /***/ }, /* 236 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 26.1.5 Reflect.enumerate(target) var $export = __webpack_require__(8) , anObject = __webpack_require__(12); var Enumerate = function(iterated){ this._t = anObject(iterated); // target this._i = 0; // next index var keys = this._k = [] // keys , key; for(key in iterated)keys.push(key); }; __webpack_require__(130)(Enumerate, 'Object', function(){ var that = this , keys = that._k , key; do { if(that._i >= keys.length)return {value: undefined, done: true}; } while(!((key = keys[that._i++]) in that._t)); return {value: key, done: false}; }); $export($export.S, 'Reflect', { enumerate: function enumerate(target){ return new Enumerate(target); } }); /***/ }, /* 237 */ /***/ function(module, exports, __webpack_require__) { // 26.1.6 Reflect.get(target, propertyKey [, receiver]) var gOPD = __webpack_require__(51) , getPrototypeOf = __webpack_require__(59) , has = __webpack_require__(5) , $export = __webpack_require__(8) , isObject = __webpack_require__(13) , anObject = __webpack_require__(12); function get(target, propertyKey/*, receiver*/){ var receiver = arguments.length < 3 ? target : arguments[2] , desc, proto; if(anObject(target) === receiver)return target[propertyKey]; if(desc = gOPD.f(target, propertyKey))return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined; if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver); } $export($export.S, 'Reflect', {get: get}); /***/ }, /* 238 */ /***/ function(module, exports, __webpack_require__) { // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) var gOPD = __webpack_require__(51) , $export = __webpack_require__(8) , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){ return gOPD.f(anObject(target), propertyKey); } }); /***/ }, /* 239 */ /***/ function(module, exports, __webpack_require__) { // 26.1.8 Reflect.getPrototypeOf(target) var $export = __webpack_require__(8) , getProto = __webpack_require__(59) , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { getPrototypeOf: function getPrototypeOf(target){ return getProto(anObject(target)); } }); /***/ }, /* 240 */ /***/ function(module, exports, __webpack_require__) { // 26.1.9 Reflect.has(target, propertyKey) var $export = __webpack_require__(8); $export($export.S, 'Reflect', { has: function has(target, propertyKey){ return propertyKey in target; } }); /***/ }, /* 241 */ /***/ function(module, exports, __webpack_require__) { // 26.1.10 Reflect.isExtensible(target) var $export = __webpack_require__(8) , anObject = __webpack_require__(12) , $isExtensible = Object.isExtensible; $export($export.S, 'Reflect', { isExtensible: function isExtensible(target){ anObject(target); return $isExtensible ? $isExtensible(target) : true; } }); /***/ }, /* 242 */ /***/ function(module, exports, __webpack_require__) { // 26.1.11 Reflect.ownKeys(target) var $export = __webpack_require__(8); $export($export.S, 'Reflect', {ownKeys: __webpack_require__(243)}); /***/ }, /* 243 */ /***/ function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols var gOPN = __webpack_require__(50) , gOPS = __webpack_require__(43) , anObject = __webpack_require__(12) , Reflect = __webpack_require__(4).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ var keys = gOPN.f(anObject(it)) , getSymbols = gOPS.f; return getSymbols ? keys.concat(getSymbols(it)) : keys; }; /***/ }, /* 244 */ /***/ function(module, exports, __webpack_require__) { // 26.1.12 Reflect.preventExtensions(target) var $export = __webpack_require__(8) , anObject = __webpack_require__(12) , $preventExtensions = Object.preventExtensions; $export($export.S, 'Reflect', { preventExtensions: function preventExtensions(target){ anObject(target); try { if($preventExtensions)$preventExtensions(target); return true; } catch(e){ return false; } } }); /***/ }, /* 245 */ /***/ function(module, exports, __webpack_require__) { // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) var dP = __webpack_require__(11) , gOPD = __webpack_require__(51) , getPrototypeOf = __webpack_require__(59) , has = __webpack_require__(5) , $export = __webpack_require__(8) , createDesc = __webpack_require__(17) , anObject = __webpack_require__(12) , isObject = __webpack_require__(13); function set(target, propertyKey, V/*, receiver*/){ var receiver = arguments.length < 4 ? target : arguments[3] , ownDesc = gOPD.f(anObject(target), propertyKey) , existingDescriptor, proto; if(!ownDesc){ if(isObject(proto = getPrototypeOf(target))){ return set(proto, propertyKey, V, receiver); } ownDesc = createDesc(0); } if(has(ownDesc, 'value')){ if(ownDesc.writable === false || !isObject(receiver))return false; existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); existingDescriptor.value = V; dP.f(receiver, propertyKey, existingDescriptor); return true; } return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); } $export($export.S, 'Reflect', {set: set}); /***/ }, /* 246 */ /***/ function(module, exports, __webpack_require__) { // 26.1.14 Reflect.setPrototypeOf(target, proto) var $export = __webpack_require__(8) , setProto = __webpack_require__(73); if(setProto)$export($export.S, 'Reflect', { setPrototypeOf: function setPrototypeOf(target, proto){ setProto.check(target, proto); try { setProto.set(target, proto); return true; } catch(e){ return false; } } }); /***/ }, /* 247 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/Array.prototype.includes var $export = __webpack_require__(8) , $includes = __webpack_require__(36)(true); $export($export.P, 'Array', { includes: function includes(el /*, fromIndex = 0 */){ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(186)('includes'); /***/ }, /* 248 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/mathiasbynens/String.prototype.at var $export = __webpack_require__(8) , $at = __webpack_require__(127)(true); $export($export.P, 'String', { at: function at(pos){ return $at(this, pos); } }); /***/ }, /* 249 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(8) , $pad = __webpack_require__(250); $export($export.P, 'String', { padStart: function padStart(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } }); /***/ }, /* 250 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-string-pad-start-end var toLength = __webpack_require__(37) , repeat = __webpack_require__(91) , defined = __webpack_require__(35); module.exports = function(that, maxLength, fillString, left){ var S = String(defined(that)) , stringLength = S.length , fillStr = fillString === undefined ? ' ' : String(fillString) , intMaxLength = toLength(maxLength); if(intMaxLength <= stringLength || fillStr == '')return S; var fillLen = intMaxLength - stringLength , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen); return left ? stringFiller + S : S + stringFiller; }; /***/ }, /* 251 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(8) , $pad = __webpack_require__(250); $export($export.P, 'String', { padEnd: function padEnd(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } }); /***/ }, /* 252 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(83)('trimLeft', function($trim){ return function trimLeft(){ return $trim(this, 1); }; }, 'trimStart'); /***/ }, /* 253 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(83)('trimRight', function($trim){ return function trimRight(){ return $trim(this, 2); }; }, 'trimEnd'); /***/ }, /* 254 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://tc39.github.io/String.prototype.matchAll/ var $export = __webpack_require__(8) , defined = __webpack_require__(35) , toLength = __webpack_require__(37) , isRegExp = __webpack_require__(134) , getFlags = __webpack_require__(196) , RegExpProto = RegExp.prototype; var $RegExpStringIterator = function(regexp, string){ this._r = regexp; this._s = string; }; __webpack_require__(130)($RegExpStringIterator, 'RegExp String', function next(){ var match = this._r.exec(this._s); return {value: match, done: match === null}; }); $export($export.P, 'String', { matchAll: function matchAll(regexp){ defined(this); if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!'); var S = String(this) , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp) , rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); rx.lastIndex = toLength(regexp.lastIndex); return new $RegExpStringIterator(rx, S); } }); /***/ }, /* 255 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(27)('asyncIterator'); /***/ }, /* 256 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(27)('observable'); /***/ }, /* 257 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-getownpropertydescriptors var $export = __webpack_require__(8) , ownKeys = __webpack_require__(243) , toIObject = __webpack_require__(32) , gOPD = __webpack_require__(51) , createProperty = __webpack_require__(163); $export($export.S, 'Object', { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ var O = toIObject(object) , getDesc = gOPD.f , keys = ownKeys(O) , result = {} , i = 0 , key; while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); return result; } }); /***/ }, /* 258 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(8) , $values = __webpack_require__(259)(false); $export($export.S, 'Object', { values: function values(it){ return $values(it); } }); /***/ }, /* 259 */ /***/ function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(30) , toIObject = __webpack_require__(32) , isEnum = __webpack_require__(44).f; module.exports = function(isEntries){ return function(it){ var O = toIObject(it) , keys = getKeys(O) , length = keys.length , i = 0 , result = [] , key; while(length > i)if(isEnum.call(O, key = keys[i++])){ result.push(isEntries ? [key, O[key]] : O[key]); } return result; }; }; /***/ }, /* 260 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(8) , $entries = __webpack_require__(259)(true); $export($export.S, 'Object', { entries: function entries(it){ return $entries(it); } }); /***/ }, /* 261 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toObject = __webpack_require__(58) , aFunction = __webpack_require__(21) , $defineProperty = __webpack_require__(11); // B.2.2.2 Object.prototype.__defineGetter__(P, getter) __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { __defineGetter__: function __defineGetter__(P, getter){ $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true}); } }); /***/ }, /* 262 */ /***/ function(module, exports, __webpack_require__) { // Forced replacement prototype accessors methods module.exports = __webpack_require__(28)|| !__webpack_require__(7)(function(){ var K = Math.random(); // In FF throws only define methods __defineSetter__.call(null, K, function(){ /* empty */}); delete __webpack_require__(4)[K]; }); /***/ }, /* 263 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toObject = __webpack_require__(58) , aFunction = __webpack_require__(21) , $defineProperty = __webpack_require__(11); // B.2.2.3 Object.prototype.__defineSetter__(P, setter) __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { __defineSetter__: function __defineSetter__(P, setter){ $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true}); } }); /***/ }, /* 264 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toObject = __webpack_require__(58) , toPrimitive = __webpack_require__(16) , getPrototypeOf = __webpack_require__(59) , getOwnPropertyDescriptor = __webpack_require__(51).f; // B.2.2.4 Object.prototype.__lookupGetter__(P) __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { __lookupGetter__: function __lookupGetter__(P){ var O = toObject(this) , K = toPrimitive(P, true) , D; do { if(D = getOwnPropertyDescriptor(O, K))return D.get; } while(O = getPrototypeOf(O)); } }); /***/ }, /* 265 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(8) , toObject = __webpack_require__(58) , toPrimitive = __webpack_require__(16) , getPrototypeOf = __webpack_require__(59) , getOwnPropertyDescriptor = __webpack_require__(51).f; // B.2.2.5 Object.prototype.__lookupSetter__(P) __webpack_require__(6) && $export($export.P + __webpack_require__(262), 'Object', { __lookupSetter__: function __lookupSetter__(P){ var O = toObject(this) , K = toPrimitive(P, true) , D; do { if(D = getOwnPropertyDescriptor(O, K))return D.set; } while(O = getPrototypeOf(O)); } }); /***/ }, /* 266 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(8); $export($export.P + $export.R, 'Map', {toJSON: __webpack_require__(267)('Map')}); /***/ }, /* 267 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var classof = __webpack_require__(75) , from = __webpack_require__(268); module.exports = function(NAME){ return function toJSON(){ if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); return from(this); }; }; /***/ }, /* 268 */ /***/ function(module, exports, __webpack_require__) { var forOf = __webpack_require__(206); module.exports = function(iter, ITERATOR){ var result = []; forOf(iter, false, result.push, result, ITERATOR); return result; }; /***/ }, /* 269 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(8); $export($export.P + $export.R, 'Set', {toJSON: __webpack_require__(267)('Set')}); /***/ }, /* 270 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/ljharb/proposal-global var $export = __webpack_require__(8); $export($export.S, 'System', {global: __webpack_require__(4)}); /***/ }, /* 271 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/ljharb/proposal-is-error var $export = __webpack_require__(8) , cof = __webpack_require__(34); $export($export.S, 'Error', { isError: function isError(it){ return cof(it) === 'Error'; } }); /***/ }, /* 272 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(8); $export($export.S, 'Math', { iaddh: function iaddh(x0, x1, y0, y1){ var $x0 = x0 >>> 0 , $x1 = x1 >>> 0 , $y0 = y0 >>> 0; return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; } }); /***/ }, /* 273 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(8); $export($export.S, 'Math', { isubh: function isubh(x0, x1, y0, y1){ var $x0 = x0 >>> 0 , $x1 = x1 >>> 0 , $y0 = y0 >>> 0; return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; } }); /***/ }, /* 274 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(8); $export($export.S, 'Math', { imulh: function imulh(u, v){ var UINT16 = 0xffff , $u = +u , $v = +v , u0 = $u & UINT16 , v0 = $v & UINT16 , u1 = $u >> 16 , v1 = $v >> 16 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); } }); /***/ }, /* 275 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(8); $export($export.S, 'Math', { umulh: function umulh(u, v){ var UINT16 = 0xffff , $u = +u , $v = +v , u0 = $u & UINT16 , v0 = $v & UINT16 , u1 = $u >>> 16 , v1 = $v >>> 16 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); } }); /***/ }, /* 276 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , toMetaKey = metadata.key , ordinaryDefineOwnMetadata = metadata.set; metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){ ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); }}); /***/ }, /* 277 */ /***/ function(module, exports, __webpack_require__) { var Map = __webpack_require__(211) , $export = __webpack_require__(8) , shared = __webpack_require__(23)('metadata') , store = shared.store || (shared.store = new (__webpack_require__(215))); var getOrCreateMetadataMap = function(target, targetKey, create){ var targetMetadata = store.get(target); if(!targetMetadata){ if(!create)return undefined; store.set(target, targetMetadata = new Map); } var keyMetadata = targetMetadata.get(targetKey); if(!keyMetadata){ if(!create)return undefined; targetMetadata.set(targetKey, keyMetadata = new Map); } return keyMetadata; }; var ordinaryHasOwnMetadata = function(MetadataKey, O, P){ var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function(MetadataKey, O, P){ var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){ getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function(target, targetKey){ var metadataMap = getOrCreateMetadataMap(target, targetKey, false) , keys = []; if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); }); return keys; }; var toMetaKey = function(it){ return it === undefined || typeof it == 'symbol' ? it : String(it); }; var exp = function(O){ $export($export.S, 'Reflect', O); }; module.exports = { store: store, map: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, key: toMetaKey, exp: exp }; /***/ }, /* 278 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , toMetaKey = metadata.key , getOrCreateMetadataMap = metadata.map , store = metadata.store; metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){ var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]) , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false; if(metadataMap.size)return true; var targetMetadata = store.get(target); targetMetadata['delete'](targetKey); return !!targetMetadata.size || store['delete'](target); }}); /***/ }, /* 279 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(59) , ordinaryHasOwnMetadata = metadata.has , ordinaryGetOwnMetadata = metadata.get , toMetaKey = metadata.key; var ordinaryGetMetadata = function(MetadataKey, O, P){ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P); var parent = getPrototypeOf(O); return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; }; metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){ return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 280 */ /***/ function(module, exports, __webpack_require__) { var Set = __webpack_require__(214) , from = __webpack_require__(268) , metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(59) , ordinaryOwnMetadataKeys = metadata.keys , toMetaKey = metadata.key; var ordinaryMetadataKeys = function(O, P){ var oKeys = ordinaryOwnMetadataKeys(O, P) , parent = getPrototypeOf(O); if(parent === null)return oKeys; var pKeys = ordinaryMetadataKeys(parent, P); return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; }; metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){ return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); }}); /***/ }, /* 281 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , ordinaryGetOwnMetadata = metadata.get , toMetaKey = metadata.key; metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){ return ordinaryGetOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 282 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , ordinaryOwnMetadataKeys = metadata.keys , toMetaKey = metadata.key; metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){ return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); }}); /***/ }, /* 283 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(59) , ordinaryHasOwnMetadata = metadata.has , toMetaKey = metadata.key; var ordinaryHasMetadata = function(MetadataKey, O, P){ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if(hasOwn)return true; var parent = getPrototypeOf(O); return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; }; metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){ return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 284 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , ordinaryHasOwnMetadata = metadata.has , toMetaKey = metadata.key; metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){ return ordinaryHasOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 285 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(277) , anObject = __webpack_require__(12) , aFunction = __webpack_require__(21) , toMetaKey = metadata.key , ordinaryDefineOwnMetadata = metadata.set; metadata.exp({metadata: function metadata(metadataKey, metadataValue){ return function decorator(target, targetKey){ ordinaryDefineOwnMetadata( metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey) ); }; }}); /***/ }, /* 286 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask var $export = __webpack_require__(8) , microtask = __webpack_require__(209)() , process = __webpack_require__(4).process , isNode = __webpack_require__(34)(process) == 'process'; $export($export.G, { asap: function asap(fn){ var domain = isNode && process.domain; microtask(domain ? domain.bind(fn) : fn); } }); /***/ }, /* 287 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/zenparsing/es-observable var $export = __webpack_require__(8) , global = __webpack_require__(4) , core = __webpack_require__(9) , microtask = __webpack_require__(209)() , OBSERVABLE = __webpack_require__(25)('observable') , aFunction = __webpack_require__(21) , anObject = __webpack_require__(12) , anInstance = __webpack_require__(205) , redefineAll = __webpack_require__(210) , hide = __webpack_require__(10) , forOf = __webpack_require__(206) , RETURN = forOf.RETURN; var getMethod = function(fn){ return fn == null ? undefined : aFunction(fn); }; var cleanupSubscription = function(subscription){ var cleanup = subscription._c; if(cleanup){ subscription._c = undefined; cleanup(); } }; var subscriptionClosed = function(subscription){ return subscription._o === undefined; }; var closeSubscription = function(subscription){ if(!subscriptionClosed(subscription)){ subscription._o = undefined; cleanupSubscription(subscription); } }; var Subscription = function(observer, subscriber){ anObject(observer); this._c = undefined; this._o = observer; observer = new SubscriptionObserver(this); try { var cleanup = subscriber(observer) , subscription = cleanup; if(cleanup != null){ if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); }; else aFunction(cleanup); this._c = cleanup; } } catch(e){ observer.error(e); return; } if(subscriptionClosed(this))cleanupSubscription(this); }; Subscription.prototype = redefineAll({}, { unsubscribe: function unsubscribe(){ closeSubscription(this); } }); var SubscriptionObserver = function(subscription){ this._s = subscription; }; SubscriptionObserver.prototype = redefineAll({}, { next: function next(value){ var subscription = this._s; if(!subscriptionClosed(subscription)){ var observer = subscription._o; try { var m = getMethod(observer.next); if(m)return m.call(observer, value); } catch(e){ try { closeSubscription(subscription); } finally { throw e; } } } }, error: function error(value){ var subscription = this._s; if(subscriptionClosed(subscription))throw value; var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.error); if(!m)throw value; value = m.call(observer, value); } catch(e){ try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; }, complete: function complete(value){ var subscription = this._s; if(!subscriptionClosed(subscription)){ var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.complete); value = m ? m.call(observer, value) : undefined; } catch(e){ try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; } } }); var $Observable = function Observable(subscriber){ anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); }; redefineAll($Observable.prototype, { subscribe: function subscribe(observer){ return new Subscription(observer, this._f); }, forEach: function forEach(fn){ var that = this; return new (core.Promise || global.Promise)(function(resolve, reject){ aFunction(fn); var subscription = that.subscribe({ next : function(value){ try { return fn(value); } catch(e){ reject(e); subscription.unsubscribe(); } }, error: reject, complete: resolve }); }); } }); redefineAll($Observable, { from: function from(x){ var C = typeof this === 'function' ? this : $Observable; var method = getMethod(anObject(x)[OBSERVABLE]); if(method){ var observable = anObject(method.call(x)); return observable.constructor === C ? observable : new C(function(observer){ return observable.subscribe(observer); }); } return new C(function(observer){ var done = false; microtask(function(){ if(!done){ try { if(forOf(x, false, function(it){ observer.next(it); if(done)return RETURN; }) === RETURN)return; } catch(e){ if(done)throw e; observer.error(e); return; } observer.complete(); } }); return function(){ done = true; }; }); }, of: function of(){ for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++]; return new (typeof this === 'function' ? this : $Observable)(function(observer){ var done = false; microtask(function(){ if(!done){ for(var i = 0; i < items.length; ++i){ observer.next(items[i]); if(done)return; } observer.complete(); } }); return function(){ done = true; }; }); } }); hide($Observable.prototype, OBSERVABLE, function(){ return this; }); $export($export.G, {Observable: $Observable}); __webpack_require__(192)('Observable'); /***/ }, /* 288 */ /***/ function(module, exports, __webpack_require__) { // ie9- setTimeout & setInterval additional parameters fix var global = __webpack_require__(4) , $export = __webpack_require__(8) , invoke = __webpack_require__(78) , partial = __webpack_require__(289) , navigator = global.navigator , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check var wrap = function(set){ return MSIE ? function(fn, time /*, ...args */){ return set(invoke( partial, [].slice.call(arguments, 2), typeof fn == 'function' ? fn : Function(fn) ), time); } : set; }; $export($export.G + $export.B + $export.F * MSIE, { setTimeout: wrap(global.setTimeout), setInterval: wrap(global.setInterval) }); /***/ }, /* 289 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var path = __webpack_require__(290) , invoke = __webpack_require__(78) , aFunction = __webpack_require__(21); module.exports = function(/* ...pargs */){ var fn = aFunction(this) , length = arguments.length , pargs = Array(length) , i = 0 , _ = path._ , holder = false; while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true; return function(/* ...args */){ var that = this , aLen = arguments.length , j = 0, k = 0, args; if(!holder && !aLen)return invoke(fn, pargs, that); args = pargs.slice(); if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++]; while(aLen > k)args.push(arguments[k++]); return invoke(fn, args, that); }; }; /***/ }, /* 290 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(4); /***/ }, /* 291 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(8) , $task = __webpack_require__(208); $export($export.G + $export.B, { setImmediate: $task.set, clearImmediate: $task.clear }); /***/ }, /* 292 */ /***/ function(module, exports, __webpack_require__) { var $iterators = __webpack_require__(193) , redefine = __webpack_require__(18) , global = __webpack_require__(4) , hide = __webpack_require__(10) , Iterators = __webpack_require__(129) , wks = __webpack_require__(25) , ITERATOR = wks('iterator') , TO_STRING_TAG = wks('toStringTag') , ArrayValues = Iterators.Array; for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ var NAME = collections[i] , Collection = global[NAME] , proto = Collection && Collection.prototype , key; if(proto){ if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues); if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = ArrayValues; for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true); } } /***/ }, /* 293 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {/** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * https://raw.github.com/facebook/regenerator/master/LICENSE file. An * additional grant of patent rights can be found in the PATENTS file in * the same directory. */ !(function(global) { "use strict"; var hasOwn = Object.prototype.hasOwnProperty; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; var inModule = typeof module === "object"; var runtime = global.regeneratorRuntime; if (runtime) { if (inModule) { // If regeneratorRuntime is defined globally and we're in a module, // make the exports object identical to regeneratorRuntime. module.exports = runtime; } // Don't bother evaluating the rest of this file if the runtime was // already defined globally. return; } // Define the runtime globally (as expected by generated code) as either // module.exports (if we're in a module) or a new, empty object. runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype; GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); } runtime.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; runtime.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `value instanceof AwaitArgument` to determine if the yielded value is // meant to be awaited. Some may consider the name of this method too // cutesy, but they are curmudgeons. runtime.awrap = function(arg) { return new AwaitArgument(arg); }; function AwaitArgument(arg) { this.arg = arg; } function AsyncIterator(generator) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value instanceof AwaitArgument) { return Promise.resolve(value.arg).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return Promise.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. If the Promise is rejected, however, the // result for this iteration will be rejected with the same // reason. Note that rejections of yielded Promises are not // thrown back into the generator function, as is the case // when an awaited Promise is rejected. This difference in // behavior between yield and await is important, because it // allows the consumer to decide what to do with the yielded // rejection (swallow it and continue, manually .throw it back // into the generator, abandon iteration, whatever). With // await, by contrast, there is no opportunity to examine the // rejection reason outside the generator function, so the // only option is to throw it from the await expression, and // let the generator function handle the exception. result.value = unwrapped; resolve(result); }, reject); } } if (typeof process === "object" && process.domain) { invoke = process.domain.bind(invoke); } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new Promise(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. runtime.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per 25.3.3.3.3 of the spec: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume return doneResult(); } while (true) { var delegate = context.delegate; if (delegate) { if (method === "return" || (method === "throw" && delegate.iterator[method] === undefined)) { // A return or throw (when the delegate iterator has no throw // method) always terminates the yield* loop. context.delegate = null; // If the delegate iterator has a return method, give it a // chance to clean up. var returnMethod = delegate.iterator["return"]; if (returnMethod) { var record = tryCatch(returnMethod, delegate.iterator, arg); if (record.type === "throw") { // If the return method threw an exception, let that // exception prevail over the original return or throw. method = "throw"; arg = record.arg; continue; } } if (method === "return") { // Continue with the outer return, now that the delegate // iterator has been terminated. continue; } } var record = tryCatch( delegate.iterator[method], delegate.iterator, arg ); if (record.type === "throw") { context.delegate = null; // Like returning generator.throw(uncaught), but without the // overhead of an extra function call. method = "throw"; arg = record.arg; continue; } // Delegate generator ran and handled its own exceptions so // regardless of what the method was, we continue as if it is // "next" with an undefined arg. method = "next"; arg = undefined; var info = record.arg; if (info.done) { context[delegate.resultName] = info.value; context.next = delegate.nextLoc; } else { state = GenStateSuspendedYield; return info; } context.delegate = null; } if (method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = arg; } else if (method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw arg; } if (context.dispatchException(arg)) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. method = "next"; arg = undefined; } } else if (method === "return") { context.abrupt("return", arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; var info = { value: record.arg, done: context.done }; if (record.arg === ContinueSentinel) { if (context.delegate && method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. arg = undefined; } } else { return info; } } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(arg) call above. method = "throw"; arg = record.arg; } } }; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); Gp[iteratorSymbol] = function() { return this; }; Gp[toStringTagSymbol] = "Generator"; Gp.toString = function() { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } runtime.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } // Return an iterator with no values. return { next: doneResult }; } runtime.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; return !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.next = finallyEntry.finallyLoc; } else { this.complete(record); } return ContinueSentinel; }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = record.arg; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; return ContinueSentinel; } }; })( // Among the various tricks for obtaining a reference to the global // object, this seems to be the most reliable technique that does not // use indirect eval (which violates Content Security Policy). typeof global === "object" ? global : typeof window === "object" ? window : typeof self === "object" ? self : this ); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(294))) /***/ }, /* 294 */ /***/ function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }, /* 295 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(296); module.exports = __webpack_require__(9).RegExp.escape; /***/ }, /* 296 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/benjamingr/RexExp.escape var $export = __webpack_require__(8) , $re = __webpack_require__(297)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); $export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }}); /***/ }, /* 297 */ /***/ function(module, exports) { module.exports = function(regExp, replace){ var replacer = replace === Object(replace) ? function(part){ return replace[part]; } : replace; return function(it){ return String(it).replace(regExp, replacer); }; }; /***/ }, /* 298 */ /***/ function(module, exports, __webpack_require__) { var BSON = __webpack_require__(299), Binary = __webpack_require__(318), Code = __webpack_require__(313), DBRef = __webpack_require__(317), Decimal128 = __webpack_require__(314), Double = __webpack_require__(307), Int32 = __webpack_require__(312), Long = __webpack_require__(306), Map = __webpack_require__(305), MaxKey = __webpack_require__(316), MinKey = __webpack_require__(315), ObjectId = __webpack_require__(309), BSONRegExp = __webpack_require__(310), Symbol = __webpack_require__(311), Timestamp = __webpack_require__(308); // BSON MAX VALUES BSON.BSON_INT32_MAX = 0x7FFFFFFF; BSON.BSON_INT32_MIN = -0x80000000; BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; BSON.BSON_INT64_MIN = -Math.pow(2, 63); // JS MAX PRECISE VALUES BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. // Add BSON types to function creation BSON.Binary = Binary; BSON.Code = Code; BSON.DBRef = DBRef; BSON.Decimal128 = Decimal128; BSON.Double = Double; BSON.Int32 = Int32; BSON.Long = Long; BSON.Map = Map; BSON.MaxKey = MaxKey; BSON.MinKey = MinKey; BSON.ObjectId = ObjectId; BSON.ObjectID = ObjectId; BSON.BSONRegExp = BSONRegExp; BSON.Symbol = Symbol; BSON.Timestamp = Timestamp; // Return the BSON module.exports = BSON; /***/ }, /* 299 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; var writeIEEE754 = __webpack_require__(304).writeIEEE754, readIEEE754 = __webpack_require__(304).readIEEE754, Map = __webpack_require__(305), Long = __webpack_require__(306), Double = __webpack_require__(307), Timestamp = __webpack_require__(308), ObjectID = __webpack_require__(309), BSONRegExp = __webpack_require__(310), Symbol = __webpack_require__(311), Int32 = __webpack_require__(312), Code = __webpack_require__(313), Decimal128 = __webpack_require__(314), MinKey = __webpack_require__(315), MaxKey = __webpack_require__(316), DBRef = __webpack_require__(317), Binary = __webpack_require__(318); // Parts of the parser var deserialize = __webpack_require__(319), serializer = __webpack_require__(323), calculateObjectSize = __webpack_require__(324); /** * @ignore * @api private */ // Max Size var MAXSIZE = 1024 * 1024 * 17; // Max Document Buffer size var buffer = new Buffer(MAXSIZE); var BSON = function () {}; /** * Serialize a Javascript object. * * @param {Object} object the Javascript object to serialize. * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. * @return {Buffer} returns the Buffer object containing the serialized object. * @api public */ BSON.prototype.serialize = function serialize(object, options) { options = options || {}; // Unpack the options var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true; // console.log("===================================== serialize") // console.log("checkKeys = " + checkKeys) // console.log("serializeFunctions = " + serializeFunctions) // console.log("ignoreUndefined = " + ignoreUndefined) // Attempt to serialize var serializationIndex = serializer(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []); // Create the final buffer var finishedBuffer = new Buffer(serializationIndex); // Copy into the finished buffer buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); // Return the buffer return finishedBuffer; }; /** * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. * * @param {Object} object the Javascript object to serialize. * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. * @param {Number} [options.index] the index in the buffer where we wish to start serializing into. * @return {Number} returns the index pointing to the last written byte in the buffer. * @api public */ BSON.prototype.serializeWithBufferAndIndex = function (object, finalBuffer, options) { options = options || {}; // Unpack the options var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true; var startIndex = typeof options.index == 'number' ? options.index : 0; // console.log("===================================== serializeWithBufferAndIndex") // console.log("checkKeys = " + checkKeys) // console.log("serializeFunctions = " + serializeFunctions) // console.log("ignoreUndefined = " + ignoreUndefined) // console.log("startIndex = " + startIndex) // Attempt to serialize var serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined); buffer.copy(finalBuffer, startIndex, 0, serializationIndex); // Return the index return serializationIndex - 1; }; /** * Deserialize data as BSON. * * Options * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits * * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. * @param {Object} [options] additional options used for the deserialization. * @param {Boolean} [isArray] ignore used for recursive parsing. * @return {Object} returns the deserialized Javascript Object. * @api public */ BSON.prototype.deserialize = function (data, options) { return deserialize(data, options); }; /** * Calculate the bson size for a passed in Javascript object. * * @param {Object} object the Javascript object to calculate the BSON byte size for. * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. * @return {Number} returns the number of bytes the BSON object will take up. * @api public */ BSON.prototype.calculateObjectSize = function (object, options) { options = options || {}; var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : true; return calculateObjectSize(object, serializeFunctions, ignoreUndefined); }; /** * Deserialize stream data as BSON documents. * * Options * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits * * @param {Buffer} data the buffer containing the serialized set of BSON documents. * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. * @param {Number} numberOfDocuments number of documents to deserialize. * @param {Array} documents an array where to store the deserialized documents. * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. * @param {Object} [options] additional options used for the deserialization. * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. * @api public */ BSON.prototype.deserializeStream = function (data, startIndex, numberOfDocuments, documents, docStartIndex, options) { // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); options = options != null ? options : {}; var index = startIndex; // Loop over all documents for (var i = 0; i < numberOfDocuments; i++) { // Find size of the document var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; // Update options with index options['index'] = index; // Parse the document at this point documents[docStartIndex + i] = this.deserialize(data, options); // Adjust index by the document size index = index + size; } // Return object containing end index of parsing and list of documents return index; }; /** * @ignore * @api private */ // BSON MAX VALUES BSON.BSON_INT32_MAX = 0x7FFFFFFF; BSON.BSON_INT32_MIN = -0x80000000; BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; BSON.BSON_INT64_MIN = -Math.pow(2, 63); // JS MAX PRECISE VALUES BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. // Internal long versions var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. /** * Number BSON Type * * @classconstant BSON_DATA_NUMBER **/ BSON.BSON_DATA_NUMBER = 1; /** * String BSON Type * * @classconstant BSON_DATA_STRING **/ BSON.BSON_DATA_STRING = 2; /** * Object BSON Type * * @classconstant BSON_DATA_OBJECT **/ BSON.BSON_DATA_OBJECT = 3; /** * Array BSON Type * * @classconstant BSON_DATA_ARRAY **/ BSON.BSON_DATA_ARRAY = 4; /** * Binary BSON Type * * @classconstant BSON_DATA_BINARY **/ BSON.BSON_DATA_BINARY = 5; /** * ObjectID BSON Type * * @classconstant BSON_DATA_OID **/ BSON.BSON_DATA_OID = 7; /** * Boolean BSON Type * * @classconstant BSON_DATA_BOOLEAN **/ BSON.BSON_DATA_BOOLEAN = 8; /** * Date BSON Type * * @classconstant BSON_DATA_DATE **/ BSON.BSON_DATA_DATE = 9; /** * null BSON Type * * @classconstant BSON_DATA_NULL **/ BSON.BSON_DATA_NULL = 10; /** * RegExp BSON Type * * @classconstant BSON_DATA_REGEXP **/ BSON.BSON_DATA_REGEXP = 11; /** * Code BSON Type * * @classconstant BSON_DATA_CODE **/ BSON.BSON_DATA_CODE = 13; /** * Symbol BSON Type * * @classconstant BSON_DATA_SYMBOL **/ BSON.BSON_DATA_SYMBOL = 14; /** * Code with Scope BSON Type * * @classconstant BSON_DATA_CODE_W_SCOPE **/ BSON.BSON_DATA_CODE_W_SCOPE = 15; /** * 32 bit Integer BSON Type * * @classconstant BSON_DATA_INT **/ BSON.BSON_DATA_INT = 16; /** * Timestamp BSON Type * * @classconstant BSON_DATA_TIMESTAMP **/ BSON.BSON_DATA_TIMESTAMP = 17; /** * Long BSON Type * * @classconstant BSON_DATA_LONG **/ BSON.BSON_DATA_LONG = 18; /** * MinKey BSON Type * * @classconstant BSON_DATA_MIN_KEY **/ BSON.BSON_DATA_MIN_KEY = 0xff; /** * MaxKey BSON Type * * @classconstant BSON_DATA_MAX_KEY **/ BSON.BSON_DATA_MAX_KEY = 0x7f; /** * Binary Default Type * * @classconstant BSON_BINARY_SUBTYPE_DEFAULT **/ BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; /** * Binary Function Type * * @classconstant BSON_BINARY_SUBTYPE_FUNCTION **/ BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; /** * Binary Byte Array Type * * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY **/ BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; /** * Binary UUID Type * * @classconstant BSON_BINARY_SUBTYPE_UUID **/ BSON.BSON_BINARY_SUBTYPE_UUID = 3; /** * Binary MD5 Type * * @classconstant BSON_BINARY_SUBTYPE_MD5 **/ BSON.BSON_BINARY_SUBTYPE_MD5 = 4; /** * Binary User Defined Type * * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED **/ BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; // Return BSON module.exports = BSON; module.exports.Code = Code; module.exports.Map = Map; module.exports.Symbol = Symbol; module.exports.BSON = BSON; module.exports.DBRef = DBRef; module.exports.Binary = Binary; module.exports.ObjectID = ObjectID; module.exports.Long = Long; module.exports.Timestamp = Timestamp; module.exports.Double = Double; module.exports.Int32 = Int32; module.exports.MinKey = MinKey; module.exports.MaxKey = MaxKey; module.exports.BSONRegExp = BSONRegExp; module.exports.Decimal128 = Decimal128; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer)) /***/ }, /* 300 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <[email protected]> <http://feross.org> * @license MIT */ /* eslint-disable no-proto */ 'use strict' var base64 = __webpack_require__(301) var ieee754 = __webpack_require__(302) var isArray = __webpack_require__(303) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport() /* * Export kMaxLength after typed array support is determined. */ exports.kMaxLength = kMaxLength() function typedArraySupport () { try { var arr = new Uint8Array(1) arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} return arr.foo() === 42 && // typed array instances can be augmented typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) { return false } } function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } function createBuffer (that, length) { if (kMaxLength() < length) { throw new RangeError('Invalid typed array length') } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = new Uint8Array(length) that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class if (that === null) { that = new Buffer(length) } that.length = length } return that } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } Buffer.poolSize = 8192 // not used by this implementation // TODO: Legacy, not needed anymore. Remove in next major version. Buffer._augment = function (arr) { arr.__proto__ = Buffer.prototype return arr } function from (that, value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { return fromArrayBuffer(that, value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(that, value, encodingOrOffset) } return fromObject(that, value) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true }) } } function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be a number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } } function alloc (that, size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(that, size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) } return createBuffer(that, size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) } function allocUnsafe (that, size) { assertSize(size) that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < size; ++i) { that[i] = 0 } } return that } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) } function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } var length = byteLength(string, encoding) | 0 that = createBuffer(that, length) var actual = that.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual) } return that } function fromArrayLike (that, array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 that = createBuffer(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } function fromArrayBuffer (that, array, byteOffset, length) { array.byteLength // this throws if `array` is not a valid ArrayBuffer if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('\'offset\' is out of bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('\'length\' is out of bounds') } if (byteOffset === undefined && length === undefined) { array = new Uint8Array(array) } else if (length === undefined) { array = new Uint8Array(array, byteOffset) } else { array = new Uint8Array(array, byteOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = array that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class that = fromArrayLike(that, array) } return that } function fromObject (that, obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 that = createBuffer(that, len) if (that.length === 0) { return that } obj.copy(that, 0, 0, len) return that } if (obj) { if ((typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer) || 'length' in obj) { if (typeof obj.length !== 'number' || isnan(obj.length)) { return createBuffer(that, 0) } return fromArrayLike(that, obj) } if (obj.type === 'Buffer' && isArray(obj.data)) { return fromArrayLike(that, obj.data) } } throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') } function checked (length) { // Note: cannot use `length < kMaxLength()` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { string = '' + string } var len = string.length if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect // Buffer instances. Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length | 0 if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') if (this.length > max) str += ' ... ' } return '<Buffer ' + str + '>' } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (!Buffer.isBuffer(target)) { throw new TypeError('Argument must be a Buffer') } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } // must be an even number of digits var strLen = string.length if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (isNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0 if (isFinite(length)) { length = length | 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = this.subarray(start, end) newBuf.__proto__ = Buffer.prototype } else { var sliceLen = end - start newBuf = new Buffer(sliceLen, undefined) for (var i = 0; i < sliceLen; ++i) { newBuf[i] = this[i + start] } } return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) this[offset] = (value & 0xff) return offset + 1 } function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start var i if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; ++i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, start + len), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (val.length === 1) { var code = val.charCodeAt(0) if (code < 256) { val = code } } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } } else if (typeof val === 'number') { val = val & 255 } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()) var len = bytes.length for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } function isnan (val) { return val !== val // eslint-disable-line no-self-compare } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer, (function() { return this; }()))) /***/ }, /* 301 */ /***/ function(module, exports) { 'use strict' exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function placeHoldersCount (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // the number of equal signs (place holders) // if there are two placeholders, than the two characters before it // represent one byte // if there is only one, then the three characters before it represent 2 bytes // this is just a cheap hack to not do indexOf twice return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 } function byteLength (b64) { // base64 is 4/3 + up to two characters of the original data return b64.length * 3 / 4 - placeHoldersCount(b64) } function toByteArray (b64) { var i, j, l, tmp, placeHolders, arr var len = b64.length placeHolders = placeHoldersCount(b64) arr = new Arr(len * 3 / 4 - placeHolders) // if there are placeholders, only get up to the last complete 4 chars l = placeHolders > 0 ? len - 4 : len var L = 0 for (i = 0, j = 0; i < l; i += 4, j += 3) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[L++] = (tmp >> 16) & 0xFF arr[L++] = (tmp >> 8) & 0xFF arr[L++] = tmp & 0xFF } if (placeHolders === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[L++] = tmp & 0xFF } else if (placeHolders === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[L++] = (tmp >> 8) & 0xFF arr[L++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var output = '' var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] output += lookup[tmp >> 2] output += lookup[(tmp << 4) & 0x3F] output += '==' } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) output += lookup[tmp >> 10] output += lookup[(tmp >> 4) & 0x3F] output += lookup[(tmp << 2) & 0x3F] output += '=' } parts.push(output) return parts.join('') } /***/ }, /* 302 */ /***/ function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = nBytes * 8 - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = (value * c - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } /***/ }, /* 303 */ /***/ function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; /***/ }, /* 304 */ /***/ function(module, exports) { // Copyright (c) 2008, Fair Oaks Labs, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // // Modifications to writeIEEE754 to support negative zeroes made by Brian White var readIEEE754 = function (buffer, offset, endian, mLen, nBytes) { var e, m, bBE = endian === 'big', eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i = bBE ? 0 : nBytes - 1, d = bBE ? 1 : -1, s = buffer[offset + i]; i += d; e = s & (1 << -nBits) - 1; s >>= -nBits; nBits += eLen; for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); m = e & (1 << -nBits) - 1; e >>= -nBits; nBits += mLen; for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); if (e === 0) { e = 1 - eBias; } else if (e === eMax) { return m ? NaN : (s ? -1 : 1) * Infinity; } else { m = m + Math.pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * Math.pow(2, e - mLen); }; var writeIEEE754 = function (buffer, value, offset, endian, mLen, nBytes) { var e, m, c, bBE = endian === 'big', eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, i = bBE ? nBytes - 1 : 0, d = bBE ? -1 : 1, s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; value = Math.abs(value); if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0; e = eMax; } else { e = Math.floor(Math.log(value) / Math.LN2); if (value * (c = Math.pow(2, -e)) < 1) { e--; c *= 2; } if (e + eBias >= 1) { value += rt / c; } else { value += rt * Math.pow(2, 1 - eBias); } if (value * c >= 2) { e++; c /= 2; } if (e + eBias >= eMax) { m = 0; e = eMax; } else if (e + eBias >= 1) { m = (value * c - 1) * Math.pow(2, mLen); e = e + eBias; } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); e = 0; } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); e = e << mLen | m; eLen += mLen; for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); buffer[offset + i - d] |= s * 128; }; exports.readIEEE754 = readIEEE754; exports.writeIEEE754 = writeIEEE754; /***/ }, /* 305 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {"use strict"; // We have an ES6 Map available, return the native instance if (typeof global.Map !== 'undefined') { module.exports = global.Map; module.exports.Map = global.Map; } else { // We will return a polyfill var Map = function (array) { this._keys = []; this._values = {}; for (var i = 0; i < array.length; i++) { if (array[i] == null) continue; // skip null and undefined var entry = array[i]; var key = entry[0]; var value = entry[1]; // Add the key to the list of keys in order this._keys.push(key); // Add the key and value to the values dictionary with a point // to the location in the ordered keys list this._values[key] = { v: value, i: this._keys.length - 1 }; } }; Map.prototype.clear = function () { this._keys = []; this._values = {}; }; Map.prototype.delete = function (key) { var value = this._values[key]; if (value == null) return false; // Delete entry delete this._values[key]; // Remove the key from the ordered keys list this._keys.splice(value.i, 1); return true; }; Map.prototype.entries = function () { var self = this; var index = 0; return { next: function () { var key = self._keys[index++]; return { value: key !== undefined ? [key, self._values[key].v] : undefined, done: key !== undefined ? false : true }; } }; }; Map.prototype.forEach = function (callback, self) { self = self || this; for (var i = 0; i < this._keys.length; i++) { var key = this._keys[i]; // Call the forEach callback callback.call(self, this._values[key].v, key, self); } }; Map.prototype.get = function (key) { return this._values[key] ? this._values[key].v : undefined; }; Map.prototype.has = function (key) { return this._values[key] != null; }; Map.prototype.keys = function (key) { var self = this; var index = 0; return { next: function () { var key = self._keys[index++]; return { value: key !== undefined ? key : undefined, done: key !== undefined ? false : true }; } }; }; Map.prototype.set = function (key, value) { if (this._values[key]) { this._values[key].v = value; return this; } // Add the key to the list of keys in order this._keys.push(key); // Add the key and value to the values dictionary with a point // to the location in the ordered keys list this._values[key] = { v: value, i: this._keys.length - 1 }; return this; }; Map.prototype.values = function (key, value) { var self = this; var index = 0; return { next: function () { var key = self._keys[index++]; return { value: key !== undefined ? self._values[key].v : undefined, done: key !== undefined ? false : true }; } }; }; // Last ismaster Object.defineProperty(Map.prototype, 'size', { enumerable: true, get: function () { return this._keys.length; } }); module.exports = Map; module.exports.Map = Map; } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 306 */ /***/ function(module, exports) { // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Copyright 2009 Google Inc. All Rights Reserved /** * Defines a Long class for representing a 64-bit two's-complement * integer value, which faithfully simulates the behavior of a Java "Long". This * implementation is derived from LongLib in GWT. * * Constructs a 64-bit two's-complement integer, given its low and high 32-bit * values as *signed* integers. See the from* functions below for more * convenient ways of constructing Longs. * * The internal representation of a Long is the two given signed, 32-bit values. * We use 32-bit pieces because these are the size of integers on which * Javascript performs bit-operations. For operations like addition and * multiplication, we split each number into 16-bit pieces, which can easily be * multiplied within Javascript's floating-point representation without overflow * or change in sign. * * In the algorithms below, we frequently reduce the negative case to the * positive case by negating the input(s) and then post-processing the result. * Note that we must ALWAYS check specially whether those values are MIN_VALUE * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as * a positive number, it overflows back into a negative). Not handling this * case would often result in infinite recursion. * * @class * @param {number} low the low (signed) 32 bits of the Long. * @param {number} high the high (signed) 32 bits of the Long. * @return {Long} */ function Long(low, high) { if (!(this instanceof Long)) return new Long(low, high); this._bsontype = 'Long'; /** * @type {number} * @ignore */ this.low_ = low | 0; // force into 32 signed bits. /** * @type {number} * @ignore */ this.high_ = high | 0; // force into 32 signed bits. }; /** * Return the int value. * * @method * @return {number} the value, assuming it is a 32-bit integer. */ Long.prototype.toInt = function () { return this.low_; }; /** * Return the Number value. * * @method * @return {number} the closest floating-point representation to this value. */ Long.prototype.toNumber = function () { return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); }; /** * Return the JSON value. * * @method * @return {string} the JSON representation. */ Long.prototype.toJSON = function () { return this.toString(); }; /** * Return the String value. * * @method * @param {number} [opt_radix] the radix in which the text should be written. * @return {string} the textual representation of this value. */ Long.prototype.toString = function (opt_radix) { var radix = opt_radix || 10; if (radix < 2 || 36 < radix) { throw Error('radix out of range: ' + radix); } if (this.isZero()) { return '0'; } if (this.isNegative()) { if (this.equals(Long.MIN_VALUE)) { // We need to change the Long value before it can be negated, so we remove // the bottom-most digit in this base and then recurse to do the rest. var radixLong = Long.fromNumber(radix); var div = this.div(radixLong); var rem = div.multiply(radixLong).subtract(this); return div.toString(radix) + rem.toInt().toString(radix); } else { return '-' + this.negate().toString(radix); } } // Do several (6) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = Long.fromNumber(Math.pow(radix, 6)); var rem = this; var result = ''; while (true) { var remDiv = rem.div(radixToPower); var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); var digits = intval.toString(radix); rem = remDiv; if (rem.isZero()) { return digits + result; } else { while (digits.length < 6) { digits = '0' + digits; } result = '' + digits + result; } } }; /** * Return the high 32-bits value. * * @method * @return {number} the high 32-bits as a signed value. */ Long.prototype.getHighBits = function () { return this.high_; }; /** * Return the low 32-bits value. * * @method * @return {number} the low 32-bits as a signed value. */ Long.prototype.getLowBits = function () { return this.low_; }; /** * Return the low unsigned 32-bits value. * * @method * @return {number} the low 32-bits as an unsigned value. */ Long.prototype.getLowBitsUnsigned = function () { return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; }; /** * Returns the number of bits needed to represent the absolute value of this Long. * * @method * @return {number} Returns the number of bits needed to represent the absolute value of this Long. */ Long.prototype.getNumBitsAbs = function () { if (this.isNegative()) { if (this.equals(Long.MIN_VALUE)) { return 64; } else { return this.negate().getNumBitsAbs(); } } else { var val = this.high_ != 0 ? this.high_ : this.low_; for (var bit = 31; bit > 0; bit--) { if ((val & 1 << bit) != 0) { break; } } return this.high_ != 0 ? bit + 33 : bit + 1; } }; /** * Return whether this value is zero. * * @method * @return {boolean} whether this value is zero. */ Long.prototype.isZero = function () { return this.high_ == 0 && this.low_ == 0; }; /** * Return whether this value is negative. * * @method * @return {boolean} whether this value is negative. */ Long.prototype.isNegative = function () { return this.high_ < 0; }; /** * Return whether this value is odd. * * @method * @return {boolean} whether this value is odd. */ Long.prototype.isOdd = function () { return (this.low_ & 1) == 1; }; /** * Return whether this Long equals the other * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long equals the other */ Long.prototype.equals = function (other) { return this.high_ == other.high_ && this.low_ == other.low_; }; /** * Return whether this Long does not equal the other. * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long does not equal the other. */ Long.prototype.notEquals = function (other) { return this.high_ != other.high_ || this.low_ != other.low_; }; /** * Return whether this Long is less than the other. * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long is less than the other. */ Long.prototype.lessThan = function (other) { return this.compare(other) < 0; }; /** * Return whether this Long is less than or equal to the other. * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long is less than or equal to the other. */ Long.prototype.lessThanOrEqual = function (other) { return this.compare(other) <= 0; }; /** * Return whether this Long is greater than the other. * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long is greater than the other. */ Long.prototype.greaterThan = function (other) { return this.compare(other) > 0; }; /** * Return whether this Long is greater than or equal to the other. * * @method * @param {Long} other Long to compare against. * @return {boolean} whether this Long is greater than or equal to the other. */ Long.prototype.greaterThanOrEqual = function (other) { return this.compare(other) >= 0; }; /** * Compares this Long with the given one. * * @method * @param {Long} other Long to compare against. * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. */ Long.prototype.compare = function (other) { if (this.equals(other)) { return 0; } var thisNeg = this.isNegative(); var otherNeg = other.isNegative(); if (thisNeg && !otherNeg) { return -1; } if (!thisNeg && otherNeg) { return 1; } // at this point, the signs are the same, so subtraction will not overflow if (this.subtract(other).isNegative()) { return -1; } else { return 1; } }; /** * The negation of this value. * * @method * @return {Long} the negation of this value. */ Long.prototype.negate = function () { if (this.equals(Long.MIN_VALUE)) { return Long.MIN_VALUE; } else { return this.not().add(Long.ONE); } }; /** * Returns the sum of this and the given Long. * * @method * @param {Long} other Long to add to this one. * @return {Long} the sum of this and the given Long. */ Long.prototype.add = function (other) { // Divide each number into 4 chunks of 16 bits, and then sum the chunks. var a48 = this.high_ >>> 16; var a32 = this.high_ & 0xFFFF; var a16 = this.low_ >>> 16; var a00 = this.low_ & 0xFFFF; var b48 = other.high_ >>> 16; var b32 = other.high_ & 0xFFFF; var b16 = other.low_ >>> 16; var b00 = other.low_ & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 + b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 + b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 + b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 + b48; c48 &= 0xFFFF; return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32); }; /** * Returns the difference of this and the given Long. * * @method * @param {Long} other Long to subtract from this. * @return {Long} the difference of this and the given Long. */ Long.prototype.subtract = function (other) { return this.add(other.negate()); }; /** * Returns the product of this and the given Long. * * @method * @param {Long} other Long to multiply with this. * @return {Long} the product of this and the other. */ Long.prototype.multiply = function (other) { if (this.isZero()) { return Long.ZERO; } else if (other.isZero()) { return Long.ZERO; } if (this.equals(Long.MIN_VALUE)) { return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; } else if (other.equals(Long.MIN_VALUE)) { return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; } if (this.isNegative()) { if (other.isNegative()) { return this.negate().multiply(other.negate()); } else { return this.negate().multiply(other).negate(); } } else if (other.isNegative()) { return this.multiply(other.negate()).negate(); } // If both Longs are small, use float multiplication if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) { return Long.fromNumber(this.toNumber() * other.toNumber()); } // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. // We can skip products that would overflow. var a48 = this.high_ >>> 16; var a32 = this.high_ & 0xFFFF; var a16 = this.low_ >>> 16; var a00 = this.low_ & 0xFFFF; var b48 = other.high_ >>> 16; var b32 = other.high_ & 0xFFFF; var b16 = other.low_ >>> 16; var b00 = other.low_ & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 * b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 * b00; c32 += c16 >>> 16; c16 &= 0xFFFF; c16 += a00 * b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 * b00; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a16 * b16; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a00 * b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; c48 &= 0xFFFF; return Long.fromBits(c16 << 16 | c00, c48 << 16 | c32); }; /** * Returns this Long divided by the given one. * * @method * @param {Long} other Long by which to divide. * @return {Long} this Long divided by the given one. */ Long.prototype.div = function (other) { if (other.isZero()) { throw Error('division by zero'); } else if (this.isZero()) { return Long.ZERO; } if (this.equals(Long.MIN_VALUE)) { if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) { return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE } else if (other.equals(Long.MIN_VALUE)) { return Long.ONE; } else { // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. var halfThis = this.shiftRight(1); var approx = halfThis.div(other).shiftLeft(1); if (approx.equals(Long.ZERO)) { return other.isNegative() ? Long.ONE : Long.NEG_ONE; } else { var rem = this.subtract(other.multiply(approx)); var result = approx.add(rem.div(other)); return result; } } } else if (other.equals(Long.MIN_VALUE)) { return Long.ZERO; } if (this.isNegative()) { if (other.isNegative()) { return this.negate().div(other.negate()); } else { return this.negate().div(other).negate(); } } else if (other.isNegative()) { return this.div(other.negate()).negate(); } // Repeat the following until the remainder is less than other: find a // floating-point that approximates remainder / other *from below*, add this // into the result, and subtract it from the remainder. It is critical that // the approximate value is less than or equal to the real value so that the // remainder never becomes negative. var res = Long.ZERO; var rem = this; while (rem.greaterThanOrEqual(other)) { // Approximate the result of division. This may be a little greater or // smaller than the actual value. var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or // the smallest non-fractional digit, whichever is larger. var log2 = Math.ceil(Math.log(approx) / Math.LN2); var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); // Decrease the approximation until it is smaller than the remainder. Note // that if it is too large, the product overflows and is negative. var approxRes = Long.fromNumber(approx); var approxRem = approxRes.multiply(other); while (approxRem.isNegative() || approxRem.greaterThan(rem)) { approx -= delta; approxRes = Long.fromNumber(approx); approxRem = approxRes.multiply(other); } // We know the answer can't be zero... and actually, zero would cause // infinite recursion since we would make no progress. if (approxRes.isZero()) { approxRes = Long.ONE; } res = res.add(approxRes); rem = rem.subtract(approxRem); } return res; }; /** * Returns this Long modulo the given one. * * @method * @param {Long} other Long by which to mod. * @return {Long} this Long modulo the given one. */ Long.prototype.modulo = function (other) { return this.subtract(this.div(other).multiply(other)); }; /** * The bitwise-NOT of this value. * * @method * @return {Long} the bitwise-NOT of this value. */ Long.prototype.not = function () { return Long.fromBits(~this.low_, ~this.high_); }; /** * Returns the bitwise-AND of this Long and the given one. * * @method * @param {Long} other the Long with which to AND. * @return {Long} the bitwise-AND of this and the other. */ Long.prototype.and = function (other) { return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); }; /** * Returns the bitwise-OR of this Long and the given one. * * @method * @param {Long} other the Long with which to OR. * @return {Long} the bitwise-OR of this and the other. */ Long.prototype.or = function (other) { return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); }; /** * Returns the bitwise-XOR of this Long and the given one. * * @method * @param {Long} other the Long with which to XOR. * @return {Long} the bitwise-XOR of this and the other. */ Long.prototype.xor = function (other) { return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); }; /** * Returns this Long with bits shifted to the left by the given amount. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Long} this shifted to the left by the given amount. */ Long.prototype.shiftLeft = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var low = this.low_; if (numBits < 32) { var high = this.high_; return Long.fromBits(low << numBits, high << numBits | low >>> 32 - numBits); } else { return Long.fromBits(0, low << numBits - 32); } } }; /** * Returns this Long with bits shifted to the right by the given amount. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Long} this shifted to the right by the given amount. */ Long.prototype.shiftRight = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var high = this.high_; if (numBits < 32) { var low = this.low_; return Long.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits); } else { return Long.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1); } } }; /** * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. */ Long.prototype.shiftRightUnsigned = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var high = this.high_; if (numBits < 32) { var low = this.low_; return Long.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits); } else if (numBits == 32) { return Long.fromBits(high, 0); } else { return Long.fromBits(high >>> numBits - 32, 0); } } }; /** * Returns a Long representing the given (32-bit) integer value. * * @method * @param {number} value the 32-bit integer in question. * @return {Long} the corresponding Long value. */ Long.fromInt = function (value) { if (-128 <= value && value < 128) { var cachedObj = Long.INT_CACHE_[value]; if (cachedObj) { return cachedObj; } } var obj = new Long(value | 0, value < 0 ? -1 : 0); if (-128 <= value && value < 128) { Long.INT_CACHE_[value] = obj; } return obj; }; /** * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. * * @method * @param {number} value the number in question. * @return {Long} the corresponding Long value. */ Long.fromNumber = function (value) { if (isNaN(value) || !isFinite(value)) { return Long.ZERO; } else if (value <= -Long.TWO_PWR_63_DBL_) { return Long.MIN_VALUE; } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { return Long.MAX_VALUE; } else if (value < 0) { return Long.fromNumber(-value).negate(); } else { return new Long(value % Long.TWO_PWR_32_DBL_ | 0, value / Long.TWO_PWR_32_DBL_ | 0); } }; /** * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. * * @method * @param {number} lowBits the low 32-bits. * @param {number} highBits the high 32-bits. * @return {Long} the corresponding Long value. */ Long.fromBits = function (lowBits, highBits) { return new Long(lowBits, highBits); }; /** * Returns a Long representation of the given string, written using the given radix. * * @method * @param {string} str the textual representation of the Long. * @param {number} opt_radix the radix in which the text is written. * @return {Long} the corresponding Long value. */ Long.fromString = function (str, opt_radix) { if (str.length == 0) { throw Error('number format error: empty string'); } var radix = opt_radix || 10; if (radix < 2 || 36 < radix) { throw Error('radix out of range: ' + radix); } if (str.charAt(0) == '-') { return Long.fromString(str.substring(1), radix).negate(); } else if (str.indexOf('-') >= 0) { throw Error('number format error: interior "-" character: ' + str); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = Long.fromNumber(Math.pow(radix, 8)); var result = Long.ZERO; for (var i = 0; i < str.length; i += 8) { var size = Math.min(8, str.length - i); var value = parseInt(str.substring(i, i + size), radix); if (size < 8) { var power = Long.fromNumber(Math.pow(radix, size)); result = result.multiply(power).add(Long.fromNumber(value)); } else { result = result.multiply(radixToPower); result = result.add(Long.fromNumber(value)); } } return result; }; // NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the // from* methods on which they depend. /** * A cache of the Long representations of small integer values. * @type {Object} * @ignore */ Long.INT_CACHE_ = {}; // NOTE: the compiler should inline these constant values below and then remove // these variables, so there should be no runtime penalty for these. /** * Number used repeated below in calculations. This must appear before the * first call to any from* function below. * @type {number} * @ignore */ Long.TWO_PWR_16_DBL_ = 1 << 16; /** * @type {number} * @ignore */ Long.TWO_PWR_24_DBL_ = 1 << 24; /** * @type {number} * @ignore */ Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; /** * @type {number} * @ignore */ Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; /** * @type {number} * @ignore */ Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; /** * @type {number} * @ignore */ Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; /** * @type {number} * @ignore */ Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; /** @type {Long} */ Long.ZERO = Long.fromInt(0); /** @type {Long} */ Long.ONE = Long.fromInt(1); /** @type {Long} */ Long.NEG_ONE = Long.fromInt(-1); /** @type {Long} */ Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); /** @type {Long} */ Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); /** * @type {Long} * @ignore */ Long.TWO_PWR_24_ = Long.fromInt(1 << 24); /** * Expose. */ module.exports = Long; module.exports.Long = Long; /***/ }, /* 307 */ /***/ function(module, exports) { /** * A class representation of the BSON Double type. * * @class * @param {number} value the number we want to represent as a double. * @return {Double} */ function Double(value) { if (!(this instanceof Double)) return new Double(value); this._bsontype = 'Double'; this.value = value; } /** * Access the number value. * * @method * @return {number} returns the wrapped double number. */ Double.prototype.valueOf = function () { return this.value; }; /** * @ignore */ Double.prototype.toJSON = function () { return this.value; }; module.exports = Double; module.exports.Double = Double; /***/ }, /* 308 */ /***/ function(module, exports) { // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Copyright 2009 Google Inc. All Rights Reserved /** * This type is for INTERNAL use in MongoDB only and should not be used in applications. * The appropriate corresponding type is the JavaScript Date type. * * Defines a Timestamp class for representing a 64-bit two's-complement * integer value, which faithfully simulates the behavior of a Java "Timestamp". This * implementation is derived from TimestampLib in GWT. * * Constructs a 64-bit two's-complement integer, given its low and high 32-bit * values as *signed* integers. See the from* functions below for more * convenient ways of constructing Timestamps. * * The internal representation of a Timestamp is the two given signed, 32-bit values. * We use 32-bit pieces because these are the size of integers on which * Javascript performs bit-operations. For operations like addition and * multiplication, we split each number into 16-bit pieces, which can easily be * multiplied within Javascript's floating-point representation without overflow * or change in sign. * * In the algorithms below, we frequently reduce the negative case to the * positive case by negating the input(s) and then post-processing the result. * Note that we must ALWAYS check specially whether those values are MIN_VALUE * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as * a positive number, it overflows back into a negative). Not handling this * case would often result in infinite recursion. * * @class * @param {number} low the low (signed) 32 bits of the Timestamp. * @param {number} high the high (signed) 32 bits of the Timestamp. */ function Timestamp(low, high) { if (!(this instanceof Timestamp)) return new Timestamp(low, high); this._bsontype = 'Timestamp'; /** * @type {number} * @ignore */ this.low_ = low | 0; // force into 32 signed bits. /** * @type {number} * @ignore */ this.high_ = high | 0; // force into 32 signed bits. }; /** * Return the int value. * * @return {number} the value, assuming it is a 32-bit integer. */ Timestamp.prototype.toInt = function () { return this.low_; }; /** * Return the Number value. * * @method * @return {number} the closest floating-point representation to this value. */ Timestamp.prototype.toNumber = function () { return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); }; /** * Return the JSON value. * * @method * @return {string} the JSON representation. */ Timestamp.prototype.toJSON = function () { return this.toString(); }; /** * Return the String value. * * @method * @param {number} [opt_radix] the radix in which the text should be written. * @return {string} the textual representation of this value. */ Timestamp.prototype.toString = function (opt_radix) { var radix = opt_radix || 10; if (radix < 2 || 36 < radix) { throw Error('radix out of range: ' + radix); } if (this.isZero()) { return '0'; } if (this.isNegative()) { if (this.equals(Timestamp.MIN_VALUE)) { // We need to change the Timestamp value before it can be negated, so we remove // the bottom-most digit in this base and then recurse to do the rest. var radixTimestamp = Timestamp.fromNumber(radix); var div = this.div(radixTimestamp); var rem = div.multiply(radixTimestamp).subtract(this); return div.toString(radix) + rem.toInt().toString(radix); } else { return '-' + this.negate().toString(radix); } } // Do several (6) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); var rem = this; var result = ''; while (true) { var remDiv = rem.div(radixToPower); var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); var digits = intval.toString(radix); rem = remDiv; if (rem.isZero()) { return digits + result; } else { while (digits.length < 6) { digits = '0' + digits; } result = '' + digits + result; } } }; /** * Return the high 32-bits value. * * @method * @return {number} the high 32-bits as a signed value. */ Timestamp.prototype.getHighBits = function () { return this.high_; }; /** * Return the low 32-bits value. * * @method * @return {number} the low 32-bits as a signed value. */ Timestamp.prototype.getLowBits = function () { return this.low_; }; /** * Return the low unsigned 32-bits value. * * @method * @return {number} the low 32-bits as an unsigned value. */ Timestamp.prototype.getLowBitsUnsigned = function () { return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; }; /** * Returns the number of bits needed to represent the absolute value of this Timestamp. * * @method * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. */ Timestamp.prototype.getNumBitsAbs = function () { if (this.isNegative()) { if (this.equals(Timestamp.MIN_VALUE)) { return 64; } else { return this.negate().getNumBitsAbs(); } } else { var val = this.high_ != 0 ? this.high_ : this.low_; for (var bit = 31; bit > 0; bit--) { if ((val & 1 << bit) != 0) { break; } } return this.high_ != 0 ? bit + 33 : bit + 1; } }; /** * Return whether this value is zero. * * @method * @return {boolean} whether this value is zero. */ Timestamp.prototype.isZero = function () { return this.high_ == 0 && this.low_ == 0; }; /** * Return whether this value is negative. * * @method * @return {boolean} whether this value is negative. */ Timestamp.prototype.isNegative = function () { return this.high_ < 0; }; /** * Return whether this value is odd. * * @method * @return {boolean} whether this value is odd. */ Timestamp.prototype.isOdd = function () { return (this.low_ & 1) == 1; }; /** * Return whether this Timestamp equals the other * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp equals the other */ Timestamp.prototype.equals = function (other) { return this.high_ == other.high_ && this.low_ == other.low_; }; /** * Return whether this Timestamp does not equal the other. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp does not equal the other. */ Timestamp.prototype.notEquals = function (other) { return this.high_ != other.high_ || this.low_ != other.low_; }; /** * Return whether this Timestamp is less than the other. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp is less than the other. */ Timestamp.prototype.lessThan = function (other) { return this.compare(other) < 0; }; /** * Return whether this Timestamp is less than or equal to the other. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp is less than or equal to the other. */ Timestamp.prototype.lessThanOrEqual = function (other) { return this.compare(other) <= 0; }; /** * Return whether this Timestamp is greater than the other. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp is greater than the other. */ Timestamp.prototype.greaterThan = function (other) { return this.compare(other) > 0; }; /** * Return whether this Timestamp is greater than or equal to the other. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} whether this Timestamp is greater than or equal to the other. */ Timestamp.prototype.greaterThanOrEqual = function (other) { return this.compare(other) >= 0; }; /** * Compares this Timestamp with the given one. * * @method * @param {Timestamp} other Timestamp to compare against. * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. */ Timestamp.prototype.compare = function (other) { if (this.equals(other)) { return 0; } var thisNeg = this.isNegative(); var otherNeg = other.isNegative(); if (thisNeg && !otherNeg) { return -1; } if (!thisNeg && otherNeg) { return 1; } // at this point, the signs are the same, so subtraction will not overflow if (this.subtract(other).isNegative()) { return -1; } else { return 1; } }; /** * The negation of this value. * * @method * @return {Timestamp} the negation of this value. */ Timestamp.prototype.negate = function () { if (this.equals(Timestamp.MIN_VALUE)) { return Timestamp.MIN_VALUE; } else { return this.not().add(Timestamp.ONE); } }; /** * Returns the sum of this and the given Timestamp. * * @method * @param {Timestamp} other Timestamp to add to this one. * @return {Timestamp} the sum of this and the given Timestamp. */ Timestamp.prototype.add = function (other) { // Divide each number into 4 chunks of 16 bits, and then sum the chunks. var a48 = this.high_ >>> 16; var a32 = this.high_ & 0xFFFF; var a16 = this.low_ >>> 16; var a00 = this.low_ & 0xFFFF; var b48 = other.high_ >>> 16; var b32 = other.high_ & 0xFFFF; var b16 = other.low_ >>> 16; var b00 = other.low_ & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 + b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 + b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 + b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 + b48; c48 &= 0xFFFF; return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32); }; /** * Returns the difference of this and the given Timestamp. * * @method * @param {Timestamp} other Timestamp to subtract from this. * @return {Timestamp} the difference of this and the given Timestamp. */ Timestamp.prototype.subtract = function (other) { return this.add(other.negate()); }; /** * Returns the product of this and the given Timestamp. * * @method * @param {Timestamp} other Timestamp to multiply with this. * @return {Timestamp} the product of this and the other. */ Timestamp.prototype.multiply = function (other) { if (this.isZero()) { return Timestamp.ZERO; } else if (other.isZero()) { return Timestamp.ZERO; } if (this.equals(Timestamp.MIN_VALUE)) { return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; } else if (other.equals(Timestamp.MIN_VALUE)) { return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; } if (this.isNegative()) { if (other.isNegative()) { return this.negate().multiply(other.negate()); } else { return this.negate().multiply(other).negate(); } } else if (other.isNegative()) { return this.multiply(other.negate()).negate(); } // If both Timestamps are small, use float multiplication if (this.lessThan(Timestamp.TWO_PWR_24_) && other.lessThan(Timestamp.TWO_PWR_24_)) { return Timestamp.fromNumber(this.toNumber() * other.toNumber()); } // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. // We can skip products that would overflow. var a48 = this.high_ >>> 16; var a32 = this.high_ & 0xFFFF; var a16 = this.low_ >>> 16; var a00 = this.low_ & 0xFFFF; var b48 = other.high_ >>> 16; var b32 = other.high_ & 0xFFFF; var b16 = other.low_ >>> 16; var b00 = other.low_ & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 * b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 * b00; c32 += c16 >>> 16; c16 &= 0xFFFF; c16 += a00 * b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 * b00; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a16 * b16; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a00 * b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; c48 &= 0xFFFF; return Timestamp.fromBits(c16 << 16 | c00, c48 << 16 | c32); }; /** * Returns this Timestamp divided by the given one. * * @method * @param {Timestamp} other Timestamp by which to divide. * @return {Timestamp} this Timestamp divided by the given one. */ Timestamp.prototype.div = function (other) { if (other.isZero()) { throw Error('division by zero'); } else if (this.isZero()) { return Timestamp.ZERO; } if (this.equals(Timestamp.MIN_VALUE)) { if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) { return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE } else if (other.equals(Timestamp.MIN_VALUE)) { return Timestamp.ONE; } else { // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. var halfThis = this.shiftRight(1); var approx = halfThis.div(other).shiftLeft(1); if (approx.equals(Timestamp.ZERO)) { return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; } else { var rem = this.subtract(other.multiply(approx)); var result = approx.add(rem.div(other)); return result; } } } else if (other.equals(Timestamp.MIN_VALUE)) { return Timestamp.ZERO; } if (this.isNegative()) { if (other.isNegative()) { return this.negate().div(other.negate()); } else { return this.negate().div(other).negate(); } } else if (other.isNegative()) { return this.div(other.negate()).negate(); } // Repeat the following until the remainder is less than other: find a // floating-point that approximates remainder / other *from below*, add this // into the result, and subtract it from the remainder. It is critical that // the approximate value is less than or equal to the real value so that the // remainder never becomes negative. var res = Timestamp.ZERO; var rem = this; while (rem.greaterThanOrEqual(other)) { // Approximate the result of division. This may be a little greater or // smaller than the actual value. var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or // the smallest non-fractional digit, whichever is larger. var log2 = Math.ceil(Math.log(approx) / Math.LN2); var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); // Decrease the approximation until it is smaller than the remainder. Note // that if it is too large, the product overflows and is negative. var approxRes = Timestamp.fromNumber(approx); var approxRem = approxRes.multiply(other); while (approxRem.isNegative() || approxRem.greaterThan(rem)) { approx -= delta; approxRes = Timestamp.fromNumber(approx); approxRem = approxRes.multiply(other); } // We know the answer can't be zero... and actually, zero would cause // infinite recursion since we would make no progress. if (approxRes.isZero()) { approxRes = Timestamp.ONE; } res = res.add(approxRes); rem = rem.subtract(approxRem); } return res; }; /** * Returns this Timestamp modulo the given one. * * @method * @param {Timestamp} other Timestamp by which to mod. * @return {Timestamp} this Timestamp modulo the given one. */ Timestamp.prototype.modulo = function (other) { return this.subtract(this.div(other).multiply(other)); }; /** * The bitwise-NOT of this value. * * @method * @return {Timestamp} the bitwise-NOT of this value. */ Timestamp.prototype.not = function () { return Timestamp.fromBits(~this.low_, ~this.high_); }; /** * Returns the bitwise-AND of this Timestamp and the given one. * * @method * @param {Timestamp} other the Timestamp with which to AND. * @return {Timestamp} the bitwise-AND of this and the other. */ Timestamp.prototype.and = function (other) { return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); }; /** * Returns the bitwise-OR of this Timestamp and the given one. * * @method * @param {Timestamp} other the Timestamp with which to OR. * @return {Timestamp} the bitwise-OR of this and the other. */ Timestamp.prototype.or = function (other) { return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); }; /** * Returns the bitwise-XOR of this Timestamp and the given one. * * @method * @param {Timestamp} other the Timestamp with which to XOR. * @return {Timestamp} the bitwise-XOR of this and the other. */ Timestamp.prototype.xor = function (other) { return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); }; /** * Returns this Timestamp with bits shifted to the left by the given amount. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Timestamp} this shifted to the left by the given amount. */ Timestamp.prototype.shiftLeft = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var low = this.low_; if (numBits < 32) { var high = this.high_; return Timestamp.fromBits(low << numBits, high << numBits | low >>> 32 - numBits); } else { return Timestamp.fromBits(0, low << numBits - 32); } } }; /** * Returns this Timestamp with bits shifted to the right by the given amount. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Timestamp} this shifted to the right by the given amount. */ Timestamp.prototype.shiftRight = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var high = this.high_; if (numBits < 32) { var low = this.low_; return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >> numBits); } else { return Timestamp.fromBits(high >> numBits - 32, high >= 0 ? 0 : -1); } } }; /** * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. * * @method * @param {number} numBits the number of bits by which to shift. * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. */ Timestamp.prototype.shiftRightUnsigned = function (numBits) { numBits &= 63; if (numBits == 0) { return this; } else { var high = this.high_; if (numBits < 32) { var low = this.low_; return Timestamp.fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits); } else if (numBits == 32) { return Timestamp.fromBits(high, 0); } else { return Timestamp.fromBits(high >>> numBits - 32, 0); } } }; /** * Returns a Timestamp representing the given (32-bit) integer value. * * @method * @param {number} value the 32-bit integer in question. * @return {Timestamp} the corresponding Timestamp value. */ Timestamp.fromInt = function (value) { if (-128 <= value && value < 128) { var cachedObj = Timestamp.INT_CACHE_[value]; if (cachedObj) { return cachedObj; } } var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); if (-128 <= value && value < 128) { Timestamp.INT_CACHE_[value] = obj; } return obj; }; /** * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. * * @method * @param {number} value the number in question. * @return {Timestamp} the corresponding Timestamp value. */ Timestamp.fromNumber = function (value) { if (isNaN(value) || !isFinite(value)) { return Timestamp.ZERO; } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { return Timestamp.MIN_VALUE; } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { return Timestamp.MAX_VALUE; } else if (value < 0) { return Timestamp.fromNumber(-value).negate(); } else { return new Timestamp(value % Timestamp.TWO_PWR_32_DBL_ | 0, value / Timestamp.TWO_PWR_32_DBL_ | 0); } }; /** * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. * * @method * @param {number} lowBits the low 32-bits. * @param {number} highBits the high 32-bits. * @return {Timestamp} the corresponding Timestamp value. */ Timestamp.fromBits = function (lowBits, highBits) { return new Timestamp(lowBits, highBits); }; /** * Returns a Timestamp representation of the given string, written using the given radix. * * @method * @param {string} str the textual representation of the Timestamp. * @param {number} opt_radix the radix in which the text is written. * @return {Timestamp} the corresponding Timestamp value. */ Timestamp.fromString = function (str, opt_radix) { if (str.length == 0) { throw Error('number format error: empty string'); } var radix = opt_radix || 10; if (radix < 2 || 36 < radix) { throw Error('radix out of range: ' + radix); } if (str.charAt(0) == '-') { return Timestamp.fromString(str.substring(1), radix).negate(); } else if (str.indexOf('-') >= 0) { throw Error('number format error: interior "-" character: ' + str); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); var result = Timestamp.ZERO; for (var i = 0; i < str.length; i += 8) { var size = Math.min(8, str.length - i); var value = parseInt(str.substring(i, i + size), radix); if (size < 8) { var power = Timestamp.fromNumber(Math.pow(radix, size)); result = result.multiply(power).add(Timestamp.fromNumber(value)); } else { result = result.multiply(radixToPower); result = result.add(Timestamp.fromNumber(value)); } } return result; }; // NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the // from* methods on which they depend. /** * A cache of the Timestamp representations of small integer values. * @type {Object} * @ignore */ Timestamp.INT_CACHE_ = {}; // NOTE: the compiler should inline these constant values below and then remove // these variables, so there should be no runtime penalty for these. /** * Number used repeated below in calculations. This must appear before the * first call to any from* function below. * @type {number} * @ignore */ Timestamp.TWO_PWR_16_DBL_ = 1 << 16; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_24_DBL_ = 1 << 24; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; /** * @type {number} * @ignore */ Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; /** @type {Timestamp} */ Timestamp.ZERO = Timestamp.fromInt(0); /** @type {Timestamp} */ Timestamp.ONE = Timestamp.fromInt(1); /** @type {Timestamp} */ Timestamp.NEG_ONE = Timestamp.fromInt(-1); /** @type {Timestamp} */ Timestamp.MAX_VALUE = Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); /** @type {Timestamp} */ Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); /** * @type {Timestamp} * @ignore */ Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); /** * Expose. */ module.exports = Timestamp; module.exports.Timestamp = Timestamp; /***/ }, /* 309 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process, Buffer) {/** * Machine id. * * Create a random 3-byte value (i.e. unique for this * process). Other drivers use a md5 of the machine id here, but * that would mean an asyc call to gethostname, so we don't bother. * @ignore */ var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); // Regular expression that checks for hex value var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); /** * Create a new ObjectID instance * * @class * @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. * @property {number} generationTime The generation time of this ObjectId instance * @return {ObjectID} instance of ObjectID. */ var ObjectID = function ObjectID(id) { // Duck-typing to support ObjectId from different npm packages if (id instanceof ObjectID) return id; if (!(this instanceof ObjectID)) return new ObjectID(id); this._bsontype = 'ObjectID'; var __id = null; var valid = ObjectID.isValid(id); // Throw an error if it's not a valid setup if (!valid && id != null) { throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); } else if (valid && typeof id == 'string' && id.length == 24) { return ObjectID.createFromHexString(id); } else if (id == null || typeof id == 'number') { // convert to 12 byte binary string this.id = this.generate(id); } else if (id != null && id.length === 12) { // assume 12 byte string this.id = id; } else if (id != null && id.toHexString) { // Duck-typing to support ObjectId from different npm packages return id; } else { throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); } if (ObjectID.cacheHexString) this.__id = this.toHexString(); }; // Allow usage of ObjectId as well as ObjectID var ObjectId = ObjectID; // Precomputed hex table enables speedy hex string conversion var hexTable = []; for (var i = 0; i < 256; i++) { hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); } /** * Return the ObjectID id as a 24 byte hex string representation * * @method * @return {string} return the 24 byte hex string representation. */ ObjectID.prototype.toHexString = function () { if (ObjectID.cacheHexString && this.__id) return this.__id; var hexString = ''; if (!this.id || !this.id.length) { throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']'); } if (this.id instanceof _Buffer) { hexString = convertToHex(this.id); if (ObjectID.cacheHexString) this.__id = hexString; return hexString; } for (var i = 0; i < this.id.length; i++) { hexString += hexTable[this.id.charCodeAt(i)]; } if (ObjectID.cacheHexString) this.__id = hexString; return hexString; }; /** * Update the ObjectID index used in generating new ObjectID's on the driver * * @method * @return {number} returns next index value. * @ignore */ ObjectID.prototype.get_inc = function () { return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; }; /** * Update the ObjectID index used in generating new ObjectID's on the driver * * @method * @return {number} returns next index value. * @ignore */ ObjectID.prototype.getInc = function () { return this.get_inc(); }; /** * Generate a 12 byte id buffer used in ObjectID's * * @method * @param {number} [time] optional parameter allowing to pass in a second based timestamp. * @return {Buffer} return the 12 byte id buffer string. */ ObjectID.prototype.generate = function (time) { if ('number' != typeof time) { time = ~~(Date.now() / 1000); } // Use pid var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF; var inc = this.get_inc(); // Buffer used var buffer = new Buffer(12); // Encode time buffer[3] = time & 0xff; buffer[2] = time >> 8 & 0xff; buffer[1] = time >> 16 & 0xff; buffer[0] = time >> 24 & 0xff; // Encode machine buffer[6] = MACHINE_ID & 0xff; buffer[5] = MACHINE_ID >> 8 & 0xff; buffer[4] = MACHINE_ID >> 16 & 0xff; // Encode pid buffer[8] = pid & 0xff; buffer[7] = pid >> 8 & 0xff; // Encode index buffer[11] = inc & 0xff; buffer[10] = inc >> 8 & 0xff; buffer[9] = inc >> 16 & 0xff; // Return the buffer return buffer; }; /** * Converts the id into a 24 byte hex string for printing * * @return {String} return the 24 byte hex string representation. * @ignore */ ObjectID.prototype.toString = function () { return this.toHexString(); }; /** * Converts to a string representation of this Id. * * @return {String} return the 24 byte hex string representation. * @ignore */ ObjectID.prototype.inspect = ObjectID.prototype.toString; /** * Converts to its JSON representation. * * @return {String} return the 24 byte hex string representation. * @ignore */ ObjectID.prototype.toJSON = function () { return this.toHexString(); }; /** * Compares the equality of this ObjectID with `otherID`. * * @method * @param {object} otherID ObjectID instance to compare against. * @return {boolean} the result of comparing two ObjectID's */ ObjectID.prototype.equals = function equals(otherId) { var id; if (otherId instanceof ObjectID) { return this.toString() == otherId.toString(); } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12 && this.id instanceof _Buffer) { return otherId === this.id.toString('binary'); } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 24) { return otherId.toLowerCase() === this.toHexString(); } else if (typeof otherId == 'string' && ObjectID.isValid(otherId) && otherId.length == 12) { return otherId === this.id; } else if (otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) { return otherId.toHexString() === this.toHexString(); } else { return false; } }; /** * Returns the generation date (accurate up to the second) that this ID was generated. * * @method * @return {date} the generation date */ ObjectID.prototype.getTimestamp = function () { var timestamp = new Date(); var time = this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24; timestamp.setTime(Math.floor(time) * 1000); return timestamp; }; /** * @ignore */ ObjectID.index = ~~(Math.random() * 0xFFFFFF); /** * @ignore */ ObjectID.createPk = function createPk() { return new ObjectID(); }; /** * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. * * @method * @param {number} time an integer number representing a number of seconds. * @return {ObjectID} return the created ObjectID */ ObjectID.createFromTime = function createFromTime(time) { var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Encode time into first 4 bytes buffer[3] = time & 0xff; buffer[2] = time >> 8 & 0xff; buffer[1] = time >> 16 & 0xff; buffer[0] = time >> 24 & 0xff; // Return the new objectId return new ObjectID(buffer); }; // Lookup tables var encodeLookup = '0123456789abcdef'.split(''); var decodeLookup = []; var i = 0; while (i < 10) decodeLookup[0x30 + i] = i++; while (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++; var _Buffer = Buffer; var convertToHex = function (bytes) { return bytes.toString('hex'); }; /** * Creates an ObjectID from a hex string representation of an ObjectID. * * @method * @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. * @return {ObjectID} return the created ObjectID */ ObjectID.createFromHexString = function createFromHexString(string) { // Throw an error if it's not a valid setup if (typeof string === 'undefined' || string != null && string.length != 24) throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); var length = string.length; if (length > 12 * 2) { throw new Error('Id cannot be longer than 12 bytes'); } // Calculate lengths var sizeof = length >> 1; var array = new _Buffer(sizeof); var n = 0; var i = 0; while (i < length) { array[n++] = decodeLookup[string.charCodeAt(i++)] << 4 | decodeLookup[string.charCodeAt(i++)]; } return new ObjectID(array); }; /** * Checks if a value is a valid bson ObjectId * * @method * @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. */ ObjectID.isValid = function isValid(id) { if (id == null) return false; if (typeof id == 'number') { return true; } if (typeof id == 'string') { return id.length == 12 || id.length == 24 && checkForHexRegExp.test(id); } if (id instanceof ObjectID) { return true; } if (id instanceof _Buffer) { return true; } // Duck-Typing detection of ObjectId like objects if (id.toHexString) { return id.id.length == 12 || id.id.length == 24 && checkForHexRegExp.test(id.id); } return false; }; /** * @ignore */ Object.defineProperty(ObjectID.prototype, "generationTime", { enumerable: true, get: function () { return this.id[3] | this.id[2] << 8 | this.id[1] << 16 | this.id[0] << 24; }, set: function (value) { // Encode time into first 4 bytes this.id[3] = value & 0xff; this.id[2] = value >> 8 & 0xff; this.id[1] = value >> 16 & 0xff; this.id[0] = value >> 24 & 0xff; } }); /** * Expose. */ module.exports = ObjectID; module.exports.ObjectID = ObjectID; module.exports.ObjectId = ObjectID; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(294), __webpack_require__(300).Buffer)) /***/ }, /* 310 */ /***/ function(module, exports) { /** * A class representation of the BSON RegExp type. * * @class * @return {BSONRegExp} A MinKey instance */ function BSONRegExp(pattern, options) { if (!(this instanceof BSONRegExp)) return new BSONRegExp(); // Execute this._bsontype = 'BSONRegExp'; this.pattern = pattern || ''; this.options = options || ''; // Validate options for (var i = 0; i < this.options.length; i++) { if (!(this.options[i] == 'i' || this.options[i] == 'm' || this.options[i] == 'x' || this.options[i] == 'l' || this.options[i] == 's' || this.options[i] == 'u')) { throw new Error('the regular expression options [' + this.options[i] + "] is not supported"); } } } module.exports = BSONRegExp; module.exports.BSONRegExp = BSONRegExp; /***/ }, /* 311 */ /***/ function(module, exports) { /** * A class representation of the BSON Symbol type. * * @class * @deprecated * @param {string} value the string representing the symbol. * @return {Symbol} */ function Symbol(value) { if (!(this instanceof Symbol)) return new Symbol(value); this._bsontype = 'Symbol'; this.value = value; } /** * Access the wrapped string value. * * @method * @return {String} returns the wrapped string. */ Symbol.prototype.valueOf = function () { return this.value; }; /** * @ignore */ Symbol.prototype.toString = function () { return this.value; }; /** * @ignore */ Symbol.prototype.inspect = function () { return this.value; }; /** * @ignore */ Symbol.prototype.toJSON = function () { return this.value; }; module.exports = Symbol; module.exports.Symbol = Symbol; /***/ }, /* 312 */ /***/ function(module, exports) { var Int32 = function (value) { if (!(this instanceof Int32)) return new Int32(value); this._bsontype = 'Int32'; this.value = value; }; /** * Access the number value. * * @method * @return {number} returns the wrapped int32 number. */ Int32.prototype.valueOf = function () { return this.value; }; /** * @ignore */ Int32.prototype.toJSON = function () { return this.value; }; module.exports = Int32; module.exports.Int32 = Int32; /***/ }, /* 313 */ /***/ function(module, exports) { /** * A class representation of the BSON Code type. * * @class * @param {(string|function)} code a string or function. * @param {Object} [scope] an optional scope for the function. * @return {Code} */ var Code = function Code(code, scope) { if (!(this instanceof Code)) return new Code(code, scope); this._bsontype = 'Code'; this.code = code; this.scope = scope; }; /** * @ignore */ Code.prototype.toJSON = function () { return { scope: this.scope, code: this.code }; }; module.exports = Code; module.exports.Code = Code; /***/ }, /* 314 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; var Long = __webpack_require__(306); var PARSE_STRING_REGEXP = /^(\+|\-)?(\d+|(\d*\.\d*))?(E|e)?([\-\+])?(\d+)?$/; var PARSE_INF_REGEXP = /^(\+|\-)?(Infinity|inf)$/i; var PARSE_NAN_REGEXP = /^(\+|\-)?NaN$/i; var EXPONENT_MAX = 6111; var EXPONENT_MIN = -6176; var EXPONENT_BIAS = 6176; var MAX_DIGITS = 34; // Nan value bits as 32 bit values (due to lack of longs) var NAN_BUFFER = [0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse(); // Infinity value bits 32 bit values (due to lack of longs) var INF_NEGATIVE_BUFFER = [0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse(); var INF_POSITIVE_BUFFER = [0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].reverse(); var EXPONENT_REGEX = /^([\-\+])?(\d+)?$/; // Detect if the value is a digit var isDigit = function (value) { return !isNaN(parseInt(value, 10)); }; // Divide two uint128 values var divideu128 = function (value) { var DIVISOR = Long.fromNumber(1000 * 1000 * 1000); var _rem = Long.fromNumber(0); var i = 0; if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) { return { quotient: value, rem: _rem }; } for (var i = 0; i <= 3; i++) { // Adjust remainder to match value of next dividend _rem = _rem.shiftLeft(32); // Add the divided to _rem _rem = _rem.add(new Long(value.parts[i], 0)); value.parts[i] = _rem.div(DIVISOR).low_; _rem = _rem.modulo(DIVISOR); } return { quotient: value, rem: _rem }; }; // Multiply two Long values and return the 128 bit value var multiply64x2 = function (left, right) { if (!left && !right) { return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; } var leftHigh = left.shiftRightUnsigned(32); var leftLow = new Long(left.getLowBits(), 0); var rightHigh = right.shiftRightUnsigned(32); var rightLow = new Long(right.getLowBits(), 0); var productHigh = leftHigh.multiply(rightHigh); var productMid = leftHigh.multiply(rightLow); var productMid2 = leftLow.multiply(rightHigh); var productLow = leftLow.multiply(rightLow); productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); productMid = new Long(productMid.getLowBits(), 0).add(productMid2).add(productLow.shiftRightUnsigned(32)); productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); // Return the 128 bit result return { high: productHigh, low: productLow }; }; var lessThan = function (left, right) { // Make values unsigned var uhleft = left.high_ >>> 0; var uhright = right.high_ >>> 0; // Compare high bits first if (uhleft < uhright) { return true; } else if (uhleft == uhright) { var ulleft = left.low_ >>> 0; var ulright = right.low_ >>> 0; if (ulleft < ulright) return true; } return false; }; var longtoHex = function (value) { var buffer = new Buffer(8); var index = 0; // Encode the low 64 bits of the decimal // Encode low bits buffer[index++] = value.low_ & 0xff; buffer[index++] = value.low_ >> 8 & 0xff; buffer[index++] = value.low_ >> 16 & 0xff; buffer[index++] = value.low_ >> 24 & 0xff; // Encode high bits buffer[index++] = value.high_ & 0xff; buffer[index++] = value.high_ >> 8 & 0xff; buffer[index++] = value.high_ >> 16 & 0xff; buffer[index++] = value.high_ >> 24 & 0xff; return buffer.reverse().toString('hex'); }; var int32toHex = function (value) { var buffer = new Buffer(4); var index = 0; // Encode the low 64 bits of the decimal // Encode low bits buffer[index++] = value & 0xff; buffer[index++] = value >> 8 & 0xff; buffer[index++] = value >> 16 & 0xff; buffer[index++] = value >> 24 & 0xff; return buffer.reverse().toString('hex'); }; var Decimal128 = function (bytes) { this._bsontype = 'Decimal128'; this.bytes = bytes; }; Decimal128.fromString = function (string) { // Parse state tracking var isNegative = false; var sawRadix = false; var foundNonZero = false; // Total number of significant digits (no leading or trailing zero) var significantDigits = 0; // Total number of significand digits read var nDigitsRead = 0; // Total number of digits (no leading zeros) var nDigits = 0; // The number of the digits after radix var radixPosition = 0; // The index of the first non-zero in *str* var firstNonZero = 0; // Digits Array var digits = [0]; // The number of digits in digits var nDigitsStored = 0; // Insertion pointer for digits var digitsInsert = 0; // The index of the first non-zero digit var firstDigit = 0; // The index of the last digit var lastDigit = 0; // Exponent var exponent = 0; // loop index over array var i = 0; // The high 17 digits of the significand var significandHigh = [0, 0]; // The low 17 digits of the significand var significandLow = [0, 0]; // The biased exponent var biasedExponent = 0; // Read index var index = 0; // Trim the string string = string.trim(); // Results var stringMatch = string.match(PARSE_STRING_REGEXP); var infMatch = string.match(PARSE_INF_REGEXP); var nanMatch = string.match(PARSE_NAN_REGEXP); // Validate the string if (!stringMatch && !infMatch && !nanMatch || string.length == 0) { throw new Error("" + string + " not a valid Decimal128 string"); } // Check if we have an illegal exponent format if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) { throw new Error("" + string + " not a valid Decimal128 string"); } // Get the negative or positive sign if (string[index] == '+' || string[index] == '-') { isNegative = string[index++] == '-'; } // Check if user passed Infinity or NaN if (!isDigit(string[index]) && string[index] != '.') { if (string[index] == 'i' || string[index] == 'I') { return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); } else if (string[index] == 'N') { return new Decimal128(new Buffer(NAN_BUFFER)); } } // Read all the digits while (isDigit(string[index]) || string[index] == '.') { if (string[index] == '.') { if (sawRadix) { return new Decimal128(new Buffer(NAN_BUFFER)); } sawRadix = true; index = index + 1; continue; } if (nDigitsStored < 34) { if (string[index] != '0' || foundNonZero) { if (!foundNonZero) { firstNonZero = nDigitsRead; } foundNonZero = true; // Only store 34 digits digits[digitsInsert++] = parseInt(string[index], 10); nDigitsStored = nDigitsStored + 1; } } if (foundNonZero) { nDigits = nDigits + 1; } if (sawRadix) { radixPosition = radixPosition + 1; } nDigitsRead = nDigitsRead + 1; index = index + 1; } if (sawRadix && !nDigitsRead) { throw new Error("" + string + " not a valid Decimal128 string"); } // Read exponent if exists if (string[index] == 'e' || string[index] == 'E') { // Read exponent digits var match = string.substr(++index).match(EXPONENT_REGEX); // No digits read if (!match || !match[2]) { return new Decimal128(new Buffer(NAN_BUFFER)); } // Get exponent exponent = parseInt(match[0], 10); // Adjust the index index = index + match[0].length; } // Return not a number if (string[index]) { return new Decimal128(new Buffer(NAN_BUFFER)); } // Done reading input // Find first non-zero digit in digits firstDigit = 0; if (!nDigitsStored) { firstDigit = 0; lastDigit = 0; digits[0] = 0; nDigits = 1; nDigitsStored = 1; significantDigits = 0; } else { lastDigit = nDigitsStored - 1; significantDigits = nDigits; if (exponent != 0 && significantDigits != 1) { while (string[firstNonZero + significantDigits - 1] == '0') { significantDigits = significantDigits - 1; } } } // Normalization of exponent // Correct exponent based on radix position, and shift significand as needed // to represent user input // Overflow prevention if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) { exponent = EXPONENT_MIN; } else { exponent = exponent - radixPosition; } // Attempt to normalize the exponent while (exponent > EXPONENT_MAX) { // Shift exponent to significand and decrease lastDigit = lastDigit + 1; if (lastDigit - firstDigit > MAX_DIGITS) { // Check if we have a zero then just hard clamp, otherwise fail var digitsString = digits.join(''); if (digitsString.match(/^0+$/)) { exponent = EXPONENT_MAX; break; } else { return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); } } exponent = exponent - 1; } while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { // Shift last digit if (lastDigit == 0) { exponent = EXPONENT_MIN; significantDigits = 0; break; } if (nDigitsStored < nDigits) { // adjust to match digits not stored nDigits = nDigits - 1; } else { // adjust to round lastDigit = lastDigit - 1; } if (exponent < EXPONENT_MAX) { exponent = exponent + 1; } else { // Check if we have a zero then just hard clamp, otherwise fail var digitsString = digits.join(''); if (digitsString.match(/^0+$/)) { exponent = EXPONENT_MAX; break; } else { return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); } } } // Round // We've normalized the exponent, but might still need to round. if (lastDigit - firstDigit + 1 < significantDigits && string[significantDigits] != '0') { var endOfString = nDigitsRead; // If we have seen a radix point, 'string' is 1 longer than we have // documented with ndigits_read, so inc the position of the first nonzero // digit and the position that digits are read to. if (sawRadix && exponent == EXPONENT_MIN) { firstNonZero = firstNonZero + 1; endOfString = endOfString + 1; } var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10); var roundBit = 0; if (roundDigit >= 5) { roundBit = 1; if (roundDigit == 5) { roundBit = digits[lastDigit] % 2 == 1; for (var i = firstNonZero + lastDigit + 2; i < endOfString; i++) { if (parseInt(string[i], 10)) { roundBit = 1; break; } } } } if (roundBit) { var dIdx = lastDigit; for (; dIdx >= 0; dIdx--) { if (++digits[dIdx] > 9) { digits[dIdx] = 0; // overflowed most significant digit if (dIdx == 0) { if (exponent < EXPONENT_MAX) { exponent = exponent + 1; digits[dIdx] = 1; } else { return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); } } } else { break; } } } } // Encode significand // The high 17 digits of the significand significandHigh = Long.fromNumber(0); // The low 17 digits of the significand significandLow = Long.fromNumber(0); // read a zero if (significantDigits == 0) { significandHigh = Long.fromNumber(0); significandLow = Long.fromNumber(0); } else if (lastDigit - firstDigit < 17) { var dIdx = firstDigit; significandLow = Long.fromNumber(digits[dIdx++]); significandHigh = new Long(0, 0); for (; dIdx <= lastDigit; dIdx++) { significandLow = significandLow.multiply(Long.fromNumber(10)); significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); } } else { var dIdx = firstDigit; significandHigh = Long.fromNumber(digits[dIdx++]); for (; dIdx <= lastDigit - 17; dIdx++) { significandHigh = significandHigh.multiply(Long.fromNumber(10)); significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx])); } significandLow = Long.fromNumber(digits[dIdx++]); for (; dIdx <= lastDigit; dIdx++) { significandLow = significandLow.multiply(Long.fromNumber(10)); significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); } } var significand = multiply64x2(significandHigh, Long.fromString("100000000000000000")); significand.low = significand.low.add(significandLow); if (lessThan(significand.low, significandLow)) { significand.high = significand.high.add(Long.fromNumber(1)); } // Biased exponent var biasedExponent = exponent + EXPONENT_BIAS; var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) }; // Encode combination, exponent, and significand. if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber)) { // Encode '11' into bits 1 to 3 dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61)); dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47))); dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff))); } else { dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49)); dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff))); } dec.low = significand.low; // Encode sign if (isNegative) { dec.high = dec.high.or(Long.fromString('9223372036854775808')); } // Encode into a buffer var buffer = new Buffer(16); var index = 0; // Encode the low 64 bits of the decimal // Encode low bits buffer[index++] = dec.low.low_ & 0xff; buffer[index++] = dec.low.low_ >> 8 & 0xff; buffer[index++] = dec.low.low_ >> 16 & 0xff; buffer[index++] = dec.low.low_ >> 24 & 0xff; // Encode high bits buffer[index++] = dec.low.high_ & 0xff; buffer[index++] = dec.low.high_ >> 8 & 0xff; buffer[index++] = dec.low.high_ >> 16 & 0xff; buffer[index++] = dec.low.high_ >> 24 & 0xff; // Encode the high 64 bits of the decimal // Encode low bits buffer[index++] = dec.high.low_ & 0xff; buffer[index++] = dec.high.low_ >> 8 & 0xff; buffer[index++] = dec.high.low_ >> 16 & 0xff; buffer[index++] = dec.high.low_ >> 24 & 0xff; // Encode high bits buffer[index++] = dec.high.high_ & 0xff; buffer[index++] = dec.high.high_ >> 8 & 0xff; buffer[index++] = dec.high.high_ >> 16 & 0xff; buffer[index++] = dec.high.high_ >> 24 & 0xff; // Return the new Decimal128 return new Decimal128(buffer); }; // Extract least significant 5 bits var COMBINATION_MASK = 0x1f; // Extract least significant 14 bits var EXPONENT_MASK = 0x3fff; // Value of combination field for Inf var COMBINATION_INFINITY = 30; // Value of combination field for NaN var COMBINATION_NAN = 31; // Value of combination field for NaN var COMBINATION_SNAN = 32; // decimal128 exponent bias var EXPONENT_BIAS = 6176; Decimal128.prototype.toString = function () { // Note: bits in this routine are referred to starting at 0, // from the sign bit, towards the coefficient. // bits 0 - 31 var high; // bits 32 - 63 var midh; // bits 64 - 95 var midl; // bits 96 - 127 var low; // bits 1 - 5 var combination; // decoded biased exponent (14 bits) var biased_exponent; // the number of significand digits var significand_digits = 0; // the base-10 digits in the significand var significand = new Array(36); for (var i = 0; i < significand.length; i++) significand[i] = 0; // read pointer into significand var index = 0; // unbiased exponent var exponent; // the exponent if scientific notation is used var scientific_exponent; // true if the number is zero var is_zero = false; // the most signifcant significand bits (50-46) var significand_msb; // temporary storage for significand decoding var significand128 = { parts: new Array(4) }; // indexing variables var i; var j, k; // Output string var string = []; // Unpack index var index = 0; // Buffer reference var buffer = this.bytes; // Unpack the low 64bits into a long low = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; midl = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Unpack the high 64bits into a long midh = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; high = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Unpack index var index = 0; // Create the state of the decimal var dec = { low: new Long(low, midl), high: new Long(midh, high) }; if (dec.high.lessThan(Long.ZERO)) { string.push('-'); } // Decode combination field and exponent combination = high >> 26 & COMBINATION_MASK; if (combination >> 3 == 3) { // Check for 'special' values if (combination == COMBINATION_INFINITY) { return string.join('') + "Infinity"; } else if (combination == COMBINATION_NAN) { return "NaN"; } else { biased_exponent = high >> 15 & EXPONENT_MASK; significand_msb = 0x08 + (high >> 14 & 0x01); } } else { significand_msb = high >> 14 & 0x07; biased_exponent = high >> 17 & EXPONENT_MASK; } exponent = biased_exponent - EXPONENT_BIAS; // Create string of significand digits // Convert the 114-bit binary number represented by // (significand_high, significand_low) to at most 34 decimal // digits through modulo and division. significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); significand128.parts[1] = midh; significand128.parts[2] = midl; significand128.parts[3] = low; if (significand128.parts[0] == 0 && significand128.parts[1] == 0 && significand128.parts[2] == 0 && significand128.parts[3] == 0) { is_zero = true; } else { for (var k = 3; k >= 0; k--) { var least_digits = 0; // Peform the divide var result = divideu128(significand128); significand128 = result.quotient; least_digits = result.rem.low_; // We now have the 9 least significant digits (in base 2). // Convert and output to string. if (!least_digits) continue; for (var j = 8; j >= 0; j--) { // significand[k * 9 + j] = Math.round(least_digits % 10); significand[k * 9 + j] = least_digits % 10; // least_digits = Math.round(least_digits / 10); least_digits = Math.floor(least_digits / 10); } } } // Output format options: // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd // Regular - ddd.ddd if (is_zero) { significand_digits = 1; significand[index] = 0; } else { significand_digits = 36; var i = 0; while (!significand[index]) { i++; significand_digits = significand_digits - 1; index = index + 1; } } scientific_exponent = significand_digits - 1 + exponent; // The scientific exponent checks are dictated by the string conversion // specification and are somewhat arbitrary cutoffs. // // We must check exponent > 0, because if this is the case, the number // has trailing zeros. However, we *cannot* output these trailing zeros, // because doing so would change the precision of the value, and would // change stored data if the string converted number is round tripped. if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) { // Scientific format string.push(significand[index++]); significand_digits = significand_digits - 1; if (significand_digits) { string.push('.'); } for (var i = 0; i < significand_digits; i++) { string.push(significand[index++]); } // Exponent string.push('E'); if (scientific_exponent > 0) { string.push('+' + scientific_exponent); } else { string.push(scientific_exponent); } } else { // Regular format with no decimal place if (exponent >= 0) { for (var i = 0; i < significand_digits; i++) { string.push(significand[index++]); } } else { var radix_position = significand_digits + exponent; // non-zero digits before radix if (radix_position > 0) { for (var i = 0; i < radix_position; i++) { string.push(significand[index++]); } } else { string.push('0'); } string.push('.'); // add leading zeros after radix while (radix_position++ < 0) { string.push('0'); } for (var i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) { string.push(significand[index++]); } } } return string.join(''); }; Decimal128.prototype.toJSON = function () { return { "$numberDecimal": this.toString() }; }; module.exports = Decimal128; module.exports.Decimal128 = Decimal128; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer)) /***/ }, /* 315 */ /***/ function(module, exports) { /** * A class representation of the BSON MinKey type. * * @class * @return {MinKey} A MinKey instance */ function MinKey() { if (!(this instanceof MinKey)) return new MinKey(); this._bsontype = 'MinKey'; } module.exports = MinKey; module.exports.MinKey = MinKey; /***/ }, /* 316 */ /***/ function(module, exports) { /** * A class representation of the BSON MaxKey type. * * @class * @return {MaxKey} A MaxKey instance */ function MaxKey() { if (!(this instanceof MaxKey)) return new MaxKey(); this._bsontype = 'MaxKey'; } module.exports = MaxKey; module.exports.MaxKey = MaxKey; /***/ }, /* 317 */ /***/ function(module, exports) { /** * A class representation of the BSON DBRef type. * * @class * @param {string} namespace the collection name. * @param {ObjectID} oid the reference ObjectID. * @param {string} [db] optional db name, if omitted the reference is local to the current db. * @return {DBRef} */ function DBRef(namespace, oid, db) { if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db); this._bsontype = 'DBRef'; this.namespace = namespace; this.oid = oid; this.db = db; }; /** * @ignore * @api private */ DBRef.prototype.toJSON = function () { return { '$ref': this.namespace, '$id': this.oid, '$db': this.db == null ? '' : this.db }; }; module.exports = DBRef; module.exports.DBRef = DBRef; /***/ }, /* 318 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module dependencies. * @ignore */ // Test if we're in Node via presence of "global" not absence of "window" // to support hybrid environments like Electron if (typeof global !== 'undefined') { var Buffer = __webpack_require__(300).Buffer; // TODO just use global Buffer } /** * A class representation of the BSON Binary type. * * Sub types * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. * * @class * @param {Buffer} buffer a buffer object containing the binary data. * @param {Number} [subType] the option binary type. * @return {Binary} */ function Binary(buffer, subType) { if (!(this instanceof Binary)) return new Binary(buffer, subType); this._bsontype = 'Binary'; if (buffer instanceof Number) { this.sub_type = buffer; this.position = 0; } else { this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; this.position = 0; } if (buffer != null && !(buffer instanceof Number)) { // Only accept Buffer, Uint8Array or Arrays if (typeof buffer == 'string') { // Different ways of writing the length of the string for the different types if (typeof Buffer != 'undefined') { this.buffer = new Buffer(buffer); } else if (typeof Uint8Array != 'undefined' || Object.prototype.toString.call(buffer) == '[object Array]') { this.buffer = writeStringToArray(buffer); } else { throw new Error("only String, Buffer, Uint8Array or Array accepted"); } } else { this.buffer = buffer; } this.position = buffer.length; } else { if (typeof Buffer != 'undefined') { this.buffer = new Buffer(Binary.BUFFER_SIZE); } else if (typeof Uint8Array != 'undefined') { this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); } else { this.buffer = new Array(Binary.BUFFER_SIZE); } // Set position to start of buffer this.position = 0; } }; /** * Updates this binary with byte_value. * * @method * @param {string} byte_value a single byte we wish to write. */ Binary.prototype.put = function put(byte_value) { // If it's a string and a has more than one character throw an error if (byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array"); if (typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255"); // Decode the byte value once var decoded_byte = null; if (typeof byte_value == 'string') { decoded_byte = byte_value.charCodeAt(0); } else if (byte_value['length'] != null) { decoded_byte = byte_value[0]; } else { decoded_byte = byte_value; } if (this.buffer.length > this.position) { this.buffer[this.position++] = decoded_byte; } else { if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { // Create additional overflow buffer var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); // Combine the two buffers together this.buffer.copy(buffer, 0, 0, this.buffer.length); this.buffer = buffer; this.buffer[this.position++] = decoded_byte; } else { var buffer = null; // Create a new buffer (typed or normal array) if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); } else { buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); } // We need to copy all the content to the new array for (var i = 0; i < this.buffer.length; i++) { buffer[i] = this.buffer[i]; } // Reassign the buffer this.buffer = buffer; // Write the byte this.buffer[this.position++] = decoded_byte; } } }; /** * Writes a buffer or string to the binary. * * @method * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. * @param {number} offset specify the binary of where to write the content. * @return {null} */ Binary.prototype.write = function write(string, offset) { offset = typeof offset == 'number' ? offset : this.position; // If the buffer is to small let's extend the buffer if (this.buffer.length < offset + string.length) { var buffer = null; // If we are in node.js if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { buffer = new Buffer(this.buffer.length + string.length); this.buffer.copy(buffer, 0, 0, this.buffer.length); } else if (Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { // Create a new buffer buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)); // Copy the content for (var i = 0; i < this.position; i++) { buffer[i] = this.buffer[i]; } } // Assign the new buffer this.buffer = buffer; } if (typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { string.copy(this.buffer, offset, 0, string.length); this.position = offset + string.length > this.position ? offset + string.length : this.position; // offset = string.length } else if (typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) { this.buffer.write(string, offset, 'binary'); this.position = offset + string.length > this.position ? offset + string.length : this.position; // offset = string.length; } else if (Object.prototype.toString.call(string) == '[object Uint8Array]' || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') { for (var i = 0; i < string.length; i++) { this.buffer[offset++] = string[i]; } this.position = offset > this.position ? offset : this.position; } else if (typeof string == 'string') { for (var i = 0; i < string.length; i++) { this.buffer[offset++] = string.charCodeAt(i); } this.position = offset > this.position ? offset : this.position; } }; /** * Reads **length** bytes starting at **position**. * * @method * @param {number} position read from the given position in the Binary. * @param {number} length the number of bytes to read. * @return {Buffer} */ Binary.prototype.read = function read(position, length) { length = length && length > 0 ? length : this.position; // Let's return the data based on the type we have if (this.buffer['slice']) { return this.buffer.slice(position, position + length); } else { // Create a buffer to keep the result var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length); for (var i = 0; i < length; i++) { buffer[i] = this.buffer[position++]; } } // Return the buffer return buffer; }; /** * Returns the value of this binary as a string. * * @method * @return {string} */ Binary.prototype.value = function value(asRaw) { asRaw = asRaw == null ? false : asRaw; // Optimize to serialize for the situation where the data == size of buffer if (asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position) return this.buffer; // If it's a node.js buffer object if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); } else { if (asRaw) { // we support the slice command use it if (this.buffer['slice'] != null) { return this.buffer.slice(0, this.position); } else { // Create a new buffer to copy content to var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position); // Copy content for (var i = 0; i < this.position; i++) { newBuffer[i] = this.buffer[i]; } // Return the buffer return newBuffer; } } else { return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); } } }; /** * Length. * * @method * @return {number} the length of the binary. */ Binary.prototype.length = function length() { return this.position; }; /** * @ignore */ Binary.prototype.toJSON = function () { return this.buffer != null ? this.buffer.toString('base64') : ''; }; /** * @ignore */ Binary.prototype.toString = function (format) { return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; }; /** * Binary default subtype * @ignore */ var BSON_BINARY_SUBTYPE_DEFAULT = 0; /** * @ignore */ var writeStringToArray = function (data) { // Create a buffer var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length); // Write the content to the buffer for (var i = 0; i < data.length; i++) { buffer[i] = data.charCodeAt(i); } // Write the string to the buffer return buffer; }; /** * Convert Array ot Uint8Array to Binary String * * @ignore */ var convertArraytoUtf8BinaryString = function (byteArray, startIndex, endIndex) { var result = ""; for (var i = startIndex; i < endIndex; i++) { result = result + String.fromCharCode(byteArray[i]); } return result; }; Binary.BUFFER_SIZE = 256; /** * Default BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_DEFAULT = 0; /** * Function BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_FUNCTION = 1; /** * Byte Array BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_BYTE_ARRAY = 2; /** * OLD UUID BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_UUID_OLD = 3; /** * UUID BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_UUID = 4; /** * MD5 BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_MD5 = 5; /** * User BSON type * * @classconstant SUBTYPE_DEFAULT **/ Binary.SUBTYPE_USER_DEFINED = 128; /** * Expose. */ module.exports = Binary; module.exports.Binary = Binary; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 319 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; var readIEEE754 = __webpack_require__(304).readIEEE754, f = __webpack_require__(320).format, Long = __webpack_require__(306).Long, Double = __webpack_require__(307).Double, Timestamp = __webpack_require__(308).Timestamp, ObjectID = __webpack_require__(309).ObjectID, Symbol = __webpack_require__(311).Symbol, Code = __webpack_require__(313).Code, MinKey = __webpack_require__(315).MinKey, MaxKey = __webpack_require__(316).MaxKey, Decimal128 = __webpack_require__(314), Int32 = __webpack_require__(312), DBRef = __webpack_require__(317).DBRef, BSONRegExp = __webpack_require__(310).BSONRegExp, Binary = __webpack_require__(318).Binary; var deserialize = function (buffer, options, isArray) { options = options == null ? {} : options; var index = options && options.index ? options.index : 0; // Read the document size var size = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; // Ensure buffer is valid size if (size < 5 || buffer.length < size || size + index > buffer.length) { throw new Error("corrupt bson message"); } // Illegal end value if (buffer[index + size - 1] != 0) { throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"); } // Start deserializtion return deserializeObject(buffer, index, options, isArray); }; var deserializeObject = function (buffer, index, options, isArray) { var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; var fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw']; // Return raw bson buffer instead of parsing it var raw = options['raw'] == null ? false : options['raw']; // Return BSONRegExp objects instead of native regular expressions var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false; // Controls the promotion of values vs wrapper classes var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers']; var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; var promoteValues = options['promoteValues'] == null ? true : options['promoteValues']; // Set the start index var startIndex = index; // Validate that we have at least 4 bytes of buffer if (buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); // Read the document size var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Ensure buffer is valid size if (size < 5 || size > buffer.length) throw new Error("corrupt bson message"); // Create holding object var object = isArray ? [] : {}; // Used for arrays to skip having to perform utf8 decoding var arrayIndex = 0; // While we have more left data left keep parsing while (true) { // Read the type var elementType = buffer[index++]; // If we get a zero it's the last byte, exit if (elementType == 0) { break; } // Get the start search index var i = index; // Locate the end of the c string while (buffer[i] !== 0x00 && i < buffer.length) { i++; } // If are at the end of the buffer there is a problem with the document if (i >= buffer.length) throw new Error("Bad BSON Document: illegal CString"); var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i); index = i + 1; if (elementType == BSON.BSON_DATA_STRING) { var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); object[name] = buffer.toString('utf8', index, index + stringSize - 1); index = index + stringSize; } else if (elementType == BSON.BSON_DATA_OID) { var oid = new Buffer(12); buffer.copy(oid, 0, index, index + 12); object[name] = new ObjectID(oid); index = index + 12; } else if (elementType == BSON.BSON_DATA_INT && promoteValues == false) { object[name] = new Int32(buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24); } else if (elementType == BSON.BSON_DATA_INT) { object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; } else if (elementType == BSON.BSON_DATA_NUMBER && promoteValues == false) { object[name] = new Double(buffer.readDoubleLE(index)); index = index + 8; } else if (elementType == BSON.BSON_DATA_NUMBER) { object[name] = buffer.readDoubleLE(index); index = index + 8; } else if (elementType == BSON.BSON_DATA_DATE) { var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; object[name] = new Date(new Long(lowBits, highBits).toNumber()); } else if (elementType == BSON.BSON_DATA_BOOLEAN) { if (buffer[index] != 0 && buffer[index] != 1) throw new Error('illegal boolean type value'); object[name] = buffer[index++] == 1; } else if (elementType == BSON.BSON_DATA_OBJECT) { var _index = index; var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; if (objectSize <= 0 || objectSize > buffer.length - index) throw new Error("bad embedded document length in bson"); // We have a raw value if (raw) { object[name] = buffer.slice(index, index + objectSize); } else { object[name] = deserializeObject(buffer, _index, options, false); } index = index + objectSize; } else if (elementType == BSON.BSON_DATA_ARRAY) { var _index = index; var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; var arrayOptions = options; // Stop index var stopIndex = index + objectSize; // All elements of array to be returned as raw bson if (fieldsAsRaw && fieldsAsRaw[name]) { arrayOptions = {}; for (var n in options) arrayOptions[n] = options[n]; arrayOptions['raw'] = true; } object[name] = deserializeObject(buffer, _index, arrayOptions, true); index = index + objectSize; if (buffer[index - 1] != 0) throw new Error('invalid array terminator byte'); if (index != stopIndex) throw new Error('corrupted array bson'); } else if (elementType == BSON.BSON_DATA_UNDEFINED) { object[name] = undefined; } else if (elementType == BSON.BSON_DATA_NULL) { object[name] = null; } else if (elementType == BSON.BSON_DATA_LONG) { // Unpack the low and high bits var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; var long = new Long(lowBits, highBits); // Promote the long if possible if (promoteLongs && promoteValues == true) { object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; } else { object[name] = long; } } else if (elementType == BSON.BSON_DATA_DECIMAL128) { // Buffer to contain the decimal bytes var bytes = new Buffer(16); // Copy the next 16 bytes into the bytes buffer buffer.copy(bytes, 0, index, index + 16); // Update index index = index + 16; // Assign the new Decimal128 value var decimal128 = new Decimal128(bytes); // If we have an alternative mapper use that object[name] = decimal128.toObject ? decimal128.toObject() : decimal128; } else if (elementType == BSON.BSON_DATA_BINARY) { var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; var totalBinarySize = binarySize; var subType = buffer[index++]; // Did we have a negative binary size, throw if (binarySize < 0) throw new Error('Negative binary type element size found'); // Is the length longer than the document if (binarySize > buffer.length) throw new Error('Binary type size larger than document size'); // Decode as raw Buffer object if options specifies it if (buffer['slice'] != null) { // If we have subtype 2 skip the 4 bytes for the size if (subType == Binary.SUBTYPE_BYTE_ARRAY) { binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02'); if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size'); if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size'); } if (promoteBuffers && promoteValues) { object[name] = buffer.slice(index, index + binarySize); } else { object[name] = new Binary(buffer.slice(index, index + binarySize), subType); } } else { var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); // If we have subtype 2 skip the 4 bytes for the size if (subType == Binary.SUBTYPE_BYTE_ARRAY) { binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; if (binarySize < 0) throw new Error('Negative binary type element size found for subtype 0x02'); if (binarySize > totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to long binary size'); if (binarySize < totalBinarySize - 4) throw new Error('Binary type with subtype 0x02 contains to short binary size'); } // Copy the data for (var i = 0; i < binarySize; i++) { _buffer[i] = buffer[index + i]; } if (promoteBuffers && promoteValues) { object[name] = _buffer; } else { object[name] = new Binary(_buffer, subType); } } // Update the index index = index + binarySize; } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) { // Get the start search index var i = index; // Locate the end of the c string while (buffer[i] !== 0x00 && i < buffer.length) { i++; } // If are at the end of the buffer there is a problem with the document if (i >= buffer.length) throw new Error("Bad BSON Document: illegal CString"); // Return the C string var source = buffer.toString('utf8', index, i); // Create the regexp index = i + 1; // Get the start search index var i = index; // Locate the end of the c string while (buffer[i] !== 0x00 && i < buffer.length) { i++; } // If are at the end of the buffer there is a problem with the document if (i >= buffer.length) throw new Error("Bad BSON Document: illegal CString"); // Return the C string var regExpOptions = buffer.toString('utf8', index, i); index = i + 1; // For each option add the corresponding one for javascript var optionsArray = new Array(regExpOptions.length); // Parse options for (var i = 0; i < regExpOptions.length; i++) { switch (regExpOptions[i]) { case 'm': optionsArray[i] = 'm'; break; case 's': optionsArray[i] = 'g'; break; case 'i': optionsArray[i] = 'i'; break; } } object[name] = new RegExp(source, optionsArray.join('')); } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) { // Get the start search index var i = index; // Locate the end of the c string while (buffer[i] !== 0x00 && i < buffer.length) { i++; } // If are at the end of the buffer there is a problem with the document if (i >= buffer.length) throw new Error("Bad BSON Document: illegal CString"); // Return the C string var source = buffer.toString('utf8', index, i); index = i + 1; // Get the start search index var i = index; // Locate the end of the c string while (buffer[i] !== 0x00 && i < buffer.length) { i++; } // If are at the end of the buffer there is a problem with the document if (i >= buffer.length) throw new Error("Bad BSON Document: illegal CString"); // Return the C string var regExpOptions = buffer.toString('utf8', index, i); index = i + 1; // Set the object object[name] = new BSONRegExp(source, regExpOptions); } else if (elementType == BSON.BSON_DATA_SYMBOL) { var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); index = index + stringSize; } else if (elementType == BSON.BSON_DATA_TIMESTAMP) { var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; object[name] = new Timestamp(lowBits, highBits); } else if (elementType == BSON.BSON_DATA_MIN_KEY) { object[name] = new MinKey(); } else if (elementType == BSON.BSON_DATA_MAX_KEY) { object[name] = new MaxKey(); } else if (elementType == BSON.BSON_DATA_CODE) { var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); var functionString = buffer.toString('utf8', index, index + stringSize - 1); // If we are evaluating the functions if (evalFunctions) { var value = null; // If we have cache enabled let's look for the md5 of the function in the cache if (cacheFunctions) { var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; // Got to do this to avoid V8 deoptimizing the call due to finding eval object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); } else { object[name] = isolateEval(functionString); } } else { object[name] = new Code(functionString); } // Update parse index position index = index + stringSize; } else if (elementType == BSON.BSON_DATA_CODE_W_SCOPE) { var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Element cannot be shorter than totalSize + stringSize + documentSize + terminator if (totalSize < 4 + 4 + 4 + 1) { throw new Error("code_w_scope total size shorter minimum expected length"); } // Get the code string size var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Check if we have a valid string if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); // Javascript function var functionString = buffer.toString('utf8', index, index + stringSize - 1); // Update parse index position index = index + stringSize; // Parse the element var _index = index; // Decode the size of the object document var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; // Decode the scope object var scopeObject = deserializeObject(buffer, _index, options, false); // Adjust the index index = index + objectSize; // Check if field length is to short if (totalSize < 4 + 4 + objectSize + stringSize) { throw new Error('code_w_scope total size is to short, truncating scope'); } // Check if totalSize field is to long if (totalSize > 4 + 4 + objectSize + stringSize) { throw new Error('code_w_scope total size is to long, clips outer document'); } // If we are evaluating the functions if (evalFunctions) { // Contains the value we are going to set var value = null; // If we have cache enabled let's look for the md5 of the function in the cache if (cacheFunctions) { var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; // Got to do this to avoid V8 deoptimizing the call due to finding eval object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); } else { object[name] = isolateEval(functionString); } object[name].scope = scopeObject; } else { object[name] = new Code(functionString, scopeObject); } } else if (elementType == BSON.BSON_DATA_DBPOINTER) { // Get the code string size var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; // Check if we have a valid string if (stringSize <= 0 || stringSize > buffer.length - index || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); // Namespace var namespace = buffer.toString('utf8', index, index + stringSize - 1); // Update parse index position index = index + stringSize; // Read the oid var oidBuffer = new Buffer(12); buffer.copy(oidBuffer, 0, index, index + 12); var oid = new ObjectID(oidBuffer); // Update the index index = index + 12; // Split the namespace var parts = namespace.split('.'); var db = parts.shift(); var collection = parts.join('.'); // Upgrade to DBRef type object[name] = new DBRef(collection, oid, db); } else { throw new Error("Detected unknown BSON type " + elementType.toString(16) + " for fieldname \"" + name + "\", are you using the latest BSON parser"); } } // Check if the deserialization was against a valid array/object if (size != index - startIndex) { if (isArray) throw new Error('corrupt array bson'); throw new Error('corrupt object bson'); } // Check if we have a db ref object if (object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); return object; }; /** * Ensure eval is isolated. * * @ignore * @api private */ var isolateEvalWithHash = function (functionCache, hash, functionString, object) { // Contains the value we are going to set var value = null; // Check for cache hit, eval if missing and return cached function if (functionCache[hash] == null) { eval("value = " + functionString); functionCache[hash] = value; } // Set the object return functionCache[hash].bind(object); }; /** * Ensure eval is isolated. * * @ignore * @api private */ var isolateEval = function (functionString) { // Contains the value we are going to set var value = null; // Eval the function eval("value = " + functionString); return value; }; var BSON = {}; /** * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 * * @ignore * @api private */ var functionCache = BSON.functionCache = {}; /** * Number BSON Type * * @classconstant BSON_DATA_NUMBER **/ BSON.BSON_DATA_NUMBER = 1; /** * String BSON Type * * @classconstant BSON_DATA_STRING **/ BSON.BSON_DATA_STRING = 2; /** * Object BSON Type * * @classconstant BSON_DATA_OBJECT **/ BSON.BSON_DATA_OBJECT = 3; /** * Array BSON Type * * @classconstant BSON_DATA_ARRAY **/ BSON.BSON_DATA_ARRAY = 4; /** * Binary BSON Type * * @classconstant BSON_DATA_BINARY **/ BSON.BSON_DATA_BINARY = 5; /** * Binary BSON Type * * @classconstant BSON_DATA_UNDEFINED **/ BSON.BSON_DATA_UNDEFINED = 6; /** * ObjectID BSON Type * * @classconstant BSON_DATA_OID **/ BSON.BSON_DATA_OID = 7; /** * Boolean BSON Type * * @classconstant BSON_DATA_BOOLEAN **/ BSON.BSON_DATA_BOOLEAN = 8; /** * Date BSON Type * * @classconstant BSON_DATA_DATE **/ BSON.BSON_DATA_DATE = 9; /** * null BSON Type * * @classconstant BSON_DATA_NULL **/ BSON.BSON_DATA_NULL = 10; /** * RegExp BSON Type * * @classconstant BSON_DATA_REGEXP **/ BSON.BSON_DATA_REGEXP = 11; /** * Code BSON Type * * @classconstant BSON_DATA_DBPOINTER **/ BSON.BSON_DATA_DBPOINTER = 12; /** * Code BSON Type * * @classconstant BSON_DATA_CODE **/ BSON.BSON_DATA_CODE = 13; /** * Symbol BSON Type * * @classconstant BSON_DATA_SYMBOL **/ BSON.BSON_DATA_SYMBOL = 14; /** * Code with Scope BSON Type * * @classconstant BSON_DATA_CODE_W_SCOPE **/ BSON.BSON_DATA_CODE_W_SCOPE = 15; /** * 32 bit Integer BSON Type * * @classconstant BSON_DATA_INT **/ BSON.BSON_DATA_INT = 16; /** * Timestamp BSON Type * * @classconstant BSON_DATA_TIMESTAMP **/ BSON.BSON_DATA_TIMESTAMP = 17; /** * Long BSON Type * * @classconstant BSON_DATA_LONG **/ BSON.BSON_DATA_LONG = 18; /** * Long BSON Type * * @classconstant BSON_DATA_DECIMAL128 **/ BSON.BSON_DATA_DECIMAL128 = 19; /** * MinKey BSON Type * * @classconstant BSON_DATA_MIN_KEY **/ BSON.BSON_DATA_MIN_KEY = 0xff; /** * MaxKey BSON Type * * @classconstant BSON_DATA_MAX_KEY **/ BSON.BSON_DATA_MAX_KEY = 0x7f; /** * Binary Default Type * * @classconstant BSON_BINARY_SUBTYPE_DEFAULT **/ BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; /** * Binary Function Type * * @classconstant BSON_BINARY_SUBTYPE_FUNCTION **/ BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; /** * Binary Byte Array Type * * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY **/ BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; /** * Binary UUID Type * * @classconstant BSON_BINARY_SUBTYPE_UUID **/ BSON.BSON_BINARY_SUBTYPE_UUID = 3; /** * Binary MD5 Type * * @classconstant BSON_BINARY_SUBTYPE_MD5 **/ BSON.BSON_BINARY_SUBTYPE_MD5 = 4; /** * Binary User Defined Type * * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED **/ BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; // BSON MAX VALUES BSON.BSON_INT32_MAX = 0x7FFFFFFF; BSON.BSON_INT32_MIN = -0x80000000; BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; BSON.BSON_INT64_MIN = -Math.pow(2, 63); // JS MAX PRECISE VALUES BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. // Internal long versions var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. module.exports = deserialize; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer)) /***/ }, /* 320 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var formatRegExp = /%[sdj%]/g; exports.format = function(f) { if (!isString(f)) { var objects = []; for (var i = 0; i < arguments.length; i++) { objects.push(inspect(arguments[i])); } return objects.join(' '); } var i = 1; var args = arguments; var len = args.length; var str = String(f).replace(formatRegExp, function(x) { if (x === '%%') return '%'; if (i >= len) return x; switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); case '%j': try { return JSON.stringify(args[i++]); } catch (_) { return '[Circular]'; } default: return x; } }); for (var x = args[i]; i < len; x = args[++i]) { if (isNull(x) || !isObject(x)) { str += ' ' + x; } else { str += ' ' + inspect(x); } } return str; }; // Mark that a method should not be used. // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. exports.deprecate = function(fn, msg) { // Allow for deprecating things in the process of starting up. if (isUndefined(global.process)) { return function() { return exports.deprecate(fn, msg).apply(this, arguments); }; } if (process.noDeprecation === true) { return fn; } var warned = false; function deprecated() { if (!warned) { if (process.throwDeprecation) { throw new Error(msg); } else if (process.traceDeprecation) { console.trace(msg); } else { console.error(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; }; var debugs = {}; var debugEnviron; exports.debuglog = function(set) { if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { var pid = process.pid; debugs[set] = function() { var msg = exports.format.apply(exports, arguments); console.error('%s %d: %s', set, pid, msg); }; } else { debugs[set] = function() {}; } } return debugs[set]; }; /** * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Object} opts Optional options object that alters the output. */ /* legacy: obj, showHidden, depth, colors*/ function inspect(obj, opts) { // default options var ctx = { seen: [], stylize: stylizeNoColor }; // legacy... if (arguments.length >= 3) ctx.depth = arguments[2]; if (arguments.length >= 4) ctx.colors = arguments[3]; if (isBoolean(opts)) { // legacy... ctx.showHidden = opts; } else if (opts) { // got an "options" object exports._extend(ctx, opts); } // set default options if (isUndefined(ctx.showHidden)) ctx.showHidden = false; if (isUndefined(ctx.depth)) ctx.depth = 2; if (isUndefined(ctx.colors)) ctx.colors = false; if (isUndefined(ctx.customInspect)) ctx.customInspect = true; if (ctx.colors) ctx.stylize = stylizeWithColor; return formatValue(ctx, obj, ctx.depth); } exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics inspect.colors = { 'bold' : [1, 22], 'italic' : [3, 23], 'underline' : [4, 24], 'inverse' : [7, 27], 'white' : [37, 39], 'grey' : [90, 39], 'black' : [30, 39], 'blue' : [34, 39], 'cyan' : [36, 39], 'green' : [32, 39], 'magenta' : [35, 39], 'red' : [31, 39], 'yellow' : [33, 39] }; // Don't use 'blue' not visible on cmd.exe inspect.styles = { 'special': 'cyan', 'number': 'yellow', 'boolean': 'yellow', 'undefined': 'grey', 'null': 'bold', 'string': 'green', 'date': 'magenta', // "name": intentionally not styling 'regexp': 'red' }; function stylizeWithColor(str, styleType) { var style = inspect.styles[styleType]; if (style) { return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm'; } else { return str; } } function stylizeNoColor(str, styleType) { return str; } function arrayToHash(array) { var hash = {}; array.forEach(function(val, idx) { hash[val] = true; }); return hash; } function formatValue(ctx, value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes, ctx); if (!isString(ret)) { ret = formatValue(ctx, ret, recurseTimes); } return ret; } // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } // Look up the keys of the object. var keys = Object.keys(value); var visibleKeys = arrayToHash(keys); if (ctx.showHidden) { keys = Object.getOwnPropertyNames(value); } // IE doesn't make error fields non-enumerable // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { return formatError(value); } // Some type of object without properties can be shortcutted. if (keys.length === 0) { if (isFunction(value)) { var name = value.name ? ': ' + value.name : ''; return ctx.stylize('[Function' + name + ']', 'special'); } if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } if (isDate(value)) { return ctx.stylize(Date.prototype.toString.call(value), 'date'); } if (isError(value)) { return formatError(value); } } var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array if (isArray(value)) { array = true; braces = ['[', ']']; } // Make functions say that they are functions if (isFunction(value)) { var n = value.name ? ': ' + value.name : ''; base = ' [Function' + n + ']'; } // Make RegExps say that they are RegExps if (isRegExp(value)) { base = ' ' + RegExp.prototype.toString.call(value); } // Make dates with properties first say the date if (isDate(value)) { base = ' ' + Date.prototype.toUTCString.call(value); } // Make error with message first say the error if (isError(value)) { base = ' ' + formatError(value); } if (keys.length === 0 && (!array || value.length == 0)) { return braces[0] + base + braces[1]; } if (recurseTimes < 0) { if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { return ctx.stylize('[Object]', 'special'); } } ctx.seen.push(value); var output; if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { output = keys.map(function(key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); }); } ctx.seen.pop(); return reduceToSingleString(output, base, braces); } function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); if (isString(value)) { var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; return ctx.stylize(simple, 'string'); } if (isNumber(value)) return ctx.stylize('' + value, 'number'); if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here. if (isNull(value)) return ctx.stylize('null', 'null'); } function formatError(value) { return '[' + Error.prototype.toString.call(value) + ']'; } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { var output = []; for (var i = 0, l = value.length; i < l; ++i) { if (hasOwnProperty(value, String(i))) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); } else { output.push(''); } } keys.forEach(function(key) { if (!key.match(/^\d+$/)) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } }); return output; } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str, desc; desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; if (desc.get) { if (desc.set) { str = ctx.stylize('[Getter/Setter]', 'special'); } else { str = ctx.stylize('[Getter]', 'special'); } } else { if (desc.set) { str = ctx.stylize('[Setter]', 'special'); } } if (!hasOwnProperty(visibleKeys, key)) { name = '[' + key + ']'; } if (!str) { if (ctx.seen.indexOf(desc.value) < 0) { if (isNull(recurseTimes)) { str = formatValue(ctx, desc.value, null); } else { str = formatValue(ctx, desc.value, recurseTimes - 1); } if (str.indexOf('\n') > -1) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; }).join('\n'); } } } else { str = ctx.stylize('[Circular]', 'special'); } } if (isUndefined(name)) { if (array && key.match(/^\d+$/)) { return str; } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'"); name = ctx.stylize(name, 'string'); } } return name + ': ' + str; } function reduceToSingleString(output, base, braces) { var numLinesEst = 0; var length = output.reduce(function(prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; }, 0); if (length > 60) { return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; } return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray(ar) { return Array.isArray(ar); } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return isObject(re) && objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return isObject(d) && objectToString(d) === '[object Date]'; } exports.isDate = isDate; function isError(e) { return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = __webpack_require__(321); function objectToString(o) { return Object.prototype.toString.call(o); } function pad(n) { return n < 10 ? '0' + n.toString(10) : n.toString(10); } var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34 function timestamp() { var d = new Date(); var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':'); return [d.getDate(), months[d.getMonth()], time].join(' '); } // log is just a thin wrapper to console.log that prepends a timestamp exports.log = function() { console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; /** * Inherit the prototype methods from one constructor into another. * * The Function.prototype.inherits from lang.js rewritten as a standalone * function (not on Function.prototype). NOTE: If this file is to be loaded * during bootstrapping this function needs to be rewritten using some native * functions as prototype setup using normal JavaScript does not work as * expected during bootstrapping (see mirror.js in r114903). * * @param {function} ctor Constructor function which needs to inherit the * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ exports.inherits = __webpack_require__(322); exports._extend = function(origin, add) { // Don't do anything if add isn't an object if (!add || !isObject(add)) return origin; var keys = Object.keys(add); var i = keys.length; while (i--) { origin[keys[i]] = add[keys[i]]; } return origin; }; function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(294))) /***/ }, /* 321 */ /***/ function(module, exports) { module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } /***/ }, /* 322 */ /***/ function(module, exports) { 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 } } /***/ }, /* 323 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; var writeIEEE754 = __webpack_require__(304).writeIEEE754, readIEEE754 = __webpack_require__(304).readIEEE754, Long = __webpack_require__(306).Long, Map = __webpack_require__(305), Double = __webpack_require__(307).Double, Timestamp = __webpack_require__(308).Timestamp, ObjectID = __webpack_require__(309).ObjectID, Symbol = __webpack_require__(311).Symbol, Code = __webpack_require__(313).Code, BSONRegExp = __webpack_require__(310).BSONRegExp, Int32 = __webpack_require__(312).Int32, MinKey = __webpack_require__(315).MinKey, MaxKey = __webpack_require__(316).MaxKey, Decimal128 = __webpack_require__(314), DBRef = __webpack_require__(317).DBRef, Binary = __webpack_require__(318).Binary; try { var _Buffer = Uint8Array; } catch (e) { var _Buffer = Buffer; } var regexp = /\x00/; // To ensure that 0.4 of node works correctly var isDate = function isDate(d) { return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; }; var isRegExp = function isRegExp(d) { return Object.prototype.toString.call(d) === '[object RegExp]'; }; var serializeString = function (buffer, key, value, index, isArray) { // Encode String type buffer[index++] = BSON.BSON_DATA_STRING; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes + 1; buffer[index - 1] = 0; // Write the string var size = buffer.write(value, index + 4, 'utf8'); // Write the size of the string to buffer buffer[index + 3] = size + 1 >> 24 & 0xff; buffer[index + 2] = size + 1 >> 16 & 0xff; buffer[index + 1] = size + 1 >> 8 & 0xff; buffer[index] = size + 1 & 0xff; // Update index index = index + 4 + size; // Write zero buffer[index++] = 0; return index; }; var serializeNumber = function (buffer, key, value, index, isArray) { // We have an integer value if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { // If the value fits in 32 bits encode as int, if it fits in a double // encode it as a double, otherwise long if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // Set int type 32 bits or less buffer[index++] = BSON.BSON_DATA_INT; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the int value buffer[index++] = value & 0xff; buffer[index++] = value >> 8 & 0xff; buffer[index++] = value >> 16 & 0xff; buffer[index++] = value >> 24 & 0xff; } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { // Encode as double buffer[index++] = BSON.BSON_DATA_NUMBER; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write float writeIEEE754(buffer, value, index, 'little', 52, 8); // Ajust index index = index + 8; } else { // Set long type buffer[index++] = BSON.BSON_DATA_LONG; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; var longVal = Long.fromNumber(value); var lowBits = longVal.getLowBits(); var highBits = longVal.getHighBits(); // Encode low bits buffer[index++] = lowBits & 0xff; buffer[index++] = lowBits >> 8 & 0xff; buffer[index++] = lowBits >> 16 & 0xff; buffer[index++] = lowBits >> 24 & 0xff; // Encode high bits buffer[index++] = highBits & 0xff; buffer[index++] = highBits >> 8 & 0xff; buffer[index++] = highBits >> 16 & 0xff; buffer[index++] = highBits >> 24 & 0xff; } } else { // Encode as double buffer[index++] = BSON.BSON_DATA_NUMBER; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write float writeIEEE754(buffer, value, index, 'little', 52, 8); // Ajust index index = index + 8; } return index; }; var serializeUndefined = function (buffer, key, value, index, isArray) { // Set long type buffer[index++] = BSON.BSON_DATA_UNDEFINED; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; return index; }; var serializeNull = function (buffer, key, value, index, isArray) { // Set long type buffer[index++] = BSON.BSON_DATA_NULL; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; return index; }; var serializeBoolean = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_BOOLEAN; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Encode the boolean value buffer[index++] = value ? 1 : 0; return index; }; var serializeDate = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_DATE; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the date var dateInMilis = Long.fromNumber(value.getTime()); var lowBits = dateInMilis.getLowBits(); var highBits = dateInMilis.getHighBits(); // Encode low bits buffer[index++] = lowBits & 0xff; buffer[index++] = lowBits >> 8 & 0xff; buffer[index++] = lowBits >> 16 & 0xff; buffer[index++] = lowBits >> 24 & 0xff; // Encode high bits buffer[index++] = highBits & 0xff; buffer[index++] = highBits >> 8 & 0xff; buffer[index++] = highBits >> 16 & 0xff; buffer[index++] = highBits >> 24 & 0xff; return index; }; var serializeRegExp = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_REGEXP; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; if (value.source && value.source.match(regexp) != null) { throw Error("value " + value.source + " must not contain null bytes"); } // Adjust the index index = index + buffer.write(value.source, index, 'utf8'); // Write zero buffer[index++] = 0x00; // Write the parameters if (value.global) buffer[index++] = 0x73; // s if (value.ignoreCase) buffer[index++] = 0x69; // i if (value.multiline) buffer[index++] = 0x6d; // m // Add ending zero buffer[index++] = 0x00; return index; }; var serializeBSONRegExp = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_REGEXP; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Check the pattern for 0 bytes if (value.pattern.match(regexp) != null) { // The BSON spec doesn't allow keys with null bytes because keys are // null-terminated. throw Error("pattern " + value.pattern + " must not contain null bytes"); } // Adjust the index index = index + buffer.write(value.pattern, index, 'utf8'); // Write zero buffer[index++] = 0x00; // Write the options index = index + buffer.write(value.options.split('').sort().join(''), index, 'utf8'); // Add ending zero buffer[index++] = 0x00; return index; }; var serializeMinMax = function (buffer, key, value, index, isArray) { // Write the type of either min or max key if (value === null) { buffer[index++] = BSON.BSON_DATA_NULL; } else if (value instanceof MinKey) { buffer[index++] = BSON.BSON_DATA_MIN_KEY; } else { buffer[index++] = BSON.BSON_DATA_MAX_KEY; } // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; return index; }; var serializeObjectId = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_OID; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the objectId into the shared buffer if (typeof value.id == 'string') { buffer.write(value.id, index, 'binary'); } else if (value.id && value.id.copy) { value.id.copy(buffer, index, 0, 12); } else { throw new Error('object [' + JSON.stringify(value) + "] is not a valid ObjectId"); } // Ajust index return index + 12; }; var serializeBuffer = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_BINARY; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Get size of the buffer (current write point) var size = value.length; // Write the size of the string to buffer buffer[index++] = size & 0xff; buffer[index++] = size >> 8 & 0xff; buffer[index++] = size >> 16 & 0xff; buffer[index++] = size >> 24 & 0xff; // Write the default subtype buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; // Copy the content form the binary field to the buffer value.copy(buffer, index, 0, size); // Adjust the index index = index + size; return index; }; var serializeObject = function (buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray, path) { for (var i = 0; i < path.length; i++) { if (path[i] === value) throw new Error('cyclic dependency detected'); } // Push value to stack path.push(value); // Write the type buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path); // Pop stack path.pop(); // Write size var size = endIndex - index; return endIndex; }; var serializeDecimal128 = function (buffer, key, value, index, isArray) { buffer[index++] = BSON.BSON_DATA_DECIMAL128; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the data from the value value.bytes.copy(buffer, index, 0, 16); return index + 16; }; var serializeLong = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = value._bsontype == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the date var lowBits = value.getLowBits(); var highBits = value.getHighBits(); // Encode low bits buffer[index++] = lowBits & 0xff; buffer[index++] = lowBits >> 8 & 0xff; buffer[index++] = lowBits >> 16 & 0xff; buffer[index++] = lowBits >> 24 & 0xff; // Encode high bits buffer[index++] = highBits & 0xff; buffer[index++] = highBits >> 8 & 0xff; buffer[index++] = highBits >> 16 & 0xff; buffer[index++] = highBits >> 24 & 0xff; return index; }; var serializeInt32 = function (buffer, key, value, index, isArray) { // Set int type 32 bits or less buffer[index++] = BSON.BSON_DATA_INT; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the int value buffer[index++] = value & 0xff; buffer[index++] = value >> 8 & 0xff; buffer[index++] = value >> 16 & 0xff; buffer[index++] = value >> 24 & 0xff; return index; }; var serializeDouble = function (buffer, key, value, index, isArray) { // Encode as double buffer[index++] = BSON.BSON_DATA_NUMBER; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write float writeIEEE754(buffer, value, index, 'little', 52, 8); // Ajust index index = index + 8; return index; }; var serializeFunction = function (buffer, key, value, index, checkKeys, depth, isArray) { buffer[index++] = BSON.BSON_DATA_CODE; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Function string var functionString = value.toString(); // Write the string var size = buffer.write(functionString, index + 4, 'utf8') + 1; // Write the size of the string to buffer buffer[index] = size & 0xff; buffer[index + 1] = size >> 8 & 0xff; buffer[index + 2] = size >> 16 & 0xff; buffer[index + 3] = size >> 24 & 0xff; // Update index index = index + 4 + size - 1; // Write zero buffer[index++] = 0; return index; }; var serializeCode = function (buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, isArray) { if (value.scope && typeof value.scope == 'object') { // Write the type buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Starting index var startIndex = index; // Serialize the function // Get the function string var functionString = typeof value.code == 'string' ? value.code : value.code.toString(); // Index adjustment index = index + 4; // Write string into buffer var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; // Write the size of the string to buffer buffer[index] = codeSize & 0xff; buffer[index + 1] = codeSize >> 8 & 0xff; buffer[index + 2] = codeSize >> 16 & 0xff; buffer[index + 3] = codeSize >> 24 & 0xff; // Write end 0 buffer[index + 4 + codeSize - 1] = 0; // Write the index = index + codeSize + 4; // // Serialize the scope value var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined); index = endIndex - 1; // Writ the total var totalSize = endIndex - startIndex; // Write the total size of the object buffer[startIndex++] = totalSize & 0xff; buffer[startIndex++] = totalSize >> 8 & 0xff; buffer[startIndex++] = totalSize >> 16 & 0xff; buffer[startIndex++] = totalSize >> 24 & 0xff; // Write trailing zero buffer[index++] = 0; } else { buffer[index++] = BSON.BSON_DATA_CODE; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Function string var functionString = value.code.toString(); // Write the string var size = buffer.write(functionString, index + 4, 'utf8') + 1; // Write the size of the string to buffer buffer[index] = size & 0xff; buffer[index + 1] = size >> 8 & 0xff; buffer[index + 2] = size >> 16 & 0xff; buffer[index + 3] = size >> 24 & 0xff; // Update index index = index + 4 + size - 1; // Write zero buffer[index++] = 0; } return index; }; var serializeBinary = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_BINARY; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Extract the buffer var data = value.value(true); // Calculate size var size = value.position; // Add the deprecated 02 type 4 bytes of size to total if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4; // Write the size of the string to buffer buffer[index++] = size & 0xff; buffer[index++] = size >> 8 & 0xff; buffer[index++] = size >> 16 & 0xff; buffer[index++] = size >> 24 & 0xff; // Write the subtype to the buffer buffer[index++] = value.sub_type; // If we have binary type 2 the 4 first bytes are the size if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { size = size - 4; buffer[index++] = size & 0xff; buffer[index++] = size >> 8 & 0xff; buffer[index++] = size >> 16 & 0xff; buffer[index++] = size >> 24 & 0xff; } // Write the data to the object data.copy(buffer, index, 0, value.position); // Adjust the index index = index + value.position; return index; }; var serializeSymbol = function (buffer, key, value, index, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_SYMBOL; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; // Write the string var size = buffer.write(value.value, index + 4, 'utf8') + 1; // Write the size of the string to buffer buffer[index] = size & 0xff; buffer[index + 1] = size >> 8 & 0xff; buffer[index + 2] = size >> 16 & 0xff; buffer[index + 3] = size >> 24 & 0xff; // Update index index = index + 4 + size - 1; // Write zero buffer[index++] = 0x00; return index; }; var serializeDBRef = function (buffer, key, value, index, depth, serializeFunctions, isArray) { // Write the type buffer[index++] = BSON.BSON_DATA_OBJECT; // Number of written bytes var numberOfWrittenBytes = !isArray ? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii'); // Encode the name index = index + numberOfWrittenBytes; buffer[index++] = 0; var startIndex = index; var endIndex; // Serialize object if (null != value.db) { endIndex = serializeInto(buffer, { '$ref': value.namespace, '$id': value.oid, '$db': value.db }, false, index, depth + 1, serializeFunctions); } else { endIndex = serializeInto(buffer, { '$ref': value.namespace, '$id': value.oid }, false, index, depth + 1, serializeFunctions); } // Calculate object size var size = endIndex - startIndex; // Write the size buffer[startIndex++] = size & 0xff; buffer[startIndex++] = size >> 8 & 0xff; buffer[startIndex++] = size >> 16 & 0xff; buffer[startIndex++] = size >> 24 & 0xff; // Set index return endIndex; }; var serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) { startingIndex = startingIndex || 0; path = path || []; // Push the object to the path path.push(object); // Start place to serialize into var index = startingIndex + 4; var self = this; // Special case isArray if (Array.isArray(object)) { // Get object keys for (var i = 0; i < object.length; i++) { var key = "" + i; var value = object[i]; // Is there an override value if (value && value.toBSON) { if (typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); value = value.toBSON(); } var type = typeof value; if (type == 'string') { index = serializeString(buffer, key, value, index, true); } else if (type == 'number') { index = serializeNumber(buffer, key, value, index, true); } else if (type == 'boolean') { index = serializeBoolean(buffer, key, value, index, true); } else if (value instanceof Date || isDate(value)) { index = serializeDate(buffer, key, value, index, true); } else if (value === undefined) { index = serializeNull(buffer, key, value, index, true); } else if (value === null) { index = serializeNull(buffer, key, value, index, true); } else if (value['_bsontype'] == 'ObjectID') { index = serializeObjectId(buffer, key, value, index, true); } else if (Buffer.isBuffer(value)) { index = serializeBuffer(buffer, key, value, index, true); } else if (value instanceof RegExp || isRegExp(value)) { index = serializeRegExp(buffer, key, value, index, true); } else if (type == 'object' && value['_bsontype'] == null) { index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true, path); } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { index = serializeDecimal128(buffer, key, value, index, true); } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { index = serializeLong(buffer, key, value, index, true); } else if (value['_bsontype'] == 'Double') { index = serializeDouble(buffer, key, value, index, true); } else if (typeof value == 'function' && serializeFunctions) { index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions, true); } else if (value['_bsontype'] == 'Code') { index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, true); } else if (value['_bsontype'] == 'Binary') { index = serializeBinary(buffer, key, value, index, true); } else if (value['_bsontype'] == 'Symbol') { index = serializeSymbol(buffer, key, value, index, true); } else if (value['_bsontype'] == 'DBRef') { index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true); } else if (value['_bsontype'] == 'BSONRegExp') { index = serializeBSONRegExp(buffer, key, value, index, true); } else if (value['_bsontype'] == 'Int32') { index = serializeInt32(buffer, key, value, index, true); } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { index = serializeMinMax(buffer, key, value, index, true); } } } else if (object instanceof Map) { var iterator = object.entries(); var done = false; while (!done) { // Unpack the next entry var entry = iterator.next(); done = entry.done; // Are we done, then skip and terminate if (done) continue; // Get the entry values var key = entry.value[0]; var value = entry.value[1]; // Check the type of the value var type = typeof value; // Check the key and throw error if it's illegal if (key != '$db' && key != '$ref' && key != '$id') { if (key.match(regexp) != null) { // The BSON spec doesn't allow keys with null bytes because keys are // null-terminated. throw Error("key " + key + " must not contain null bytes"); } if (checkKeys) { if ('$' == key[0]) { throw Error("key " + key + " must not start with '$'"); } else if (!!~key.indexOf('.')) { throw Error("key " + key + " must not contain '.'"); } } } if (type == 'string') { index = serializeString(buffer, key, value, index); } else if (type == 'number') { index = serializeNumber(buffer, key, value, index); } else if (type == 'boolean') { index = serializeBoolean(buffer, key, value, index); } else if (value instanceof Date || isDate(value)) { index = serializeDate(buffer, key, value, index); } else if (value === undefined && ignoreUndefined == true) {} else if (value === undefined) { index = serializeUndefined(buffer, key, value, index); } else if (value === null) { index = serializeNull(buffer, key, value, index); } else if (value['_bsontype'] == 'ObjectID') { index = serializeObjectId(buffer, key, value, index); } else if (Buffer.isBuffer(value)) { index = serializeBuffer(buffer, key, value, index); } else if (value instanceof RegExp || isRegExp(value)) { index = serializeRegExp(buffer, key, value, index); } else if (type == 'object' && value['_bsontype'] == null) { index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path); } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { index = serializeDecimal128(buffer, key, value, index); } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { index = serializeLong(buffer, key, value, index); } else if (value['_bsontype'] == 'Double') { index = serializeDouble(buffer, key, value, index); } else if (value['_bsontype'] == 'Code') { index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); } else if (typeof value == 'function' && serializeFunctions) { index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); } else if (value['_bsontype'] == 'Binary') { index = serializeBinary(buffer, key, value, index); } else if (value['_bsontype'] == 'Symbol') { index = serializeSymbol(buffer, key, value, index); } else if (value['_bsontype'] == 'DBRef') { index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); } else if (value['_bsontype'] == 'BSONRegExp') { index = serializeBSONRegExp(buffer, key, value, index); } else if (value['_bsontype'] == 'Int32') { index = serializeInt32(buffer, key, value, index); } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { index = serializeMinMax(buffer, key, value, index); } } } else { // Did we provide a custom serialization method if (object.toBSON) { if (typeof object.toBSON != 'function') throw new Error("toBSON is not a function"); object = object.toBSON(); if (object != null && typeof object != 'object') throw new Error("toBSON function did not return an object"); } // Iterate over all the keys for (var key in object) { var value = object[key]; // Is there an override value if (value && value.toBSON) { if (typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); value = value.toBSON(); } // Check the type of the value var type = typeof value; // Check the key and throw error if it's illegal if (key != '$db' && key != '$ref' && key != '$id') { if (key.match(regexp) != null) { // The BSON spec doesn't allow keys with null bytes because keys are // null-terminated. throw Error("key " + key + " must not contain null bytes"); } if (checkKeys) { if ('$' == key[0]) { throw Error("key " + key + " must not start with '$'"); } else if (!!~key.indexOf('.')) { throw Error("key " + key + " must not contain '.'"); } } } if (type == 'string') { index = serializeString(buffer, key, value, index); } else if (type == 'number') { index = serializeNumber(buffer, key, value, index); } else if (type == 'boolean') { index = serializeBoolean(buffer, key, value, index); } else if (value instanceof Date || isDate(value)) { index = serializeDate(buffer, key, value, index); } else if (value === undefined && ignoreUndefined == true) {} else if (value === undefined) { index = serializeUndefined(buffer, key, value, index); } else if (value === null) { index = serializeNull(buffer, key, value, index); } else if (value['_bsontype'] == 'ObjectID') { index = serializeObjectId(buffer, key, value, index); } else if (Buffer.isBuffer(value)) { index = serializeBuffer(buffer, key, value, index); } else if (value instanceof RegExp || isRegExp(value)) { index = serializeRegExp(buffer, key, value, index); } else if (type == 'object' && value['_bsontype'] == null) { index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, false, path); } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { index = serializeDecimal128(buffer, key, value, index); } else if (value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { index = serializeLong(buffer, key, value, index); } else if (value['_bsontype'] == 'Double') { index = serializeDouble(buffer, key, value, index); } else if (value['_bsontype'] == 'Code') { index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); } else if (typeof value == 'function' && serializeFunctions) { index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); } else if (value['_bsontype'] == 'Binary') { index = serializeBinary(buffer, key, value, index); } else if (value['_bsontype'] == 'Symbol') { index = serializeSymbol(buffer, key, value, index); } else if (value['_bsontype'] == 'DBRef') { index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); } else if (value['_bsontype'] == 'BSONRegExp') { index = serializeBSONRegExp(buffer, key, value, index); } else if (value['_bsontype'] == 'Int32') { index = serializeInt32(buffer, key, value, index); } else if (value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { index = serializeMinMax(buffer, key, value, index); } } } // Remove the path path.pop(); // Final padding byte for object buffer[index++] = 0x00; // Final size var size = index - startingIndex; // Write the size of the object buffer[startingIndex++] = size & 0xff; buffer[startingIndex++] = size >> 8 & 0xff; buffer[startingIndex++] = size >> 16 & 0xff; buffer[startingIndex++] = size >> 24 & 0xff; return index; }; var BSON = {}; /** * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 * * @ignore * @api private */ var functionCache = BSON.functionCache = {}; /** * Number BSON Type * * @classconstant BSON_DATA_NUMBER **/ BSON.BSON_DATA_NUMBER = 1; /** * String BSON Type * * @classconstant BSON_DATA_STRING **/ BSON.BSON_DATA_STRING = 2; /** * Object BSON Type * * @classconstant BSON_DATA_OBJECT **/ BSON.BSON_DATA_OBJECT = 3; /** * Array BSON Type * * @classconstant BSON_DATA_ARRAY **/ BSON.BSON_DATA_ARRAY = 4; /** * Binary BSON Type * * @classconstant BSON_DATA_BINARY **/ BSON.BSON_DATA_BINARY = 5; /** * ObjectID BSON Type, deprecated * * @classconstant BSON_DATA_UNDEFINED **/ BSON.BSON_DATA_UNDEFINED = 6; /** * ObjectID BSON Type * * @classconstant BSON_DATA_OID **/ BSON.BSON_DATA_OID = 7; /** * Boolean BSON Type * * @classconstant BSON_DATA_BOOLEAN **/ BSON.BSON_DATA_BOOLEAN = 8; /** * Date BSON Type * * @classconstant BSON_DATA_DATE **/ BSON.BSON_DATA_DATE = 9; /** * null BSON Type * * @classconstant BSON_DATA_NULL **/ BSON.BSON_DATA_NULL = 10; /** * RegExp BSON Type * * @classconstant BSON_DATA_REGEXP **/ BSON.BSON_DATA_REGEXP = 11; /** * Code BSON Type * * @classconstant BSON_DATA_CODE **/ BSON.BSON_DATA_CODE = 13; /** * Symbol BSON Type * * @classconstant BSON_DATA_SYMBOL **/ BSON.BSON_DATA_SYMBOL = 14; /** * Code with Scope BSON Type * * @classconstant BSON_DATA_CODE_W_SCOPE **/ BSON.BSON_DATA_CODE_W_SCOPE = 15; /** * 32 bit Integer BSON Type * * @classconstant BSON_DATA_INT **/ BSON.BSON_DATA_INT = 16; /** * Timestamp BSON Type * * @classconstant BSON_DATA_TIMESTAMP **/ BSON.BSON_DATA_TIMESTAMP = 17; /** * Long BSON Type * * @classconstant BSON_DATA_LONG **/ BSON.BSON_DATA_LONG = 18; /** * Long BSON Type * * @classconstant BSON_DATA_DECIMAL128 **/ BSON.BSON_DATA_DECIMAL128 = 19; /** * MinKey BSON Type * * @classconstant BSON_DATA_MIN_KEY **/ BSON.BSON_DATA_MIN_KEY = 0xff; /** * MaxKey BSON Type * * @classconstant BSON_DATA_MAX_KEY **/ BSON.BSON_DATA_MAX_KEY = 0x7f; /** * Binary Default Type * * @classconstant BSON_BINARY_SUBTYPE_DEFAULT **/ BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; /** * Binary Function Type * * @classconstant BSON_BINARY_SUBTYPE_FUNCTION **/ BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; /** * Binary Byte Array Type * * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY **/ BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; /** * Binary UUID Type * * @classconstant BSON_BINARY_SUBTYPE_UUID **/ BSON.BSON_BINARY_SUBTYPE_UUID = 3; /** * Binary MD5 Type * * @classconstant BSON_BINARY_SUBTYPE_MD5 **/ BSON.BSON_BINARY_SUBTYPE_MD5 = 4; /** * Binary User Defined Type * * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED **/ BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; // BSON MAX VALUES BSON.BSON_INT32_MAX = 0x7FFFFFFF; BSON.BSON_INT32_MIN = -0x80000000; BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; BSON.BSON_INT64_MIN = -Math.pow(2, 63); // JS MAX PRECISE VALUES BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. // Internal long versions var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. module.exports = serializeInto; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer)) /***/ }, /* 324 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; var writeIEEE754 = __webpack_require__(304).writeIEEE754, readIEEE754 = __webpack_require__(304).readIEEE754, Long = __webpack_require__(306).Long, Double = __webpack_require__(307).Double, Timestamp = __webpack_require__(308).Timestamp, ObjectID = __webpack_require__(309).ObjectID, Symbol = __webpack_require__(311).Symbol, BSONRegExp = __webpack_require__(310).BSONRegExp, Code = __webpack_require__(313).Code, Decimal128 = __webpack_require__(314), MinKey = __webpack_require__(315).MinKey, MaxKey = __webpack_require__(316).MaxKey, DBRef = __webpack_require__(317).DBRef, Binary = __webpack_require__(318).Binary; // To ensure that 0.4 of node works correctly var isDate = function isDate(d) { return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; }; var calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) { var totalLength = 4 + 1; if (Array.isArray(object)) { for (var i = 0; i < object.length; i++) { totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined); } } else { // If we have toBSON defined, override the current object if (object.toBSON) { object = object.toBSON(); } // Calculate size for (var key in object) { totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined); } } return totalLength; }; /** * @ignore * @api private */ function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) { // If we have toBSON defined, override the current object if (value && value.toBSON) { value = value.toBSON(); } switch (typeof value) { case 'string': return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; case 'number': if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (4 + 1); } else { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); } } else { // 64 bit return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); } case 'undefined': if (isArray || !ignoreUndefined) return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; return 0; case 'boolean': return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 1); case 'object': if (value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; } else if (value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1); } else if (value instanceof Date || isDate(value)) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 4 + 1) + value.length; } else if (value instanceof Long || value instanceof Double || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); } else if (value instanceof Decimal128 || value['_bsontype'] == 'Decimal128') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (16 + 1); } else if (value instanceof Code || value['_bsontype'] == 'Code') { // Calculate size depending on the availability of a scope if (value.scope != null && Object.keys(value.scope).length > 0) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); } else { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1; } } else if (value instanceof Binary || value['_bsontype'] == 'Binary') { // Check what kind of subtype we have if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1 + 4); } else { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1); } } else if (value instanceof Symbol || value['_bsontype'] == 'Symbol') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1; } else if (value instanceof DBRef || value['_bsontype'] == 'DBRef') { // Set up correct object for serialization var ordered_values = { '$ref': value.namespace, '$id': value.oid }; // Add db reference if it exists if (null != value.db) { ordered_values['$db'] = value.db; } return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined); } else if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1; } else if (value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1 + Buffer.byteLength(value.options, 'utf8') + 1; } else { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1; } case 'function': // WTF for 0.4.X where typeof /someregexp/ === 'function' if (value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1; } else { if (serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); } else if (serializeFunctions) { return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1; } } } return 0; } var BSON = {}; // BSON MAX VALUES BSON.BSON_INT32_MAX = 0x7FFFFFFF; BSON.BSON_INT32_MIN = -0x80000000; // JS MAX PRECISE VALUES BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. module.exports = calculateObjectSize; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(300).Buffer)) /***/ } /******/ ]) }); ;
app/routes.js
BestBuyAPIs/bestbuy-sdk-js-sample-app
import React from 'react'; import {Route} from 'react-router'; import App from './components/App'; import Home from './components/Home'; export default ( <Route handler={App}> <Route path='/' handler={Home}/> <Route path='favicon.ico'/> </Route> );
src/packages/recompose/__tests__/renameProp-test.js
acdlite/recompose
import React from 'react' import { mount } from 'enzyme' import { withProps, renameProp, compose } from '../' test('renameProp renames a single prop', () => { const StringConcat = compose( withProps({ 'data-so': 123, 'data-la': 456 }), renameProp('data-so', 'data-do') )('div') expect(StringConcat.displayName).toBe('withProps(renameProp(div))') const div = mount(<StringConcat />).find('div') expect(div.props()).toEqual({ 'data-do': 123, 'data-la': 456 }) })
src/index.js
salmonax/photobucket-exercise
import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/App'; ReactDOM.render(<App />, document.getElementById('app'));
ajax/libs/rxjs/2.2.25/rx.all.compat.js
joseluisq/cdnjs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. ;(function (undefined) { var objectTypes = { 'boolean': false, 'function': true, 'object': true, 'number': false, 'string': false, 'undefined': false }; var root = (objectTypes[typeof window] && window) || this, freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, freeModule = objectTypes[typeof module] && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports && freeExports, freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { root = freeGlobal; } var Rx = { internals: {}, config: { Promise: root.Promise // Detect if promise exists }, helpers: { } }; // Defaults var noop = Rx.helpers.noop = function () { }, identity = Rx.helpers.identity = function (x) { return x; }, defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()), defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, defaultError = Rx.helpers.defaultError = function (err) { throw err; }, isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; }, asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); }, not = Rx.helpers.not = function (a) { return !a; }; // Errors var sequenceContainsNoElements = 'Sequence contains no elements.'; var argumentOutOfRange = 'Argument out of range'; var objectDisposed = 'Object has been disposed'; function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } // Shim in iterator support var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || '_es6shim_iterator_'; // Firefox ships a partial implementation using the name @@iterator. // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 // So use that name if we detect it. if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { $iterator$ = '@@iterator'; } var doneEnumerator = { done: true, value: undefined }; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4 suportNodeClass, errorProto = Error.prototype, objectProto = Object.prototype, propertyIsEnumerable = objectProto.propertyIsEnumerable; try { suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); } catch(e) { suportNodeClass = true; } var shadowedProps = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; var nonEnumProps = {}; nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; nonEnumProps[objectClass] = { 'constructor': true }; var support = {}; (function () { var ctor = function() { this.x = 1; }, props = []; ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } for (key in arguments) { } // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); // Detect if `prototype` properties are enumerable by default. support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); // Detect if `arguments` object indexes are non-enumerable support.nonEnumArgs = key != 0; // Detect if properties shadowing those on `Object.prototype` are non-enumerable. support.nonEnumShadows = !/valueOf/.test(props); }(1)); function isObject(value) { // check if the value is the ECMAScript language type of Object // http://es5.github.io/#x8 // and avoid a V8 bug // https://code.google.com/p/v8/issues/detail?id=2291 var type = typeof value; return value && (type == 'function' || type == 'object') || false; } function keysIn(object) { var result = []; if (!isObject(object)) { return result; } if (support.nonEnumArgs && object.length && isArguments(object)) { object = slice.call(object); } var skipProto = support.enumPrototypes && typeof object == 'function', skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { var ctor = object.constructor, index = -1, length = shadowedProps.length; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className]; } while (++index < length) { key = shadowedProps[index]; if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { result.push(key); } } } return result; } function internalFor(object, callback, keysFunc) { var index = -1, props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (callback(object[key], key, object) === false) { break; } } return object; } function internalForIn(object, callback) { return internalFor(object, callback, keysIn); } function isNode(value) { // IE < 9 presents DOM nodes as `Object` objects except they have `toString` // methods that are `typeof` "string" and still can coerce nodes to strings return typeof value.toString != 'function' && typeof (value + '') == 'string'; } function isArguments(value) { return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; } // fallback for browsers that can't detect `arguments` objects by [[Class]] if (!supportsArgsClass) { isArguments = function(value) { return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; }; } function isFunction(value) { return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { isFunction = function(value) { return typeof value == 'function' && toString.call(value) == funcClass; }; } var isEqual = Rx.internals.isEqual = function (x, y) { return deepEquals(x, y, [], []); }; /** @private * Used for deep comparison **/ function deepEquals(a, b, stackA, stackB) { // exit early for identical values if (a === b) { // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } var type = typeof a, otherType = typeof b; // exit early for unlike primitive values if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { return false; } // compare [[Class]] names var className = toString.call(a), otherClass = toString.call(b); if (className == argsClass) { className = objectClass; } if (otherClass == argsClass) { otherClass = objectClass; } if (className != otherClass) { return false; } switch (className) { case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: // treat `NaN` vs. `NaN` as equal return (a != +a) ? b != +b // but treat `-0` vs. `+0` as not equal : (a == 0 ? (1 / a == 1 / b) : a == +b); case regexpClass: case stringClass: // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // treat string primitives and their corresponding object instances as equal return a == String(b); } var isArr = className == arrayClass; if (!isArr) { // exit for functions and DOM nodes if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b) ) { return false; } } // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == a) { return stackB[length] == b; } } var size = 0; result = true; // add `a` and `b` to the stack of traversed objects stackA.push(a); stackB.push(b); // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary length = a.length; size = b.length; result = size == length; if (result) { // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (!(result = deepEquals(a[size], value, stackA, stackB))) { break; } } } } else { // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly internalForIn(b, function(value, key, b) { if (hasOwnProperty.call(b, key)) { // count the number of properties. size++; // deep compare each property value. return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); } }); if (result) { // ensure both objects have the same number of properties internalForIn(a, function(value, key, a) { if (hasOwnProperty.call(a, key)) { // `size` will be `-1` if `a` has more properties than `b` return (result = --size > -1); } }); } } stackA.pop(); stackB.pop(); return result; } var slice = Array.prototype.slice; function argsOrArray(args, idx) { return args.length === 1 && Array.isArray(args[idx]) ? args[idx] : slice.call(args); } var hasProp = {}.hasOwnProperty; /** @private */ var inherits = this.inherits = Rx.internals.inherits = function (child, parent) { function __() { this.constructor = child; } __.prototype = parent.prototype; child.prototype = new __(); }; /** @private */ var addProperties = Rx.internals.addProperties = function (obj) { var sources = slice.call(arguments, 1); for (var i = 0, len = sources.length; i < len; i++) { var source = sources[i]; for (var prop in source) { obj[prop] = source[prop]; } } }; // Rx Utils var addRef = Rx.internals.addRef = function (xs, r) { return new AnonymousObservable(function (observer) { return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); }); }; // Collection polyfills function arrayInitialize(count, factory) { var a = new Array(count); for (var i = 0; i < count; i++) { a[i] = factory(); } return a; } // Utilities if (!Function.prototype.bind) { Function.prototype.bind = function (that) { var target = this, args = slice.call(arguments, 1); var bound = function () { if (this instanceof bound) { function F() { } F.prototype = target.prototype; var self = new F(); var result = target.apply(self, args.concat(slice.call(arguments))); if (Object(result) === result) { return result; } return self; } else { return target.apply(that, args.concat(slice.call(arguments))); } }; return bound; }; } var boxedString = Object("a"), splitString = boxedString[0] != "a" || !(0 in boxedString); if (!Array.prototype.every) { Array.prototype.every = function every(fun /*, thisp */) { var object = Object(this), self = splitString && {}.toString.call(this) == stringClass ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; if ({}.toString.call(fun) != funcClass) { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && !fun.call(thisp, self[i], i, object)) { return false; } } return true; }; } if (!Array.prototype.map) { Array.prototype.map = function map(fun /*, thisp*/) { var object = Object(this), self = splitString && {}.toString.call(this) == stringClass ? this.split("") : object, length = self.length >>> 0, result = Array(length), thisp = arguments[1]; if ({}.toString.call(fun) != funcClass) { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) result[i] = fun.call(thisp, self[i], i, object); } return result; }; } if (!Array.prototype.filter) { Array.prototype.filter = function (predicate) { var results = [], item, t = new Object(this); for (var i = 0, len = t.length >>> 0; i < len; i++) { item = t[i]; if (i in t && predicate.call(arguments[1], item, i, t)) { results.push(item); } } return results; }; } if (!Array.isArray) { Array.isArray = function (arg) { return Object.prototype.toString.call(arg) == arrayClass; }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function indexOf(searchElement) { var t = Object(this); var len = t.length >>> 0; if (len === 0) { return -1; } var n = 0; if (arguments.length > 1) { n = Number(arguments[1]); if (n !== n) { n = 0; } else if (n !== 0 && n != Infinity && n !== -Infinity) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } if (n >= len) { return -1; } var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) { return k; } } return -1; }; } // Collections var IndexedItem = function (id, value) { this.id = id; this.value = value; }; IndexedItem.prototype.compareTo = function (other) { var c = this.value.compareTo(other.value); if (c === 0) { c = this.id - other.id; } return c; }; // Priority Queue for Scheduling var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) { this.items = new Array(capacity); this.length = 0; }; var priorityProto = PriorityQueue.prototype; priorityProto.isHigherPriority = function (left, right) { return this.items[left].compareTo(this.items[right]) < 0; }; priorityProto.percolate = function (index) { if (index >= this.length || index < 0) { return; } var parent = index - 1 >> 1; if (parent < 0 || parent === index) { return; } if (this.isHigherPriority(index, parent)) { var temp = this.items[index]; this.items[index] = this.items[parent]; this.items[parent] = temp; this.percolate(parent); } }; priorityProto.heapify = function (index) { if (index === undefined) { index = 0; } if (index >= this.length || index < 0) { return; } var left = 2 * index + 1, right = 2 * index + 2, first = index; if (left < this.length && this.isHigherPriority(left, first)) { first = left; } if (right < this.length && this.isHigherPriority(right, first)) { first = right; } if (first !== index) { var temp = this.items[index]; this.items[index] = this.items[first]; this.items[first] = temp; this.heapify(first); } }; priorityProto.peek = function () { return this.items[0].value; }; priorityProto.removeAt = function (index) { this.items[index] = this.items[--this.length]; delete this.items[this.length]; this.heapify(); }; priorityProto.dequeue = function () { var result = this.peek(); this.removeAt(0); return result; }; priorityProto.enqueue = function (item) { var index = this.length++; this.items[index] = new IndexedItem(PriorityQueue.count++, item); this.percolate(index); }; priorityProto.remove = function (item) { for (var i = 0; i < this.length; i++) { if (this.items[i].value === item) { this.removeAt(i); return true; } } return false; }; PriorityQueue.count = 0; /** * Represents a group of disposable resources that are disposed together. * @constructor */ var CompositeDisposable = Rx.CompositeDisposable = function () { this.disposables = argsOrArray(arguments, 0); this.isDisposed = false; this.length = this.disposables.length; }; var CompositeDisposablePrototype = CompositeDisposable.prototype; /** * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. * @param {Mixed} item Disposable to add. */ CompositeDisposablePrototype.add = function (item) { if (this.isDisposed) { item.dispose(); } else { this.disposables.push(item); this.length++; } }; /** * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. * @param {Mixed} item Disposable to remove. * @returns {Boolean} true if found; false otherwise. */ CompositeDisposablePrototype.remove = function (item) { var shouldDispose = false; if (!this.isDisposed) { var idx = this.disposables.indexOf(item); if (idx !== -1) { shouldDispose = true; this.disposables.splice(idx, 1); this.length--; item.dispose(); } } return shouldDispose; }; /** * Disposes all disposables in the group and removes them from the group. */ CompositeDisposablePrototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var currentDisposables = this.disposables.slice(0); this.disposables = []; this.length = 0; for (var i = 0, len = currentDisposables.length; i < len; i++) { currentDisposables[i].dispose(); } } }; /** * Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable. */ CompositeDisposablePrototype.clear = function () { var currentDisposables = this.disposables.slice(0); this.disposables = []; this.length = 0; for (var i = 0, len = currentDisposables.length; i < len; i++) { currentDisposables[i].dispose(); } }; /** * Determines whether the CompositeDisposable contains a specific disposable. * @param {Mixed} item Disposable to search for. * @returns {Boolean} true if the disposable was found; otherwise, false. */ CompositeDisposablePrototype.contains = function (item) { return this.disposables.indexOf(item) !== -1; }; /** * Converts the existing CompositeDisposable to an array of disposables * @returns {Array} An array of disposable objects. */ CompositeDisposablePrototype.toArray = function () { return this.disposables.slice(0); }; /** * Provides a set of static methods for creating Disposables. * * @constructor * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. */ var Disposable = Rx.Disposable = function (action) { this.isDisposed = false; this.action = action || noop; }; /** Performs the task of cleaning up resources. */ Disposable.prototype.dispose = function () { if (!this.isDisposed) { this.action(); this.isDisposed = true; } }; /** * Creates a disposable object that invokes the specified action when disposed. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. * @return {Disposable} The disposable object that runs the given action upon disposal. */ var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; /** * Gets the disposable that does nothing when disposed. */ var disposableEmpty = Disposable.empty = { dispose: noop }; var BooleanDisposable = (function () { function BooleanDisposable (isSingle) { this.isSingle = isSingle; this.isDisposed = false; this.current = null; } var booleanDisposablePrototype = BooleanDisposable.prototype; /** * Gets the underlying disposable. * @return The underlying disposable. */ booleanDisposablePrototype.getDisposable = function () { return this.current; }; /** * Sets the underlying disposable. * @param {Disposable} value The new underlying disposable. */ booleanDisposablePrototype.setDisposable = function (value) { if (this.current && this.isSingle) { throw new Error('Disposable has already been assigned'); } var shouldDispose = this.isDisposed, old; if (!shouldDispose) { old = this.current; this.current = value; } if (old) { old.dispose(); } if (shouldDispose && value) { value.dispose(); } }; /** * Disposes the underlying disposable as well as all future replacements. */ booleanDisposablePrototype.dispose = function () { var old; if (!this.isDisposed) { this.isDisposed = true; old = this.current; this.current = null; } if (old) { old.dispose(); } }; return BooleanDisposable; }()); /** * Represents a disposable resource which only allows a single assignment of its underlying disposable resource. * If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error. */ var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) { inherits(SingleAssignmentDisposable, super_); function SingleAssignmentDisposable() { super_.call(this, true); } return SingleAssignmentDisposable; }(BooleanDisposable)); /** * Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource. */ var SerialDisposable = Rx.SerialDisposable = (function (super_) { inherits(SerialDisposable, super_); function SerialDisposable() { super_.call(this, false); } return SerialDisposable; }(BooleanDisposable)); /** * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. */ var RefCountDisposable = Rx.RefCountDisposable = (function () { function InnerDisposable(disposable) { this.disposable = disposable; this.disposable.count++; this.isInnerDisposed = false; } InnerDisposable.prototype.dispose = function () { if (!this.disposable.isDisposed) { if (!this.isInnerDisposed) { this.isInnerDisposed = true; this.disposable.count--; if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { this.disposable.isDisposed = true; this.disposable.underlyingDisposable.dispose(); } } } }; /** * Initializes a new instance of the RefCountDisposable with the specified disposable. * @constructor * @param {Disposable} disposable Underlying disposable. */ function RefCountDisposable(disposable) { this.underlyingDisposable = disposable; this.isDisposed = false; this.isPrimaryDisposed = false; this.count = 0; } /** * Disposes the underlying disposable only when all dependent disposables have been disposed */ RefCountDisposable.prototype.dispose = function () { if (!this.isDisposed) { if (!this.isPrimaryDisposed) { this.isPrimaryDisposed = true; if (this.count === 0) { this.isDisposed = true; this.underlyingDisposable.dispose(); } } } }; /** * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. */ RefCountDisposable.prototype.getDisposable = function () { return this.isDisposed ? disposableEmpty : new InnerDisposable(this); }; return RefCountDisposable; })(); function ScheduledDisposable(scheduler, disposable) { this.scheduler = scheduler; this.disposable = disposable; this.isDisposed = false; } ScheduledDisposable.prototype.dispose = function () { var parent = this; this.scheduler.schedule(function () { if (!parent.isDisposed) { parent.isDisposed = true; parent.disposable.dispose(); } }); }; var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { this.scheduler = scheduler; this.state = state; this.action = action; this.dueTime = dueTime; this.comparer = comparer || defaultSubComparer; this.disposable = new SingleAssignmentDisposable(); } ScheduledItem.prototype.invoke = function () { this.disposable.setDisposable(this.invokeCore()); }; ScheduledItem.prototype.compareTo = function (other) { return this.comparer(this.dueTime, other.dueTime); }; ScheduledItem.prototype.isCancelled = function () { return this.disposable.isDisposed; }; ScheduledItem.prototype.invokeCore = function () { return this.action(this.scheduler, this.state); }; /** Provides a set of static properties to access commonly used schedulers. */ var Scheduler = Rx.Scheduler = (function () { /** * @constructor * @private */ function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { this.now = now; this._schedule = schedule; this._scheduleRelative = scheduleRelative; this._scheduleAbsolute = scheduleAbsolute; } function invokeRecImmediate(scheduler, pair) { var state = pair.first, action = pair.second, group = new CompositeDisposable(), recursiveAction = function (state1) { action(state1, function (state2) { var isAdded = false, isDone = false, d = scheduler.scheduleWithState(state2, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); }; recursiveAction(state); return group; } function invokeRecDate(scheduler, pair, method) { var state = pair.first, action = pair.second, group = new CompositeDisposable(), recursiveAction = function (state1) { action(state1, function (state2, dueTime1) { var isAdded = false, isDone = false, d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); }; recursiveAction(state); return group; } function invokeAction(scheduler, action) { action(); return disposableEmpty; } var schedulerProto = Scheduler.prototype; /** * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions. * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false. * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling. */ schedulerProto.catchException = schedulerProto['catch'] = function (handler) { return new CatchScheduler(this, handler); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ schedulerProto.schedulePeriodic = function (period, action) { return this.schedulePeriodicWithState(null, period, function () { action(); }); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ schedulerProto.schedulePeriodicWithState = function (state, period, action) { var s = state, id = setInterval(function () { s = action(s); }, period); return disposableCreate(function () { clearInterval(id); }); }; /** * Schedules an action to be executed. * @param {Function} action Action to execute. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.schedule = function (action) { return this._schedule(action, invokeAction); }; /** * Schedules an action to be executed. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithState = function (state, action) { return this._schedule(state, action); }; /** * Schedules an action to be executed after the specified relative due time. * @param {Function} action Action to execute. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelative = function (dueTime, action) { return this._scheduleRelative(action, dueTime, invokeAction); }; /** * Schedules an action to be executed after dueTime. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative(state, dueTime, action); }; /** * Schedules an action to be executed at the specified absolute due time. * @param {Function} action Action to execute. * @param {Number} dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsolute = function (dueTime, action) { return this._scheduleAbsolute(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number}dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute(state, dueTime, action); }; /** * Schedules an action to be executed recursively. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursive = function (action) { return this.scheduleRecursiveWithState(action, function (_action, self) { _action(function () { self(_action); }); }); }; /** * Schedules an action to be executed recursively. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithState = function (state, action) { return this.scheduleWithState({ first: state, second: action }, function (s, p) { return invokeRecImmediate(s, p); }); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) { return this.scheduleRecursiveWithRelativeAndState(action, dueTime, function (_action, self) { _action(function (dt) { self(_action, dt); }); }); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); }); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) { return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, function (_action, self) { _action(function (dt) { self(_action, dt); }); }); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); }); }; /** Gets the current time according to the local machine's system clock. */ Scheduler.now = defaultNow; /** * Normalizes the specified TimeSpan value to a positive value. * @param {Number} timeSpan The time span value to normalize. * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 */ Scheduler.normalize = function (timeSpan) { if (timeSpan < 0) { timeSpan = 0; } return timeSpan; }; return Scheduler; }()); var normalizeTime = Scheduler.normalize; var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { function tick(command, recurse) { recurse(0, this._period); try { this._state = this._action(this._state); } catch (e) { this._cancel.dispose(); throw e; } } function SchedulePeriodicRecursive(scheduler, state, period, action) { this._scheduler = scheduler; this._state = state; this._period = period; this._action = action; } SchedulePeriodicRecursive.prototype.start = function () { var d = new SingleAssignmentDisposable(); this._cancel = d; d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); return d; }; return SchedulePeriodicRecursive; }()); /** * Gets a scheduler that schedules work immediately on the current thread. */ var immediateScheduler = Scheduler.immediate = (function () { function scheduleNow(state, action) { return action(this, state); } function scheduleRelative(state, dueTime, action) { var dt = normalizeTime(dt); while (dt - this.now() > 0) { } return action(this, state); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); }()); /** * Gets a scheduler that schedules work as soon as possible on the current thread. */ var currentThreadScheduler = Scheduler.currentThread = (function () { var queue; function runTrampoline (q) { var item; while (q.length > 0) { item = q.dequeue(); if (!item.isCancelled()) { // Note, do not schedule blocking work! while (item.dueTime - Scheduler.now() > 0) { } if (!item.isCancelled()) { item.invoke(); } } } } function scheduleNow(state, action) { return this.scheduleWithRelativeAndState(state, 0, action); } function scheduleRelative(state, dueTime, action) { var dt = this.now() + Scheduler.normalize(dueTime), si = new ScheduledItem(this, state, action, dt), t; if (!queue) { queue = new PriorityQueue(4); queue.enqueue(si); try { runTrampoline(queue); } catch (e) { throw e; } finally { queue = null; } } else { queue.enqueue(si); } return si.disposable; } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); currentScheduler.scheduleRequired = function () { return queue === null; }; currentScheduler.ensureTrampoline = function (action) { if (queue === null) { return this.schedule(action); } else { return action(); } }; return currentScheduler; }()); var scheduleMethod, clearMethod = noop; (function () { var reNative = RegExp('^' + String(toString) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/toString| for [^\]]+/g, '.*?') + '$' ); var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate, clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' && !reNative.test(clearImmediate) && clearImmediate; function postMessageSupported () { // Ensure not in a worker if (!root.postMessage || root.importScripts) { return false; } var isAsync = false, oldHandler = root.onmessage; // Test for async root.onmessage = function () { isAsync = true; }; root.postMessage('','*'); root.onmessage = oldHandler; return isAsync; } // Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleMethod = process.nextTick; } else if (typeof setImmediate === 'function') { scheduleMethod = setImmediate; clearMethod = clearImmediate; } else if (postMessageSupported()) { var MSG_PREFIX = 'ms.rx.schedule' + Math.random(), tasks = {}, taskId = 0; function onGlobalPostMessage(event) { // Only if we're a match to avoid any other global events if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { var handleId = event.data.substring(MSG_PREFIX.length), action = tasks[handleId]; action(); delete tasks[handleId]; } } if (root.addEventListener) { root.addEventListener('message', onGlobalPostMessage, false); } else { root.attachEvent('onmessage', onGlobalPostMessage, false); } scheduleMethod = function (action) { var currentId = taskId++; tasks[currentId] = action; root.postMessage(MSG_PREFIX + currentId, '*'); }; } else if (!!root.MessageChannel) { var channel = new root.MessageChannel(), channelTasks = {}, channelTaskId = 0; channel.port1.onmessage = function (event) { var id = event.data, action = channelTasks[id]; action(); delete channelTasks[id]; }; scheduleMethod = function (action) { var id = channelTaskId++; channelTasks[id] = action; channel.port2.postMessage(id); }; } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { scheduleMethod = function (action) { var scriptElement = root.document.createElement('script'); scriptElement.onreadystatechange = function () { action(); scriptElement.onreadystatechange = null; scriptElement.parentNode.removeChild(scriptElement); scriptElement = null; }; root.document.documentElement.appendChild(scriptElement); }; } else { scheduleMethod = function (action) { return setTimeout(action, 0); }; clearMethod = clearTimeout; } }()); /** * Gets a scheduler that schedules work via a timed callback based upon platform. */ var timeoutScheduler = Scheduler.timeout = (function () { function scheduleNow(state, action) { var scheduler = this, disposable = new SingleAssignmentDisposable(); var id = scheduleMethod(function () { if (!disposable.isDisposed) { disposable.setDisposable(action(scheduler, state)); } }); return new CompositeDisposable(disposable, disposableCreate(function () { clearMethod(id); })); } function scheduleRelative(state, dueTime, action) { var scheduler = this, dt = Scheduler.normalize(dueTime); if (dt === 0) { return scheduler.scheduleWithState(state, action); } var disposable = new SingleAssignmentDisposable(); var id = setTimeout(function () { if (!disposable.isDisposed) { disposable.setDisposable(action(scheduler, state)); } }, dt); return new CompositeDisposable(disposable, disposableCreate(function () { clearTimeout(id); })); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); })(); /** @private */ var CatchScheduler = (function (_super) { function localNow() { return this._scheduler.now(); } function scheduleNow(state, action) { return this._scheduler.scheduleWithState(state, this._wrap(action)); } function scheduleRelative(state, dueTime, action) { return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); } function scheduleAbsolute(state, dueTime, action) { return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); } inherits(CatchScheduler, _super); /** @private */ function CatchScheduler(scheduler, handler) { this._scheduler = scheduler; this._handler = handler; this._recursiveOriginal = null; this._recursiveWrapper = null; _super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute); } /** @private */ CatchScheduler.prototype._clone = function (scheduler) { return new CatchScheduler(scheduler, this._handler); }; /** @private */ CatchScheduler.prototype._wrap = function (action) { var parent = this; return function (self, state) { try { return action(parent._getRecursiveWrapper(self), state); } catch (e) { if (!parent._handler(e)) { throw e; } return disposableEmpty; } }; }; /** @private */ CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { if (this._recursiveOriginal !== scheduler) { this._recursiveOriginal = scheduler; var wrapper = this._clone(scheduler); wrapper._recursiveOriginal = scheduler; wrapper._recursiveWrapper = wrapper; this._recursiveWrapper = wrapper; } return this._recursiveWrapper; }; /** @private */ CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { var self = this, failed = false, d = new SingleAssignmentDisposable(); d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { if (failed) { return null; } try { return action(state1); } catch (e) { failed = true; if (!self._handler(e)) { throw e; } d.dispose(); return null; } })); return d; }; return CatchScheduler; }(Scheduler)); /** * Represents a notification to an observer. */ var Notification = Rx.Notification = (function () { function Notification(kind, hasValue) { this.hasValue = hasValue == null ? false : hasValue; this.kind = kind; } var NotificationPrototype = Notification.prototype; /** * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result. * * @memberOf Notification * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on.. * @param {Function} onError Delegate to invoke for an OnError notification. * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification. * @returns {Any} Result produced by the observation. */ NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) { if (arguments.length === 1 && typeof observerOrOnNext === 'object') { return this._acceptObservable(observerOrOnNext); } return this._accept(observerOrOnNext, onError, onCompleted); }; /** * Returns an observable sequence with a single notification. * * @memberOf Notification * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on. * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription. */ NotificationPrototype.toObservable = function (scheduler) { var notification = this; scheduler || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { notification._acceptObservable(observer); if (notification.kind === 'N') { observer.onCompleted(); } }); }); }; return Notification; })(); /** * Creates an object that represents an OnNext notification to an observer. * @param {Any} value The value contained in the notification. * @returns {Notification} The OnNext notification containing the value. */ var notificationCreateOnNext = Notification.createOnNext = (function () { function _accept (onNext) { return onNext(this.value); } function _acceptObservable(observer) { return observer.onNext(this.value); } function toString () { return 'OnNext(' + this.value + ')'; } return function (value) { var notification = new Notification('N', true); notification.value = value; notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); /** * Creates an object that represents an OnError notification to an observer. * @param {Any} error The exception contained in the notification. * @returns {Notification} The OnError notification containing the exception. */ var notificationCreateOnError = Notification.createOnError = (function () { function _accept (onNext, onError) { return onError(this.exception); } function _acceptObservable(observer) { return observer.onError(this.exception); } function toString () { return 'OnError(' + this.exception + ')'; } return function (exception) { var notification = new Notification('E'); notification.exception = exception; notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); /** * Creates an object that represents an OnCompleted notification to an observer. * @returns {Notification} The OnCompleted notification. */ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () { function _accept (onNext, onError, onCompleted) { return onCompleted(); } function _acceptObservable(observer) { return observer.onCompleted(); } function toString () { return 'OnCompleted()'; } return function () { var notification = new Notification('C'); notification._accept = _accept; notification._acceptObservable = _acceptObservable; notification.toString = toString; return notification; }; }()); var Enumerator = Rx.internals.Enumerator = function (next) { this._next = next; }; Enumerator.prototype.next = function () { return this._next(); }; Enumerator.prototype[$iterator$] = function () { return this; } var Enumerable = Rx.internals.Enumerable = function (iterator) { this._iterator = iterator; }; Enumerable.prototype[$iterator$] = function () { return this._iterator(); }; Enumerable.prototype.concat = function () { var sources = this; return new AnonymousObservable(function (observer) { var e; try { e = sources[$iterator$](); } catch(err) { observer.onError(); return; } var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { var currentItem; if (isDisposed) { return; } try { currentItem = e.next(); } catch (ex) { observer.onError(ex); return; } if (currentItem.done) { observer.onCompleted(); return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( observer.onNext.bind(observer), observer.onError.bind(observer), function () { self(); }) ); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; Enumerable.prototype.catchException = function () { var sources = this; return new AnonymousObservable(function (observer) { var e; try { e = sources[$iterator$](); } catch(err) { observer.onError(); return; } var isDisposed, lastException, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } var currentItem; try { currentItem = e.next(); } catch (ex) { observer.onError(ex); return; } if (currentItem.done) { if (lastException) { observer.onError(lastException); } else { observer.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( observer.onNext.bind(observer), function (exn) { lastException = exn; self(); }, observer.onCompleted.bind(observer))); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { if (repeatCount == null) { repeatCount = -1; } return new Enumerable(function () { var left = repeatCount; return new Enumerator(function () { if (left === 0) { return doneEnumerator; } if (left > 0) { left--; } return { done: false, value: value }; }); }); }; var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { selector || (selector = identity); return new Enumerable(function () { var index = -1; return new Enumerator( function () { return ++index < source.length ? { done: false, value: selector.call(thisArg, source[index], index, source) } : doneEnumerator; }); }); }; /** * Supports push-style iteration over an observable sequence. */ var Observer = Rx.Observer = function () { }; /** * Creates a notification callback from an observer. * * @param observer Observer object. * @returns The action that forwards its input notification to the underlying observer. */ Observer.prototype.toNotifier = function () { var observer = this; return function (n) { return n.accept(observer); }; }; /** * Hides the identity of an observer. * @returns An observer that hides the identity of the specified observer. */ Observer.prototype.asObserver = function () { return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); }; /** * Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. * If a violation is detected, an Error is thrown from the offending observer method call. * * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer. */ Observer.prototype.checked = function () { return new CheckedObserver(this); }; /** * Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions. * * @static * @memberOf Observer * @param {Function} [onNext] Observer's OnNext action implementation. * @param {Function} [onError] Observer's OnError action implementation. * @param {Function} [onCompleted] Observer's OnCompleted action implementation. * @returns {Observer} The observer object implemented using the given actions. */ var observerCreate = Observer.create = function (onNext, onError, onCompleted) { onNext || (onNext = noop); onError || (onError = defaultError); onCompleted || (onCompleted = noop); return new AnonymousObserver(onNext, onError, onCompleted); }; /** * Creates an observer from a notification callback. * * @static * @memberOf Observer * @param {Function} handler Action that handles a notification. * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives. */ Observer.fromNotifier = function (handler) { return new AnonymousObserver(function (x) { return handler(notificationCreateOnNext(x)); }, function (exception) { return handler(notificationCreateOnError(exception)); }, function () { return handler(notificationCreateOnCompleted()); }); }; /** * Schedules the invocation of observer methods on the given scheduler. * @param {Scheduler} scheduler Scheduler to schedule observer messages on. * @returns {Observer} Observer whose messages are scheduled on the given scheduler. */ Observer.notifyOn = function (scheduler) { return new ObserveOnObserver(scheduler, this); }; /** * Abstract base class for implementations of the Observer class. * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. */ var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) { inherits(AbstractObserver, _super); /** * Creates a new observer in a non-stopped state. * * @constructor */ function AbstractObserver() { this.isStopped = false; _super.call(this); } /** * Notifies the observer of a new element in the sequence. * * @memberOf AbstractObserver * @param {Any} value Next element in the sequence. */ AbstractObserver.prototype.onNext = function (value) { if (!this.isStopped) { this.next(value); } }; /** * Notifies the observer that an exception has occurred. * * @memberOf AbstractObserver * @param {Any} error The error that has occurred. */ AbstractObserver.prototype.onError = function (error) { if (!this.isStopped) { this.isStopped = true; this.error(error); } }; /** * Notifies the observer of the end of the sequence. */ AbstractObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.completed(); } }; /** * Disposes the observer, causing it to transition to the stopped state. */ AbstractObserver.prototype.dispose = function () { this.isStopped = true; }; AbstractObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.error(e); return true; } return false; }; return AbstractObserver; }(Observer)); /** * Class to create an Observer instance from delegate-based implementations of the on* methods. */ var AnonymousObserver = Rx.AnonymousObserver = (function (_super) { inherits(AnonymousObserver, _super); /** * Creates an observer from the specified OnNext, OnError, and OnCompleted actions. * @param {Any} onNext Observer's OnNext action implementation. * @param {Any} onError Observer's OnError action implementation. * @param {Any} onCompleted Observer's OnCompleted action implementation. */ function AnonymousObserver(onNext, onError, onCompleted) { _super.call(this); this._onNext = onNext; this._onError = onError; this._onCompleted = onCompleted; } /** * Calls the onNext action. * @param {Any} value Next element in the sequence. */ AnonymousObserver.prototype.next = function (value) { this._onNext(value); }; /** * Calls the onError action. * @param {Any} error The error that has occurred. */ AnonymousObserver.prototype.error = function (exception) { this._onError(exception); }; /** * Calls the onCompleted action. */ AnonymousObserver.prototype.completed = function () { this._onCompleted(); }; return AnonymousObserver; }(AbstractObserver)); var CheckedObserver = (function (_super) { inherits(CheckedObserver, _super); function CheckedObserver(observer) { _super.call(this); this._observer = observer; this._state = 0; // 0 - idle, 1 - busy, 2 - done } var CheckedObserverPrototype = CheckedObserver.prototype; CheckedObserverPrototype.onNext = function (value) { this.checkAccess(); try { this._observer.onNext(value); } catch (e) { throw e; } finally { this._state = 0; } }; CheckedObserverPrototype.onError = function (err) { this.checkAccess(); try { this._observer.onError(err); } catch (e) { throw e; } finally { this._state = 2; } }; CheckedObserverPrototype.onCompleted = function () { this.checkAccess(); try { this._observer.onCompleted(); } catch (e) { throw e; } finally { this._state = 2; } }; CheckedObserverPrototype.checkAccess = function () { if (this._state === 1) { throw new Error('Re-entrancy detected'); } if (this._state === 2) { throw new Error('Observer completed'); } if (this._state === 0) { this._state = 1; } }; return CheckedObserver; }(Observer)); var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) { inherits(ScheduledObserver, _super); function ScheduledObserver(scheduler, observer) { _super.call(this); this.scheduler = scheduler; this.observer = observer; this.isAcquired = false; this.hasFaulted = false; this.queue = []; this.disposable = new SerialDisposable(); } ScheduledObserver.prototype.next = function (value) { var self = this; this.queue.push(function () { self.observer.onNext(value); }); }; ScheduledObserver.prototype.error = function (exception) { var self = this; this.queue.push(function () { self.observer.onError(exception); }); }; ScheduledObserver.prototype.completed = function () { var self = this; this.queue.push(function () { self.observer.onCompleted(); }); }; ScheduledObserver.prototype.ensureActive = function () { var isOwner = false, parent = this; if (!this.hasFaulted && this.queue.length > 0) { isOwner = !this.isAcquired; this.isAcquired = true; } if (isOwner) { this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) { var work; if (parent.queue.length > 0) { work = parent.queue.shift(); } else { parent.isAcquired = false; return; } try { work(); } catch (ex) { parent.queue = []; parent.hasFaulted = true; throw ex; } self(); })); } }; ScheduledObserver.prototype.dispose = function () { _super.prototype.dispose.call(this); this.disposable.dispose(); }; return ScheduledObserver; }(AbstractObserver)); /** @private */ var ObserveOnObserver = (function (_super) { inherits(ObserveOnObserver, _super); /** @private */ function ObserveOnObserver() { _super.apply(this, arguments); } /** @private */ ObserveOnObserver.prototype.next = function (value) { _super.prototype.next.call(this, value); this.ensureActive(); }; /** @private */ ObserveOnObserver.prototype.error = function (e) { _super.prototype.error.call(this, e); this.ensureActive(); }; /** @private */ ObserveOnObserver.prototype.completed = function () { _super.prototype.completed.call(this); this.ensureActive(); }; return ObserveOnObserver; })(ScheduledObserver); var observableProto; /** * Represents a push-style collection. */ var Observable = Rx.Observable = (function () { function Observable(subscribe) { this._subscribe = subscribe; } observableProto = Observable.prototype; /** * Subscribes an observer to the observable sequence. * * @example * 1 - source.subscribe(); * 2 - source.subscribe(observer); * 3 - source.subscribe(function (x) { console.log(x); }); * 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }); * 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); }); * @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. * @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) { var subscriber = typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted); return this._subscribe(subscriber); }; return Observable; })(); /** * Wraps the source sequence in order to run its observer callbacks on the specified scheduler. * * This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects * that require to be run on a scheduler, use subscribeOn. * * @param {Scheduler} scheduler Scheduler to notify observers on. * @returns {Observable} The source sequence whose observations happen on the specified scheduler. */ observableProto.observeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(new ObserveOnObserver(scheduler, observer)); }); }; /** * Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; * see the remarks section for more information on the distinction between subscribeOn and observeOn. * This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer * callbacks on a scheduler, use observeOn. * @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on. * @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), d = new SerialDisposable(); d.setDisposable(m); m.setDisposable(scheduler.schedule(function () { d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); })); return d; }); }; /** * Converts a Promise to an Observable sequence * @param {Promise} An ES6 Compliant promise. * @returns {Observable} An Observable sequence which wraps the existing promise success and failure. */ var observableFromPromise = Observable.fromPromise = function (promise) { return new AnonymousObservable(function (observer) { promise.then( function (value) { observer.onNext(value); observer.onCompleted(); }, function (reason) { observer.onError(reason); }); return function () { if (promise && promise.abort) { promise.abort(); } } }); }; /* * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence. */ observableProto.toPromise = function (promiseCtor) { promiseCtor || (promiseCtor = Rx.config.Promise); if (!promiseCtor) { throw new Error('Promise type not provided nor in Rx.config.Promise'); } var source = this; return new promiseCtor(function (resolve, reject) { // No cancellation can be done var value, hasValue = false; source.subscribe(function (v) { value = v; hasValue = true; }, function (err) { reject(err); }, function () { if (hasValue) { resolve(value); } }); }); }; /** * Creates a list from an observable sequence. * @returns An observable sequence containing a single element with a list containing all the elements of the source sequence. */ observableProto.toArray = function () { var self = this; return new AnonymousObservable(function(observer) { var arr = []; return self.subscribe( arr.push.bind(arr), observer.onError.bind(observer), function () { observer.onNext(arr); observer.onCompleted(); }); }); }; /** * Creates an observable sequence from a specified subscribe method implementation. * * @example * var res = Rx.Observable.create(function (observer) { return function () { } ); * var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } ); * var res = Rx.Observable.create(function (observer) { } ); * * @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable. * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method. */ Observable.create = Observable.createWithDisposable = function (subscribe) { return new AnonymousObservable(subscribe); }; /** * Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. * * @example * var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); }); * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise. * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function. */ var observableDefer = Observable.defer = function (observableFactory) { return new AnonymousObservable(function (observer) { var result; try { result = observableFactory(); } catch (e) { return observableThrow(e).subscribe(observer); } isPromise(result) && (result = observableFromPromise(result)); return result.subscribe(observer); }); }; /** * Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message. * * @example * var res = Rx.Observable.empty(); * var res = Rx.Observable.empty(Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to send the termination call on. * @returns {Observable} An observable sequence with no elements. */ var observableEmpty = Observable.empty = function (scheduler) { scheduler || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { observer.onCompleted(); }); }); }; /** * Converts an array to an observable sequence, using an optional scheduler to enumerate the array. * * @example * var res = Rx.Observable.fromArray([1,2,3]); * var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence. */ var observableFromArray = Observable.fromArray = function (array, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (observer) { var count = 0; return scheduler.scheduleRecursive(function (self) { if (count < array.length) { observer.onNext(array[count++]); self(); } else { observer.onCompleted(); } }); }); }; /** * Converts an iterable into an Observable sequence * * @example * var res = Rx.Observable.fromIterable(new Map()); * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence. */ Observable.fromIterable = function (iterable, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (observer) { var iterator; try { iterator = iterable[$iterator$](); } catch (e) { observer.onError(e); return; } return scheduler.scheduleRecursive(function (self) { var next; try { next = iterator.next(); } catch (err) { observer.onError(err); return; } if (next.done) { observer.onCompleted(); } else { observer.onNext(next.value); self(); } }); }); }; /** * Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }); * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout); * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread. * @returns {Observable} The generated sequence. */ Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (observer) { var first = true, state = initialState; return scheduler.scheduleRecursive(function (self) { var hasResult, result; try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); if (hasResult) { result = resultSelector(state); } } catch (exception) { observer.onError(exception); return; } if (hasResult) { observer.onNext(result); self(); } else { observer.onCompleted(); } }); }); }; /** * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). * @returns {Observable} An observable sequence whose observers will never get called. */ var observableNever = Observable.never = function () { return new AnonymousObservable(function () { return disposableEmpty; }); }; /** * Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.range(0, 10); * var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout); * @param {Number} start The value of the first integer in the sequence. * @param {Number} count The number of sequential integers to generate. * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread. * @returns {Observable} An observable sequence that contains a range of sequential integral numbers. */ Observable.range = function (start, count, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (observer) { return scheduler.scheduleRecursiveWithState(0, function (i, self) { if (i < count) { observer.onNext(start + i); self(i + 1); } else { observer.onCompleted(); } }); }); }; /** * Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.repeat(42); * var res = Rx.Observable.repeat(42, 4); * 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout); * 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout); * @param {Mixed} value Element to repeat. * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely. * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence that repeats the given element the specified number of times. */ Observable.repeat = function (value, repeatCount, scheduler) { scheduler || (scheduler = currentThreadScheduler); if (repeatCount == null) { repeatCount = -1; } return observableReturn(value, scheduler).repeat(repeatCount); }; /** * Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages. * There is an alias called 'returnValue' for browsers <IE9. * * @example * var res = Rx.Observable.return(42); * var res = Rx.Observable.return(42, Rx.Scheduler.timeout); * @param {Mixed} value Single element in the resulting observable sequence. * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence containing the single specified element. */ var observableReturn = Observable['return'] = Observable.returnValue = function (value, scheduler) { scheduler || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { observer.onNext(value); observer.onCompleted(); }); }); }; /** * Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message. * There is an alias to this method called 'throwException' for browsers <IE9. * * @example * var res = Rx.Observable.throwException(new Error('Error')); * var res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout); * @param {Mixed} exception An object used for the sequence's termination. * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object. */ var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) { scheduler || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { observer.onError(exception); }); }); }; /** * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. * * @example * var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; }); * @param {Function} resourceFactory Factory function to obtain a resource object. * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource. * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object. */ Observable.using = function (resourceFactory, observableFactory) { return new AnonymousObservable(function (observer) { var disposable = disposableEmpty, resource, source; try { resource = resourceFactory(); if (resource) { disposable = resource; } source = observableFactory(resource); } catch (exception) { return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable); } return new CompositeDisposable(source.subscribe(observer), disposable); }); }; /** * Propagates the observable sequence or Promise that reacts first. * @param {Observable} rightSource Second observable sequence or Promise. * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first. */ observableProto.amb = function (rightSource) { var leftSource = this; return new AnonymousObservable(function (observer) { var choice, leftChoice = 'L', rightChoice = 'R', leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); function choiceL() { if (!choice) { choice = leftChoice; rightSubscription.dispose(); } } function choiceR() { if (!choice) { choice = rightChoice; leftSubscription.dispose(); } } leftSubscription.setDisposable(leftSource.subscribe(function (left) { choiceL(); if (choice === leftChoice) { observer.onNext(left); } }, function (err) { choiceL(); if (choice === leftChoice) { observer.onError(err); } }, function () { choiceL(); if (choice === leftChoice) { observer.onCompleted(); } })); rightSubscription.setDisposable(rightSource.subscribe(function (right) { choiceR(); if (choice === rightChoice) { observer.onNext(right); } }, function (err) { choiceR(); if (choice === rightChoice) { observer.onError(err); } }, function () { choiceR(); if (choice === rightChoice) { observer.onCompleted(); } })); return new CompositeDisposable(leftSubscription, rightSubscription); }); }; /** * Propagates the observable sequence or Promise that reacts first. * * @example * var = Rx.Observable.amb(xs, ys, zs); * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first. */ Observable.amb = function () { var acc = observableNever(), items = argsOrArray(arguments, 0); function func(previous, current) { return previous.amb(current); } for (var i = 0, len = items.length; i < len; i++) { acc = func(acc, items[i]); } return acc; }; function observableCatchHandler(source, handler) { return new AnonymousObservable(function (observer) { var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable(); subscription.setDisposable(d1); d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) { var d, result; try { result = handler(exception); } catch (ex) { observer.onError(ex); return; } isPromise(result) && (result = observableFromPromise(result)); d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(result.subscribe(observer)); }, observer.onCompleted.bind(observer))); return subscription; }); } /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @example * 1 - xs.catchException(ys) * 2 - xs.catchException(function (ex) { return ys(ex); }) * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence. * @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred. */ observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) { return typeof handlerOrSecond === 'function' ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); }; /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * * @example * 1 - res = Rx.Observable.catchException(xs, ys, zs); * 2 - res = Rx.Observable.catchException([xs, ys, zs]); * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. */ var observableCatch = Observable.catchException = Observable['catch'] = function () { var items = argsOrArray(arguments, 0); return enumerableFor(items).catchException(); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * This can be in the form of an argument list of observables or an array. * * @example * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.combineLatest = function () { var args = slice.call(arguments); if (Array.isArray(args[0])) { args[0].unshift(this); } else { args.unshift(this); } return combineLatest.apply(this, args); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * * @example * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ var combineLatest = Observable.combineLatest = function () { var args = slice.call(arguments), resultSelector = args.pop(); if (Array.isArray(args[0])) { args = args[0]; } return new AnonymousObservable(function (observer) { var falseFactory = function () { return false; }, n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, isDone = arrayInitialize(n, falseFactory), values = new Array(n); function next(i) { var res; hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { try { res = resultSelector.apply(null, values); } catch (ex) { observer.onError(ex); return; } observer.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { observer.onCompleted(); } } function done (i) { isDone[i] = true; if (isDone.every(identity)) { observer.onCompleted(); } } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { values[i] = x; next(i); }, observer.onError.bind(observer), function () { done(i); })); subscriptions[i] = sad; }(idx)); } return new CompositeDisposable(subscriptions); }); }; /** * Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate. * * @example * 1 - concatenated = xs.concat(ys, zs); * 2 - concatenated = xs.concat([ys, zs]); * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ observableProto.concat = function () { var items = slice.call(arguments, 0); items.unshift(this); return observableConcat.apply(this, items); }; /** * Concatenates all the observable sequences. * * @example * 1 - res = Rx.Observable.concat(xs, ys, zs); * 2 - res = Rx.Observable.concat([xs, ys, zs]); * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ var observableConcat = Observable.concat = function () { var sources = argsOrArray(arguments, 0); return enumerableFor(sources).concat(); }; /** * Concatenates an observable sequence of observable sequences. * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order. */ observableProto.concatObservable = observableProto.concatAll =function () { return this.merge(1); }; /** * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences. * Or merges two observable sequences into a single observable sequence. * * @example * 1 - merged = sources.merge(1); * 2 - merged = source.merge(otherSource); * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.merge = function (maxConcurrentOrOther) { if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); } var sources = this; return new AnonymousObservable(function (observer) { var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [], subscribe = function (xs) { var subscription = new SingleAssignmentDisposable(); group.add(subscription); // Check for promises support if (isPromise(xs)) { xs = observableFromPromise(xs); } subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () { var s; group.remove(subscription); if (q.length > 0) { s = q.shift(); subscribe(s); } else { activeCount--; if (isStopped && activeCount === 0) { observer.onCompleted(); } } })); }; group.add(sources.subscribe(function (innerSource) { if (activeCount < maxConcurrentOrOther) { activeCount++; subscribe(innerSource); } else { q.push(innerSource); } }, observer.onError.bind(observer), function () { isStopped = true; if (activeCount === 0) { observer.onCompleted(); } })); return group; }); }; /** * Merges all the observable sequences into a single observable sequence. * The scheduler is optional and if not specified, the immediate scheduler is used. * * @example * 1 - merged = Rx.Observable.merge(xs, ys, zs); * 2 - merged = Rx.Observable.merge([xs, ys, zs]); * 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs); * 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]); * @returns {Observable} The observable sequence that merges the elements of the observable sequences. */ var observableMerge = Observable.merge = function () { var scheduler, sources; if (!arguments[0]) { scheduler = immediateScheduler; sources = slice.call(arguments, 1); } else if (arguments[0].now) { scheduler = arguments[0]; sources = slice.call(arguments, 1); } else { scheduler = immediateScheduler; sources = slice.call(arguments, 0); } if (Array.isArray(sources[0])) { sources = sources[0]; } return observableFromArray(sources, scheduler).mergeObservable(); }; /** * Merges an observable sequence of observable sequences into an observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.mergeObservable = observableProto.mergeAll =function () { var sources = this; return new AnonymousObservable(function (observer) { var group = new CompositeDisposable(), isStopped = false, m = new SingleAssignmentDisposable(); group.add(m); m.setDisposable(sources.subscribe(function (innerSource) { var innerSubscription = new SingleAssignmentDisposable(); group.add(innerSubscription); // Check if Promise or Observable if (isPromise(innerSource)) { innerSource = observableFromPromise(innerSource); } innerSubscription.setDisposable(innerSource.subscribe(function (x) { observer.onNext(x); }, observer.onError.bind(observer), function () { group.remove(innerSubscription); if (isStopped && group.length === 1) { observer.onCompleted(); } })); }, observer.onError.bind(observer), function () { isStopped = true; if (group.length === 1) { observer.onCompleted(); } })); return group; }); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates. * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally. */ observableProto.onErrorResumeNext = function (second) { if (!second) { throw new Error('Second observable is required'); } return onErrorResumeNext([this, second]); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * * @example * 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs); * 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]); * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. */ var onErrorResumeNext = Observable.onErrorResumeNext = function () { var sources = argsOrArray(arguments, 0); return new AnonymousObservable(function (observer) { var pos = 0, subscription = new SerialDisposable(), cancelable = immediateScheduler.scheduleRecursive(function (self) { var current, d; if (pos < sources.length) { current = sources[pos++]; isPromise(current) && (current = observableFromPromise(current)); d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () { self(); }, function () { self(); })); } else { observer.onCompleted(); } }); return new CompositeDisposable(subscription, cancelable); }); }; /** * Returns the values from the source observable sequence only after the other observable sequence produces a value. * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation. */ observableProto.skipUntil = function (other) { var source = this; return new AnonymousObservable(function (observer) { var isOpen = false; var disposables = new CompositeDisposable(source.subscribe(function (left) { isOpen && observer.onNext(left); }, observer.onError.bind(observer), function () { isOpen && observer.onCompleted(); })); isPromise(other) && (other = observableFromPromise(other)); var rightSubscription = new SingleAssignmentDisposable(); disposables.add(rightSubscription); rightSubscription.setDisposable(other.subscribe(function () { isOpen = true; rightSubscription.dispose(); }, observer.onError.bind(observer), function () { rightSubscription.dispose(); })); return disposables; }); }; /** * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto['switch'] = observableProto.switchLatest = function () { var sources = this; return new AnonymousObservable(function (observer) { var hasLatest = false, innerSubscription = new SerialDisposable(), isStopped = false, latest = 0, subscription = sources.subscribe(function (innerSource) { var d = new SingleAssignmentDisposable(), id = ++latest; hasLatest = true; innerSubscription.setDisposable(d); // Check if Promise or Observable if (isPromise(innerSource)) { innerSource = observableFromPromise(innerSource); } d.setDisposable(innerSource.subscribe(function (x) { if (latest === id) { observer.onNext(x); } }, function (e) { if (latest === id) { observer.onError(e); } }, function () { if (latest === id) { hasLatest = false; if (isStopped) { observer.onCompleted(); } } })); }, observer.onError.bind(observer), function () { isStopped = true; if (!hasLatest) { observer.onCompleted(); } }); return new CompositeDisposable(subscription, innerSubscription); }); }; /** * Returns the values from the source observable sequence until the other observable sequence produces a value. * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. */ observableProto.takeUntil = function (other) { var source = this; return new AnonymousObservable(function (observer) { isPromise(other) && (other = observableFromPromise(other)); return new CompositeDisposable( source.subscribe(observer), other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop) ); }); }; function zipArray(second, resultSelector) { var first = this; return new AnonymousObservable(function (observer) { var index = 0, len = second.length; return first.subscribe(function (left) { if (index < len) { var right = second[index++], result; try { result = resultSelector(left, right); } catch (e) { observer.onError(e); return; } observer.onNext(result); } else { observer.onCompleted(); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources. * * @example * 1 - res = obs1.zip(obs2, fn); * 1 - res = x1.zip([1,2,3], fn); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.zip = function () { if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); } var parent = this, sources = slice.call(arguments), resultSelector = sources.pop(); sources.unshift(parent); return new AnonymousObservable(function (observer) { var n = sources.length, queues = arrayInitialize(n, function () { return []; }), isDone = arrayInitialize(n, function () { return false; }); function next(i) { var res, queuedValues; if (queues.every(function (x) { return x.length > 0; })) { try { queuedValues = queues.map(function (x) { return x.shift(); }); res = resultSelector.apply(parent, queuedValues); } catch (ex) { observer.onError(ex); return; } observer.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { observer.onCompleted(); } }; function done(i) { isDone[i] = true; if (isDone.every(function (x) { return x; })) { observer.onCompleted(); } } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = sources[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); next(i); }, observer.onError.bind(observer), function () { done(i); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. * @param arguments Observable sources. * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ Observable.zip = function () { var args = slice.call(arguments, 0), first = args.shift(); return first.zip.apply(first, args); }; /** * Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes. * @param arguments Observable sources. * @returns {Observable} An observable sequence containing lists of elements at corresponding indexes. */ Observable.zipArray = function () { var sources = argsOrArray(arguments, 0); return new AnonymousObservable(function (observer) { var n = sources.length, queues = arrayInitialize(n, function () { return []; }), isDone = arrayInitialize(n, function () { return false; }); function next(i) { if (queues.every(function (x) { return x.length > 0; })) { var res = queues.map(function (x) { return x.shift(); }); observer.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { observer.onCompleted(); return; } }; function done(i) { isDone[i] = true; if (isDone.every(identity)) { observer.onCompleted(); return; } } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { subscriptions[i] = new SingleAssignmentDisposable(); subscriptions[i].setDisposable(sources[i].subscribe(function (x) { queues[i].push(x); next(i); }, observer.onError.bind(observer), function () { done(i); })); })(idx); } var compositeDisposable = new CompositeDisposable(subscriptions); compositeDisposable.add(disposableCreate(function () { for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) { queues[qIdx] = []; } })); return compositeDisposable; }); }; /** * Hides the identity of an observable sequence. * @returns {Observable} An observable sequence that hides the identity of the source sequence. */ observableProto.asObservable = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(observer); }); }; /** * Projects each element of an observable sequence into zero or more buffers which are produced based on element count information. * * @example * var res = xs.bufferWithCount(10); * var res = xs.bufferWithCount(10, 1); * @param {Number} count Length of each buffer. * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithCount = function (count, skip) { if (typeof skip !== 'number') { skip = count; } return this.windowWithCount(count, skip).selectMany(function (x) { return x.toArray(); }).where(function (x) { return x.length > 0; }); }; /** * Dematerializes the explicit notification values of an observable sequence as implicit notifications. * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. */ observableProto.dematerialize = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(function (x) { return x.accept(observer); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. * * var obs = observable.distinctUntilChanged(); * var obs = observable.distinctUntilChanged(function (x) { return x.id; }); * var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; }); * * @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value. * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function. * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. */ observableProto.distinctUntilChanged = function (keySelector, comparer) { var source = this; keySelector || (keySelector = identity); comparer || (comparer = defaultComparer); return new AnonymousObservable(function (observer) { var hasCurrentKey = false, currentKey; return source.subscribe(function (value) { var comparerEquals = false, key; try { key = keySelector(value); } catch (exception) { observer.onError(exception); return; } if (hasCurrentKey) { try { comparerEquals = comparer(currentKey, key); } catch (exception) { observer.onError(exception); return; } } if (!hasCurrentKey || !comparerEquals) { hasCurrentKey = true; currentKey = key; observer.onNext(value); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * * @example * var res = observable.doAction(observer); * var res = observable.doAction(onNext); * var res = observable.doAction(onNext, onError); * var res = observable.doAction(onNext, onError, onCompleted); * @param {Mixed} observerOrOnNext Action to invoke for each element in the observable sequence or an observer. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto['do'] = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) { var source = this, onNextFunc; if (typeof observerOrOnNext === 'function') { onNextFunc = observerOrOnNext; } else { onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext); onError = observerOrOnNext.onError.bind(observerOrOnNext); onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext); } return new AnonymousObservable(function (observer) { return source.subscribe(function (x) { try { onNextFunc(x); } catch (e) { observer.onError(e); } observer.onNext(x); }, function (exception) { if (!onError) { observer.onError(exception); } else { try { onError(exception); } catch (e) { observer.onError(e); } observer.onError(exception); } }, function () { if (!onCompleted) { observer.onCompleted(); } else { try { onCompleted(); } catch (e) { observer.onError(e); } observer.onCompleted(); } }); }); }; /** * Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. * * @example * var res = observable.finallyAction(function () { console.log('sequence ended'; }); * @param {Function} finallyAction Action to invoke after the source observable sequence terminates. * @returns {Observable} Source sequence with the action-invoking termination behavior applied. */ observableProto['finally'] = observableProto.finallyAction = function (action) { var source = this; return new AnonymousObservable(function (observer) { var subscription; try { subscription = source.subscribe(observer); } catch (e) { action(); throw e; } return disposableCreate(function () { try { subscription.dispose(); } catch (e) { throw e; } finally { action(); } }); }); }; /** * Ignores all elements in an observable sequence leaving only the termination messages. * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence. */ observableProto.ignoreElements = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Materializes the implicit notifications of an observable sequence as explicit notification values. * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence. */ observableProto.materialize = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(function (value) { observer.onNext(notificationCreateOnNext(value)); }, function (e) { observer.onNext(notificationCreateOnError(e)); observer.onCompleted(); }, function () { observer.onNext(notificationCreateOnCompleted()); observer.onCompleted(); }); }); }; /** * Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely. * * @example * var res = repeated = source.repeat(); * var res = repeated = source.repeat(42); * @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely. * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly. */ observableProto.repeat = function (repeatCount) { return enumerableRepeat(this, repeatCount).concat(); }; /** * Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely. * * @example * var res = retried = retry.repeat(); * var res = retried = retry.repeat(42); * @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retry = function (retryCount) { return enumerableRepeat(this, retryCount).catchException(); }; /** * Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. * For aggregation behavior with no intermediate results, see Observable.aggregate. * @example * var res = source.scan(function (acc, x) { return acc + x; }); * var res = source.scan(0, function (acc, x) { return acc + x; }); * @param {Mixed} [seed] The initial accumulator value. * @param {Function} accumulator An accumulator function to be invoked on each element. * @returns {Observable} An observable sequence containing the accumulated values. */ observableProto.scan = function () { var hasSeed = false, seed, accumulator, source = this; if (arguments.length === 2) { hasSeed = true; seed = arguments[0]; accumulator = arguments[1]; } else { accumulator = arguments[0]; } return new AnonymousObservable(function (observer) { var hasAccumulation, accumulation, hasValue; return source.subscribe ( function (x) { try { if (!hasValue) { hasValue = true; } if (hasAccumulation) { accumulation = accumulator(accumulation, x); } else { accumulation = hasSeed ? accumulator(seed, x) : x; hasAccumulation = true; } } catch (e) { observer.onError(e); return; } observer.onNext(accumulation); }, observer.onError.bind(observer), function () { if (!hasValue && hasSeed) { observer.onNext(seed); } observer.onCompleted(); } ); }); }; /** * Bypasses a specified number of elements at the end of an observable sequence. * @description * This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are * received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed. * @param count Number of elements to bypass at the end of the source sequence. * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end. */ observableProto.skipLast = function (count) { var source = this; return new AnonymousObservable(function (observer) { var q = []; return source.subscribe(function (x) { q.push(x); if (q.length > count) { observer.onNext(q.shift()); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. * * var res = source.startWith(1, 2, 3); * var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3); * * @memberOf Observable# * @returns {Observable} The source sequence prepended with the specified values. */ observableProto.startWith = function () { var values, scheduler, start = 0; if (!!arguments.length && 'now' in Object(arguments[0])) { scheduler = arguments[0]; start = 1; } else { scheduler = immediateScheduler; } values = slice.call(arguments, start); return enumerableFor([observableFromArray(values, scheduler), this]).concat(); }; /** * Returns a specified number of contiguous elements from the end of an observable sequence, using an optional scheduler to drain the queue. * * @example * var res = source.takeLast(5); * var res = source.takeLast(5, Rx.Scheduler.timeout); * * @description * This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of * the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. * @param {Number} count Number of elements to take from the end of the source sequence. * @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion of the source sequence. * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence. */ observableProto.takeLast = function (count, scheduler) { return this.takeLastBuffer(count).selectMany(function (xs) { return observableFromArray(xs, scheduler); }); }; /** * Returns an array with the specified number of contiguous elements from the end of an observable sequence. * * @description * This operator accumulates a buffer with a length enough to store count elements. Upon completion of the * source sequence, this buffer is produced on the result sequence. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence. */ observableProto.takeLastBuffer = function (count) { var source = this; return new AnonymousObservable(function (observer) { var q = []; return source.subscribe(function (x) { q.push(x); if (q.length > count) { q.shift(); } }, observer.onError.bind(observer), function () { observer.onNext(q); observer.onCompleted(); }); }); }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on element count information. * * var res = xs.windowWithCount(10); * var res = xs.windowWithCount(10, 1); * @param {Number} count Length of each window. * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithCount = function (count, skip) { var source = this; if (count <= 0) { throw new Error(argumentOutOfRange); } if (arguments.length === 1) { skip = count; } if (skip <= 0) { throw new Error(argumentOutOfRange); } return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), refCountDisposable = new RefCountDisposable(m), n = 0, q = [], createWindow = function () { var s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); }; createWindow(); m.setDisposable(source.subscribe(function (x) { var s; for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); } var c = n - count + 1; if (c >= 0 && c % skip === 0) { s = q.shift(); s.onCompleted(); } n++; if (n % skip === 0) { createWindow(); } }, function (exception) { while (q.length > 0) { q.shift().onError(exception); } observer.onError(exception); }, function () { while (q.length > 0) { q.shift().onCompleted(); } observer.onCompleted(); })); return refCountDisposable; }); }; function concatMap(selector) { return this.map(function (x, i) { var result = selector(x, i); return isPromise(result) ? observableFromPromise(result) : result; }).concatAll(); } function concatMapObserver(onNext, onError, onCompleted) { var source = this; return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { observer.onNext(onNext(x, index++)); }, function (err) { observer.onNext(onError(err)); observer.completed(); }, function () { observer.onNext(onCompleted()); observer.onCompleted(); }); }).concatAll(); } /** * One of the Following: * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * * @example * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }); * Or: * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. * * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); * Or: * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. * * var res = source.selectMany(Rx.Observable.fromArray([1,2,3])); * @param selector A transform function to apply to each element or an observable sequence to project each element from the * source sequence onto which could be either an observable or Promise. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. */ observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector) { if (resultSelector) { return this.concatMap(function (x, i) { var selectorResult = selector(x, i), result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult; return result.map(function (y) { return resultSelector(x, y, i); }); }); } if (typeof selector === 'function') { return concatMap.call(this, selector); } return concatMap.call(this, function () { return selector; }); }; /** * Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty. * * var res = obs = xs.defaultIfEmpty(); * 2 - obs = xs.defaultIfEmpty(false); * * @memberOf Observable# * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null. * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself. */ observableProto.defaultIfEmpty = function (defaultValue) { var source = this; if (defaultValue === undefined) { defaultValue = null; } return new AnonymousObservable(function (observer) { var found = false; return source.subscribe(function (x) { found = true; observer.onNext(x); }, observer.onError.bind(observer), function () { if (!found) { observer.onNext(defaultValue); } observer.onCompleted(); }); }); }; /** * Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer. * Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. * * @example * var res = obs = xs.distinct(); * 2 - obs = xs.distinct(function (x) { return x.id; }); * 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); }); * @param {Function} [keySelector] A function to compute the comparison key for each element. * @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison. * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence. */ observableProto.distinct = function (keySelector, keySerializer) { var source = this; keySelector || (keySelector = identity); keySerializer || (keySerializer = defaultKeySerializer); return new AnonymousObservable(function (observer) { var hashSet = {}; return source.subscribe(function (x) { var key, serializedKey, otherKey, hasMatch = false; try { key = keySelector(x); serializedKey = keySerializer(key); } catch (exception) { observer.onError(exception); return; } for (otherKey in hashSet) { if (serializedKey === otherKey) { hasMatch = true; break; } } if (!hasMatch) { hashSet[serializedKey] = null; observer.onNext(x); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function. * * @example * var res = observable.groupBy(function (x) { return x.id; }); * 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }); * 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); }); * @param {Function} keySelector A function to extract the key for each element. * @param {Function} [elementSelector] A function to map each source element to an element in an observable group. * @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison. * @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. */ observableProto.groupBy = function (keySelector, elementSelector, keySerializer) { return this.groupByUntil(keySelector, elementSelector, function () { return observableNever(); }, keySerializer); }; /** * Groups the elements of an observable sequence according to a specified key selector function. * A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same * key value as a reclaimed group occurs, the group will be reborn with a new lifetime request. * * @example * var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); }); * 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }); * 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); }); * @param {Function} keySelector A function to extract the key for each element. * @param {Function} durationSelector A function to signal the expiration of a group. * @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison. * @returns {Observable} * A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. * If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered. * */ observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, keySerializer) { var source = this; elementSelector || (elementSelector = identity); keySerializer || (keySerializer = defaultKeySerializer); return new AnonymousObservable(function (observer) { var map = {}, groupDisposable = new CompositeDisposable(), refCountDisposable = new RefCountDisposable(groupDisposable); groupDisposable.add(source.subscribe(function (x) { var duration, durationGroup, element, fireNewMapEntry, group, key, serializedKey, md, writer, w; try { key = keySelector(x); serializedKey = keySerializer(key); } catch (e) { for (w in map) { map[w].onError(e); } observer.onError(e); return; } fireNewMapEntry = false; try { writer = map[serializedKey]; if (!writer) { writer = new Subject(); map[serializedKey] = writer; fireNewMapEntry = true; } } catch (e) { for (w in map) { map[w].onError(e); } observer.onError(e); return; } if (fireNewMapEntry) { group = new GroupedObservable(key, writer, refCountDisposable); durationGroup = new GroupedObservable(key, writer); try { duration = durationSelector(durationGroup); } catch (e) { for (w in map) { map[w].onError(e); } observer.onError(e); return; } observer.onNext(group); md = new SingleAssignmentDisposable(); groupDisposable.add(md); var expire = function () { if (serializedKey in map) { delete map[serializedKey]; writer.onCompleted(); } groupDisposable.remove(md); }; md.setDisposable(duration.take(1).subscribe(noop, function (exn) { for (w in map) { map[w].onError(exn); } observer.onError(exn); }, function () { expire(); })); } try { element = elementSelector(x); } catch (e) { for (w in map) { map[w].onError(e); } observer.onError(e); return; } writer.onNext(element); }, function (ex) { for (var w in map) { map[w].onError(ex); } observer.onError(ex); }, function () { for (var w in map) { map[w].onCompleted(); } observer.onCompleted(); })); return refCountDisposable; }); }; /** * Projects each element of an observable sequence into a new form by incorporating the element's index. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source. */ observableProto.select = observableProto.map = function (selector, thisArg) { var parent = this; return new AnonymousObservable(function (observer) { var count = 0; return parent.subscribe(function (value) { var result; try { result = selector.call(thisArg, value, count++, parent); } catch (exception) { observer.onError(exception); return; } observer.onNext(result); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Retrieves the value of a specified property from all elements in the Observable sequence. * @param {String} property The property to pluck. * @returns {Observable} Returns a new Observable sequence of property values. */ observableProto.pluck = function (property) { return this.select(function (x) { return x[property]; }); }; function selectMany(selector) { return this.select(function (x, i) { var result = selector(x, i); return isPromise(result) ? observableFromPromise(result) : result; }).mergeObservable(); } function selectManyObserver(onNext, onError, onCompleted) { var source = this; return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { observer.onNext(onNext(x, index++)); }, function (err) { observer.onNext(onError(err)); observer.completed(); }, function () { observer.onNext(onCompleted()); observer.onCompleted(); }); }).mergeAll(); } /** * One of the Following: * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * * @example * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }); * Or: * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. * * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); * Or: * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. * * var res = source.selectMany(Rx.Observable.fromArray([1,2,3])); * @param selector A transform function to apply to each element or an observable sequence to project each element from the * source sequence onto which could be either an observable or Promise. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. */ observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector) { if (resultSelector) { return this.selectMany(function (x, i) { var selectorResult = selector(x, i), result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult; return result.select(function (y) { return resultSelector(x, y, i); }); }); } if (typeof selector === 'function') { return selectMany.call(this, selector); } return selectMany.call(this, function () { return selector; }); }; /** * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto.selectSwitch = observableProto.flatMapLatest = function (selector, thisArg) { return this.select(selector, thisArg).switchLatest(); }; /** * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. * @param {Number} count The number of elements to skip before returning the remaining elements. * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence. */ observableProto.skip = function (count) { if (count < 0) { throw new Error(argumentOutOfRange); } var observable = this; return new AnonymousObservable(function (observer) { var remaining = count; return observable.subscribe(function (x) { if (remaining <= 0) { observer.onNext(x); } else { remaining--; } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. * The element's index is used in the logic of the predicate function. * * var res = source.skipWhile(function (value) { return value < 10; }); * var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. */ observableProto.skipWhile = function (predicate, thisArg) { var source = this; return new AnonymousObservable(function (observer) { var i = 0, running = false; return source.subscribe(function (x) { if (!running) { try { running = !predicate.call(thisArg, x, i++, source); } catch (e) { observer.onError(e); return; } } if (running) { observer.onNext(x); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0). * * var res = source.take(5); * var res = source.take(0, Rx.Scheduler.timeout); * @param {Number} count The number of elements to return. * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0. * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence. */ observableProto.take = function (count, scheduler) { if (count < 0) { throw new Error(argumentOutOfRange); } if (count === 0) { return observableEmpty(scheduler); } var observable = this; return new AnonymousObservable(function (observer) { var remaining = count; return observable.subscribe(function (x) { if (remaining > 0) { remaining--; observer.onNext(x); if (remaining === 0) { observer.onCompleted(); } } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Returns elements from an observable sequence as long as a specified condition is true. * The element's index is used in the logic of the predicate function. * * @example * var res = source.takeWhile(function (value) { return value < 10; }); * var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. */ observableProto.takeWhile = function (predicate, thisArg) { var observable = this; return new AnonymousObservable(function (observer) { var i = 0, running = true; return observable.subscribe(function (x) { if (running) { try { running = predicate.call(thisArg, x, i++, observable); } catch (e) { observer.onError(e); return; } if (running) { observer.onNext(x); } else { observer.onCompleted(); } } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Filters the elements of an observable sequence based on a predicate by incorporating the element's index. * * @example * var res = source.where(function (value) { return value < 10; }); * var res = source.where(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition. */ observableProto.where = observableProto.filter = function (predicate, thisArg) { var parent = this; return new AnonymousObservable(function (observer) { var count = 0; return parent.subscribe(function (value) { var shouldRun; try { shouldRun = predicate.call(thisArg, value, count++, parent); } catch (exception) { observer.onError(exception); return; } if (shouldRun) { observer.onNext(value); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; observableProto.finalValue = function () { var source = this; return new AnonymousObservable(function (observer) { var hasValue = false, value; return source.subscribe(function (x) { hasValue = true; value = x; }, observer.onError.bind(observer), function () { if (!hasValue) { observer.onError(new Error(sequenceContainsNoElements)); } else { observer.onNext(value); observer.onCompleted(); } }); }); }; function extremaBy(source, keySelector, comparer) { return new AnonymousObservable(function (observer) { var hasValue = false, lastKey = null, list = []; return source.subscribe(function (x) { var comparison, key; try { key = keySelector(x); } catch (ex) { observer.onError(ex); return; } comparison = 0; if (!hasValue) { hasValue = true; lastKey = key; } else { try { comparison = comparer(key, lastKey); } catch (ex1) { observer.onError(ex1); return; } } if (comparison > 0) { lastKey = key; list = []; } if (comparison >= 0) { list.push(x); } }, observer.onError.bind(observer), function () { observer.onNext(list); observer.onCompleted(); }); }); } function firstOnly(x) { if (x.length === 0) { throw new Error(sequenceContainsNoElements); } return x[0]; } /** * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, see Observable.scan. * @example * 1 - res = source.aggregate(function (acc, x) { return acc + x; }); * 2 - res = source.aggregate(0, function (acc, x) { return acc + x; }); * @param {Mixed} [seed] The initial accumulator value. * @param {Function} accumulator An accumulator function to be invoked on each element. * @returns {Observable} An observable sequence containing a single element with the final accumulator value. */ observableProto.aggregate = function () { var seed, hasSeed, accumulator; if (arguments.length === 2) { seed = arguments[0]; hasSeed = true; accumulator = arguments[1]; } else { accumulator = arguments[0]; } return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); }; /** * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, see Observable.scan. * @example * 1 - res = source.reduce(function (acc, x) { return acc + x; }); * 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0); * @param {Function} accumulator An accumulator function to be invoked on each element. * @param {Any} [seed] The initial accumulator value. * @returns {Observable} An observable sequence containing a single element with the final accumulator value. */ observableProto.reduce = function (accumulator) { var seed, hasSeed; if (arguments.length === 2) { hasSeed = true; seed = arguments[1]; } return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); }; /** * Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence. * @example * var result = source.any(); * var result = source.any(function (x) { return x > 3; }); * @param {Function} [predicate] A function to test each element for a condition. * @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence. */ observableProto.some = observableProto.any = function (predicate, thisArg) { var source = this; return predicate ? source.where(predicate, thisArg).any() : new AnonymousObservable(function (observer) { return source.subscribe(function () { observer.onNext(true); observer.onCompleted(); }, observer.onError.bind(observer), function () { observer.onNext(false); observer.onCompleted(); }); }); }; /** * Determines whether an observable sequence is empty. * * @memberOf Observable# * @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty. */ observableProto.isEmpty = function () { return this.any().select(function (b) { return !b; }); }; /** * Determines whether all elements of an observable sequence satisfy a condition. * * 1 - res = source.all(function (value) { return value.length > 3; }); * @memberOf Observable# * @param {Function} [predicate] A function to test each element for a condition. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate. */ observableProto.every = observableProto.all = function (predicate, thisArg) { return this.where(function (v) { return !predicate(v); }, thisArg).any().select(function (b) { return !b; }); }; /** * Determines whether an observable sequence contains a specified element with an optional equality comparer. * @example * 1 - res = source.contains(42); * 2 - res = source.contains({ value: 42 }, function (x, y) { return x.value === y.value; }); * @param value The value to locate in the source sequence. * @param {Function} [comparer] An equality comparer to compare elements. * @returns {Observable} An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value. */ observableProto.contains = function (value, comparer) { comparer || (comparer = defaultComparer); return this.where(function (v) { return comparer(v, value); }).any(); }; /** * Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items. * @example * res = source.count(); * res = source.count(function (x) { return x > 3; }); * @param {Function} [predicate]A function to test each element for a condition. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence. */ observableProto.count = function (predicate, thisArg) { return predicate ? this.where(predicate, thisArg).count() : this.aggregate(0, function (count) { return count + 1; }); }; /** * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence. * @example * var res = source.sum(); * var res = source.sum(function (x) { return x.value; }); * @param {Function} [selector] A transform function to apply to each element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence. */ observableProto.sum = function (keySelector, thisArg) { return keySelector ? this.select(keySelector, thisArg).sum() : this.aggregate(0, function (prev, curr) { return prev + curr; }); }; /** * Returns the elements in an observable sequence with the minimum key value according to the specified comparer. * @example * var res = source.minBy(function (x) { return x.value; }); * var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; }); * @param {Function} keySelector Key selector function. * @param {Function} [comparer] Comparer used to compare key values. * @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value. */ observableProto.minBy = function (keySelector, comparer) { comparer || (comparer = defaultSubComparer); return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; }); }; /** * Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check. * @example * var res = source.min(); * var res = source.min(function (x, y) { return x.value - y.value; }); * @param {Function} [comparer] Comparer used to compare elements. * @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence. */ observableProto.min = function (comparer) { return this.minBy(identity, comparer).select(function (x) { return firstOnly(x); }); }; /** * Returns the elements in an observable sequence with the maximum key value according to the specified comparer. * @example * var res = source.maxBy(function (x) { return x.value; }); * var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; }); * @param {Function} keySelector Key selector function. * @param {Function} [comparer] Comparer used to compare key values. * @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value. */ observableProto.maxBy = function (keySelector, comparer) { comparer || (comparer = defaultSubComparer); return extremaBy(this, keySelector, comparer); }; /** * Returns the maximum value in an observable sequence according to the specified comparer. * @example * var res = source.max(); * var res = source.max(function (x, y) { return x.value - y.value; }); * @param {Function} [comparer] Comparer used to compare elements. * @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence. */ observableProto.max = function (comparer) { return this.maxBy(identity, comparer).select(function (x) { return firstOnly(x); }); }; /** * Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. * @example * var res = res = source.average(); * var res = res = source.average(function (x) { return x.value; }); * @param {Function} [selector] A transform function to apply to each element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. */ observableProto.average = function (keySelector, thisArg) { return keySelector ? this.select(keySelector, thisArg).average() : this.scan({ sum: 0, count: 0 }, function (prev, cur) { return { sum: prev.sum + cur, count: prev.count + 1 }; }).finalValue().select(function (s) { if (s.count === 0) { throw new Error('The input sequence was empty'); } return s.sum / s.count; }); }; function sequenceEqualArray(first, second, comparer) { return new AnonymousObservable(function (observer) { var count = 0, len = second.length; return first.subscribe(function (value) { var equal = false; try { if (count < len) { equal = comparer(value, second[count++]); } } catch (e) { observer.onError(e); return; } if (!equal) { observer.onNext(false); observer.onCompleted(); } }, observer.onError.bind(observer), function () { observer.onNext(count === len); observer.onCompleted(); }); }); } /** * Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer. * * @example * var res = res = source.sequenceEqual([1,2,3]); * var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; }); * 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42)); * 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; }); * @param {Observable} second Second observable sequence or array to compare. * @param {Function} [comparer] Comparer used to compare elements of both sequences. * @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer. */ observableProto.sequenceEqual = function (second, comparer) { var first = this; comparer || (comparer = defaultComparer); if (Array.isArray(second)) { return sequenceEqualArray(first, second, comparer); } return new AnonymousObservable(function (observer) { var donel = false, doner = false, ql = [], qr = []; var subscription1 = first.subscribe(function (x) { var equal, v; if (qr.length > 0) { v = qr.shift(); try { equal = comparer(v, x); } catch (e) { observer.onError(e); return; } if (!equal) { observer.onNext(false); observer.onCompleted(); } } else if (doner) { observer.onNext(false); observer.onCompleted(); } else { ql.push(x); } }, observer.onError.bind(observer), function () { donel = true; if (ql.length === 0) { if (qr.length > 0) { observer.onNext(false); observer.onCompleted(); } else if (doner) { observer.onNext(true); observer.onCompleted(); } } }); isPromise(second) && (second = observableFromPromise(second)); var subscription2 = second.subscribe(function (x) { var equal, v; if (ql.length > 0) { v = ql.shift(); try { equal = comparer(v, x); } catch (exception) { observer.onError(exception); return; } if (!equal) { observer.onNext(false); observer.onCompleted(); } } else if (donel) { observer.onNext(false); observer.onCompleted(); } else { qr.push(x); } }, observer.onError.bind(observer), function () { doner = true; if (qr.length === 0) { if (ql.length > 0) { observer.onNext(false); observer.onCompleted(); } else if (donel) { observer.onNext(true); observer.onCompleted(); } } }); return new CompositeDisposable(subscription1, subscription2); }); }; function elementAtOrDefault(source, index, hasDefault, defaultValue) { if (index < 0) { throw new Error(argumentOutOfRange); } return new AnonymousObservable(function (observer) { var i = index; return source.subscribe(function (x) { if (i === 0) { observer.onNext(x); observer.onCompleted(); } i--; }, observer.onError.bind(observer), function () { if (!hasDefault) { observer.onError(new Error(argumentOutOfRange)); } else { observer.onNext(defaultValue); observer.onCompleted(); } }); }); } /** * Returns the element at a specified index in a sequence. * @example * var res = source.elementAt(5); * @param {Number} index The zero-based index of the element to retrieve. * @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence. */ observableProto.elementAt = function (index) { return elementAtOrDefault(this, index, false); }; /** * Returns the element at a specified index in a sequence or a default value if the index is out of range. * @example * var res = source.elementAtOrDefault(5); * var res = source.elementAtOrDefault(5, 0); * @param {Number} index The zero-based index of the element to retrieve. * @param [defaultValue] The default value if the index is outside the bounds of the source sequence. * @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence. */ observableProto.elementAtOrDefault = function (index, defaultValue) { return elementAtOrDefault(this, index, true, defaultValue); }; function singleOrDefaultAsync(source, hasDefault, defaultValue) { return new AnonymousObservable(function (observer) { var value = defaultValue, seenValue = false; return source.subscribe(function (x) { if (seenValue) { observer.onError(new Error('Sequence contains more than one element')); } else { value = x; seenValue = true; } }, observer.onError.bind(observer), function () { if (!seenValue && !hasDefault) { observer.onError(new Error(sequenceContainsNoElements)); } else { observer.onNext(value); observer.onCompleted(); } }); }); } /** * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence. * @example * var res = res = source.single(); * var res = res = source.single(function (x) { return x === 42; }); * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate. */ observableProto.single = function (predicate, thisArg) { return predicate ? this.where(predicate, thisArg).single() : singleOrDefaultAsync(this, false); }; /** * Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence. * @example * var res = res = source.singleOrDefault(); * var res = res = source.singleOrDefault(function (x) { return x === 42; }); * res = source.singleOrDefault(function (x) { return x === 42; }, 0); * res = source.singleOrDefault(null, 0); * @memberOf Observable# * @param {Function} predicate A predicate function to evaluate for elements in the source sequence. * @param [defaultValue] The default value if the index is outside the bounds of the source sequence. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. */ observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) { return predicate? this.where(predicate, thisArg).singleOrDefault(null, defaultValue) : singleOrDefaultAsync(this, true, defaultValue) }; function firstOrDefaultAsync(source, hasDefault, defaultValue) { return new AnonymousObservable(function (observer) { return source.subscribe(function (x) { observer.onNext(x); observer.onCompleted(); }, observer.onError.bind(observer), function () { if (!hasDefault) { observer.onError(new Error(sequenceContainsNoElements)); } else { observer.onNext(defaultValue); observer.onCompleted(); } }); }); } /** * Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence. * @example * var res = res = source.first(); * var res = res = source.first(function (x) { return x > 3; }); * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence. */ observableProto.first = function (predicate, thisArg) { return predicate ? this.where(predicate, thisArg).first() : firstOrDefaultAsync(this, false); }; /** * Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. * @example * var res = res = source.firstOrDefault(); * var res = res = source.firstOrDefault(function (x) { return x > 3; }); * var res = source.firstOrDefault(function (x) { return x > 3; }, 0); * var res = source.firstOrDefault(null, 0); * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. */ observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) { return predicate ? this.where(predicate).firstOrDefault(null, defaultValue) : firstOrDefaultAsync(this, true, defaultValue); }; function lastOrDefaultAsync(source, hasDefault, defaultValue) { return new AnonymousObservable(function (observer) { var value = defaultValue, seenValue = false; return source.subscribe(function (x) { value = x; seenValue = true; }, observer.onError.bind(observer), function () { if (!seenValue && !hasDefault) { observer.onError(new Error(sequenceContainsNoElements)); } else { observer.onNext(value); observer.onCompleted(); } }); }); } /** * Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element. * @example * var res = source.last(); * var res = source.last(function (x) { return x > 3; }); * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate. */ observableProto.last = function (predicate, thisArg) { return predicate ? this.where(predicate, thisArg).last() : lastOrDefaultAsync(this, false); }; /** * Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. * @example * var res = source.lastOrDefault(); * var res = source.lastOrDefault(function (x) { return x > 3; }); * var res = source.lastOrDefault(function (x) { return x > 3; }, 0); * var res = source.lastOrDefault(null, 0); * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param [defaultValue] The default value if no such element exists. If not specified, defaults to null. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists. */ observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) { return predicate ? this.where(predicate, thisArg).lastOrDefault(null, defaultValue) : lastOrDefaultAsync(this, true, defaultValue); }; function findValue (source, predicate, thisArg, yieldIndex) { return new AnonymousObservable(function (observer) { var i = 0; return source.subscribe(function (x) { var shouldRun; try { shouldRun = predicate.call(thisArg, x, i, source); } catch(e) { observer.onError(e); return; } if (shouldRun) { observer.onNext(yieldIndex ? i : x); observer.onCompleted(); } else { i++; } }, observer.onError.bind(observer), function () { observer.onNext(yieldIndex ? -1 : undefined); observer.onCompleted(); }); }); } /** * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence. * @param {Function} predicate The predicate that defines the conditions of the element to search for. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined. */ observableProto.find = function (predicate, thisArg) { return findValue(this, predicate, thisArg, false); }; /** * Searches for an element that matches the conditions defined by the specified predicate, and returns * an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence. * @param {Function} predicate The predicate that defines the conditions of the element to search for. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1. */ observableProto.findIndex = function (predicate, thisArg) { return findValue(this, predicate, thisArg, true); }; /** * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence. * * @example * var res = Rx.Observable.start(function () { console.log('hello'); }); * var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout); * var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console); * * @param {Function} func Function to run asynchronously. * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @returns {Observable} An observable sequence exposing the function's result value, or an exception. * * Remarks * * The function is called immediately, not during the subscription of the resulting sequence. * * Multiple subscriptions to the resulting sequence can observe the function's result. */ Observable.start = function (func, scheduler, context) { return observableToAsync(func, scheduler, context)(); }; /** * Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler. * * @example * var res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3); * var res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3); * var res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello'); * * @param {Function} function Function to convert to an asynchronous function. * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @returns {Function} Asynchronous function. */ var observableToAsync = Observable.toAsync = function (func, scheduler, context) { scheduler || (scheduler = timeoutScheduler); return function () { var args = arguments, subject = new AsyncSubject(); scheduler.schedule(function () { var result; try { result = func.apply(context, args); } catch (e) { subject.onError(e); return; } subject.onNext(result); subject.onCompleted(); }); return subject.asObservable(); }; }; /** * Converts a callback function to an observable sequence. * * @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence. * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next. * @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array. */ Observable.fromCallback = function (func, scheduler, context, selector) { scheduler || (scheduler = immediateScheduler); return function () { var args = slice.call(arguments, 0); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { function handler(e) { var results = e; if (selector) { try { results = selector(arguments); } catch (err) { observer.onError(err); return; } } else { if (results.length === 1) { results = results[0]; } } observer.onNext(results); observer.onCompleted(); } args.push(handler); func.apply(context, args); }); }); }; }; /** * Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format. * @param {Function} func The function to call * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next. * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array. */ Observable.fromNodeCallback = function (func, scheduler, context, selector) { scheduler || (scheduler = immediateScheduler); return function () { var args = slice.call(arguments, 0); return new AnonymousObservable(function (observer) { return scheduler.schedule(function () { function handler(err) { if (err) { observer.onError(err); return; } var results = slice.call(arguments, 1); if (selector) { try { results = selector(results); } catch (e) { observer.onError(e); return; } } else { if (results.length === 1) { results = results[0]; } } observer.onNext(results); observer.onCompleted(); } args.push(handler); func.apply(context, args); }); }); }; }; function fixEvent(event) { var stopPropagation = function () { this.cancelBubble = true; }; var preventDefault = function () { this.bubbledKeyCode = this.keyCode; if (this.ctrlKey) { try { this.keyCode = 0; } catch (e) { } } this.defaultPrevented = true; this.returnValue = false; this.modified = true; }; event || (event = root.event); if (!event.target) { event.target = event.target || event.srcElement; if (event.type == 'mouseover') { event.relatedTarget = event.fromElement; } if (event.type == 'mouseout') { event.relatedTarget = event.toElement; } // Adding stopPropogation and preventDefault to IE if (!event.stopPropagation){ event.stopPropagation = stopPropagation; event.preventDefault = preventDefault; } // Normalize key events switch(event.type){ case 'keypress': var c = ('charCode' in event ? event.charCode : event.keyCode); if (c == 10) { c = 0; event.keyCode = 13; } else if (c == 13 || c == 27) { c = 0; } else if (c == 3) { c = 99; } event.charCode = c; event.keyChar = event.charCode ? String.fromCharCode(event.charCode) : ''; break; } } return event; } function createListener (element, name, handler) { // Node.js specific if (element.addListener) { element.addListener(name, handler); return disposableCreate(function () { element.removeListener(name, handler); }); } // Standards compliant if (element.addEventListener) { element.addEventListener(name, handler, false); return disposableCreate(function () { element.removeEventListener(name, handler, false); }); } if (element.attachEvent) { // IE Specific var innerHandler = function (event) { handler(fixEvent(event)); }; element.attachEvent('on' + name, innerHandler); return disposableCreate(function () { element.detachEvent('on' + name, innerHandler); }); } // Level 1 DOM Events element['on' + name] = handler; return disposableCreate(function () { element['on' + name] = null; }); } function createEventListener (el, eventName, handler) { var disposables = new CompositeDisposable(); // Asume NodeList if (typeof el.item === 'function' && typeof el.length === 'number') { for (var i = 0, len = el.length; i < len; i++) { disposables.add(createEventListener(el.item(i), eventName, handler)); } } else if (el) { disposables.add(createListener(el, eventName, handler)); } return disposables; } // Check for Angular/jQuery/Zepto support var jq = !!root.angular && !!angular.element ? angular.element : (!!root.jQuery ? root.jQuery : ( !!root.Zepto ? root.Zepto : null)); // Check for ember var ember = !!root.Ember && typeof root.Ember.addListener === 'function'; /** * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList. * * @example * var source = Rx.Observable.fromEvent(element, 'mouseup'); * * @param {Object} element The DOMElement or NodeList to attach a listener. * @param {String} eventName The event name to attach the observable sequence. * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next. * @returns {Observable} An observable sequence of events from the specified element and the specified event. */ Observable.fromEvent = function (element, eventName, selector) { if (ember) { return fromEventPattern( function (h) { Ember.addListener(element, eventName, h); }, function (h) { Ember.removeListener(element, eventName, h); }, selector); } if (jq) { var $elem = jq(element); return fromEventPattern( function (h) { $elem.on(eventName, h); }, function (h) { $elem.off(eventName, h); }, selector); } return new AnonymousObservable(function (observer) { return createEventListener( element, eventName, function handler (e) { var results = e; if (selector) { try { results = selector(arguments); } catch (err) { observer.onError(err); return } } observer.onNext(results); }); }).publish().refCount(); }; /** * Creates an observable sequence from an event emitter via an addHandler/removeHandler pair. * @param {Function} addHandler The function to add a handler to the emitter. * @param {Function} [removeHandler] The optional function to remove a handler from an emitter. * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next. * @returns {Observable} An observable sequence which wraps an event from an event emitter */ var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) { return new AnonymousObservable(function (observer) { function innerHandler (e) { var result = e; if (selector) { try { result = selector(arguments); } catch (err) { observer.onError(err); return; } } observer.onNext(result); } var returnValue = addHandler(innerHandler); return disposableCreate(function () { if (removeHandler) { removeHandler(innerHandler, returnValue); } }); }).publish().refCount(); }; /** * Invokes the asynchronous function, surfacing the result through an observable sequence. * @param {Function} functionAsync Asynchronous function which returns a Promise to run. * @returns {Observable} An observable sequence exposing the function's result value, or an exception. */ Observable.startAsync = function (functionAsync) { var promise; try { promise = functionAsync(); } catch (e) { return observableThrow(e); } return observableFromPromise(promise); } var PausableObservable = (function (_super) { inherits(PausableObservable, _super); function subscribe(observer) { var conn = this.source.publish(), subscription = conn.subscribe(observer), connection = disposableEmpty; var pausable = this.subject.distinctUntilChanged().subscribe(function (b) { if (b) { connection = conn.connect(); } else { connection.dispose(); connection = disposableEmpty; } }); return new CompositeDisposable(subscription, connection, pausable); } function PausableObservable(source, subject) { this.source = source; this.subject = subject || new Subject(); this.isPaused = true; _super.call(this, subscribe); } PausableObservable.prototype.pause = function () { if (this.isPaused === true){ return; } this.isPaused = true; this.subject.onNext(false); }; PausableObservable.prototype.resume = function () { if (this.isPaused === false){ return; } this.isPaused = false; this.subject.onNext(true); }; return PausableObservable; }(Observable)); /** * Pauses the underlying observable sequence based upon the observable sequence which yields true/false. * @example * var pauser = new Rx.Subject(); * var source = Rx.Observable.interval(100).pausable(pauser); * @param {Observable} pauser The observable sequence used to pause the underlying sequence. * @returns {Observable} The observable sequence which is paused based upon the pauser. */ observableProto.pausable = function (pauser) { return new PausableObservable(this, pauser); }; function combineLatestSource(source, subject, resultSelector) { return new AnonymousObservable(function (observer) { var n = 2, hasValue = [false, false], hasValueAll = false, isDone = false, values = new Array(n); function next(x, i) { values[i] = x var res; hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { try { res = resultSelector.apply(null, values); } catch (ex) { observer.onError(ex); return; } observer.onNext(res); } else if (isDone) { observer.onCompleted(); } } return new CompositeDisposable( source.subscribe( function (x) { next(x, 0); }, observer.onError.bind(observer), function () { isDone = true; observer.onCompleted(); }), subject.subscribe( function (x) { next(x, 1); }, observer.onError.bind(observer)) ); }); } var PausableBufferedObservable = (function (_super) { inherits(PausableBufferedObservable, _super); function subscribe(observer) { var q = [], previous = true; var subscription = combineLatestSource( this.source, this.subject.distinctUntilChanged(), function (data, shouldFire) { return { data: data, shouldFire: shouldFire }; }) .subscribe( function (results) { if (results.shouldFire && previous) { observer.onNext(results.data); } if (results.shouldFire && !previous) { while (q.length > 0) { observer.onNext(q.shift()); } previous = true; } else if (!results.shouldFire && !previous) { q.push(results.data); } else if (!results.shouldFire && previous) { previous = false; } }, function (err) { // Empty buffer before sending error while (q.length > 0) { observer.onNext(q.shift()); } observer.onError(err); }, function () { // Empty buffer before sending completion while (q.length > 0) { observer.onNext(q.shift()); } observer.onCompleted(); } ); this.subject.onNext(false); return subscription; } function PausableBufferedObservable(source, subject) { this.source = source; this.subject = subject || new Subject(); this.isPaused = true; _super.call(this, subscribe); } PausableBufferedObservable.prototype.pause = function () { if (this.isPaused === true){ return; } this.isPaused = true; this.subject.onNext(false); }; PausableBufferedObservable.prototype.resume = function () { if (this.isPaused === false){ return; } this.isPaused = false; this.subject.onNext(true); }; return PausableBufferedObservable; }(Observable)); /** * Pauses the underlying observable sequence based upon the observable sequence which yields true/false, * and yields the values that were buffered while paused. * @example * var pauser = new Rx.Subject(); * var source = Rx.Observable.interval(100).pausableBuffered(pauser); * @param {Observable} pauser The observable sequence used to pause the underlying sequence. * @returns {Observable} The observable sequence which is paused based upon the pauser. */ observableProto.pausableBuffered = function (subject) { return new PausableBufferedObservable(this, subject); }; /** * Attaches a controller to the observable sequence with the ability to queue. * @example * var source = Rx.Observable.interval(100).controlled(); * source.request(3); // Reads 3 values * @param {Observable} pauser The observable sequence used to pause the underlying sequence. * @returns {Observable} The observable sequence which is paused based upon the pauser. */ observableProto.controlled = function (enableQueue) { if (enableQueue == null) { enableQueue = true; } return new ControlledObservable(this, enableQueue); }; var ControlledObservable = (function (_super) { inherits(ControlledObservable, _super); function subscribe (observer) { return this.source.subscribe(observer); } function ControlledObservable (source, enableQueue) { _super.call(this, subscribe); this.subject = new ControlledSubject(enableQueue); this.source = source.multicast(this.subject).refCount(); } ControlledObservable.prototype.request = function (numberOfItems) { if (numberOfItems == null) { numberOfItems = -1; } return this.subject.request(numberOfItems); }; return ControlledObservable; }(Observable)); var ControlledSubject = Rx.ControlledSubject = (function (_super) { function subscribe (observer) { return this.subject.subscribe(observer); } inherits(ControlledSubject, _super); function ControlledSubject(enableQueue) { if (enableQueue == null) { enableQueue = true; } _super.call(this, subscribe); this.subject = new Subject(); this.enableQueue = enableQueue; this.queue = enableQueue ? [] : null; this.requestedCount = 0; this.requestedDisposable = disposableEmpty; this.error = null; this.hasFailed = false; this.hasCompleted = false; this.controlledDisposable = disposableEmpty; } addProperties(ControlledSubject.prototype, Observer, { onCompleted: function () { checkDisposed.call(this); this.hasCompleted = true; if (!this.enableQueue || this.queue.length === 0) { this.subject.onCompleted(); } }, onError: function (error) { checkDisposed.call(this); this.hasFailed = true; this.error = error; if (!this.enableQueue || this.queue.length === 0) { this.subject.onError(error); } }, onNext: function (value) { checkDisposed.call(this); var hasRequested = false; if (this.requestedCount === 0) { if (this.enableQueue) { this.queue.push(value); } } else { if (this.requestedCount !== -1) { if (this.requestedCount-- === 0) { this.disposeCurrentRequest(); } } hasRequested = true; } if (hasRequested) { this.subject.onNext(value); } }, _processRequest: function (numberOfItems) { if (this.enableQueue) { //console.log('queue length', this.queue.length); while (this.queue.length >= numberOfItems && numberOfItems > 0) { //console.log('number of items', numberOfItems); this.subject.onNext(this.queue.shift()); numberOfItems--; } if (this.queue.length !== 0) { return { numberOfItems: numberOfItems, returnValue: true }; } else { return { numberOfItems: numberOfItems, returnValue: false }; } } if (this.hasFailed) { this.subject.onError(this.error); this.controlledDisposable.dispose(); this.controlledDisposable = disposableEmpty; } else if (this.hasCompleted) { this.subject.onCompleted(); this.controlledDisposable.dispose(); this.controlledDisposable = disposableEmpty; } return { numberOfItems: numberOfItems, returnValue: false }; }, request: function (number) { checkDisposed.call(this); this.disposeCurrentRequest(); var self = this, r = this._processRequest(number); number = r.numberOfItems; if (!r.returnValue) { this.requestedCount = number; this.requestedDisposable = disposableCreate(function () { self.requestedCount = 0; }); return this.requestedDisposable } else { return disposableEmpty; } }, disposeCurrentRequest: function () { this.requestedDisposable.dispose(); this.requestedDisposable = disposableEmpty; }, dispose: function () { this.isDisposed = true; this.error = null; this.subject.dispose(); this.requestedDisposable.dispose(); } }); return ControlledSubject; }(Observable)); /** * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay. * * @example * 1 - res = source.multicast(observable); * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; }); * * @param {Function|Subject} subjectOrSubjectSelector * Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function. * Or: * Subject to push source elements into. * * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.multicast = function (subjectOrSubjectSelector, selector) { var source = this; return typeof subjectOrSubjectSelector === 'function' ? new AnonymousObservable(function (observer) { var connectable = source.multicast(subjectOrSubjectSelector()); return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect()); }) : new ConnectableObservable(source, subjectOrSubjectSelector); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence. * This operator is a specialization of Multicast using a regular Subject. * * @example * var resres = source.publish(); * var res = source.publish(function (x) { return x; }); * * @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publish = function (selector) { return !selector ? this.multicast(new Subject()) : this.multicast(function () { return new Subject(); }, selector); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence. * This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * * @example * var res = source.share(); * * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.share = function () { return this.publish(null).refCount(); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. * This operator is a specialization of Multicast using a AsyncSubject. * * @example * var res = source.publishLast(); * var res = source.publishLast(function (x) { return x; }); * * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publishLast = function (selector) { return !selector ? this.multicast(new AsyncSubject()) : this.multicast(function () { return new AsyncSubject(); }, selector); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. * This operator is a specialization of Multicast using a BehaviorSubject. * * @example * var res = source.publishValue(42); * var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42); * * @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on. * @param {Mixed} initialValue Initial value received by observers upon subscription. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publishValue = function (initialValueOrSelector, initialValue) { return arguments.length === 2 ? this.multicast(function () { return new BehaviorSubject(initialValue); }, initialValueOrSelector) : this.multicast(new BehaviorSubject(initialValueOrSelector)); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue. * This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * * @example * var res = source.shareValue(42); * * @param {Mixed} initialValue Initial value received by observers upon subscription. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.shareValue = function (initialValue) { return this.publishValue(initialValue). refCount(); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer. * This operator is a specialization of Multicast using a ReplaySubject. * * @example * var res = source.replay(null, 3); * var res = source.replay(null, 3, 500); * var res = source.replay(null, 3, 500, scheduler); * var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler); * * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy. * @param bufferSize [Optional] Maximum element count of the replay buffer. * @param window [Optional] Maximum time length of the replay buffer. * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.replay = function (selector, bufferSize, window, scheduler) { return !selector ? this.multicast(new ReplaySubject(bufferSize, window, scheduler)) : this.multicast(function () { return new ReplaySubject(bufferSize, window, scheduler); }, selector); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer. * This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * * @example * var res = source.replayWhileObserved(3); * var res = source.replayWhileObserved(3, 500); * var res = source.replayWhileObserved(3, 500, scheduler); * * @param bufferSize [Optional] Maximum element count of the replay buffer. * @param window [Optional] Maximum time length of the replay buffer. * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.replayWhileObserved = function (bufferSize, window, scheduler) { return this.replay(null, bufferSize, window, scheduler).refCount(); }; /** @private */ var InnerSubscription = function (subject, observer) { this.subject = subject; this.observer = observer; }; /** * @private * @memberOf InnerSubscription */ InnerSubscription.prototype.dispose = function () { if (!this.subject.isDisposed && this.observer !== null) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); this.observer = null; } }; /** * Represents a value that changes over time. * Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications. */ var BehaviorSubject = Rx.BehaviorSubject = (function (_super) { function subscribe(observer) { checkDisposed.call(this); if (!this.isStopped) { this.observers.push(observer); observer.onNext(this.value); return new InnerSubscription(this, observer); } var ex = this.exception; if (ex) { observer.onError(ex); } else { observer.onCompleted(); } return disposableEmpty; } inherits(BehaviorSubject, _super); /** * @constructor * Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value. * @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet. */ function BehaviorSubject(value) { _super.call(this, subscribe); this.value = value, this.observers = [], this.isDisposed = false, this.isStopped = false, this.exception = null; } addProperties(BehaviorSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; for (var i = 0, len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers = []; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; this.exception = error; for (var i = 0, len = os.length; i < len; i++) { os[i].onError(error); } this.observers = []; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed.call(this); if (!this.isStopped) { this.value = value; var os = this.observers.slice(0); for (var i = 0, len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.value = null; this.exception = null; } }); return BehaviorSubject; }(Observable)); /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies. */ var ReplaySubject = Rx.ReplaySubject = (function (_super) { function RemovableDisposable (subject, observer) { this.subject = subject; this.observer = observer; }; RemovableDisposable.prototype.dispose = function () { this.observer.dispose(); if (!this.subject.isDisposed) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); } }; function subscribe(observer) { var so = new ScheduledObserver(this.scheduler, observer), subscription = new RemovableDisposable(this, so); checkDisposed.call(this); this._trim(this.scheduler.now()); this.observers.push(so); var n = this.q.length; for (var i = 0, len = this.q.length; i < len; i++) { so.onNext(this.q[i].value); } if (this.hasError) { n++; so.onError(this.error); } else if (this.isStopped) { n++; so.onCompleted(); } so.ensureActive(n); return subscription; } inherits(ReplaySubject, _super); /** * Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler. * @param {Number} [bufferSize] Maximum element count of the replay buffer. * @param {Number} [windowSize] Maximum time length of the replay buffer. * @param {Scheduler} [scheduler] Scheduler the observers are invoked on. */ function ReplaySubject(bufferSize, windowSize, scheduler) { this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize; this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize; this.scheduler = scheduler || currentThreadScheduler; this.q = []; this.observers = []; this.isStopped = false; this.isDisposed = false; this.hasError = false; this.error = null; _super.call(this, subscribe); } addProperties(ReplaySubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /* @private */ _trim: function (now) { while (this.q.length > this.bufferSize) { this.q.shift(); } while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) { this.q.shift(); } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { var observer; checkDisposed.call(this); if (!this.isStopped) { var now = this.scheduler.now(); this.q.push({ interval: now, value: value }); this._trim(now); var o = this.observers.slice(0); for (var i = 0, len = o.length; i < len; i++) { observer = o[i]; observer.onNext(value); observer.ensureActive(); } } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { var observer; checkDisposed.call(this); if (!this.isStopped) { this.isStopped = true; this.error = error; this.hasError = true; var now = this.scheduler.now(); this._trim(now); var o = this.observers.slice(0); for (var i = 0, len = o.length; i < len; i++) { observer = o[i]; observer.onError(error); observer.ensureActive(); } this.observers = []; } }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { var observer; checkDisposed.call(this); if (!this.isStopped) { this.isStopped = true; var now = this.scheduler.now(); this._trim(now); var o = this.observers.slice(0); for (var i = 0, len = o.length; i < len; i++) { observer = o[i]; observer.onCompleted(); observer.ensureActive(); } this.observers = []; } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); return ReplaySubject; }(Observable)); /** @private */ var ConnectableObservable = Rx.ConnectableObservable = (function (_super) { inherits(ConnectableObservable, _super); /** * @constructor * @private */ function ConnectableObservable(source, subject) { var state = { subject: subject, source: source.asObservable(), hasSubscription: false, subscription: null }; this.connect = function () { if (!state.hasSubscription) { state.hasSubscription = true; state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () { state.hasSubscription = false; })); } return state.subscription; }; function subscribe(observer) { return state.subject.subscribe(observer); } _super.call(this, subscribe); } /** * @private * @memberOf ConnectableObservable */ ConnectableObservable.prototype.connect = function () { return this.connect(); }; /** * @private * @memberOf ConnectableObservable */ ConnectableObservable.prototype.refCount = function () { var connectableSubscription = null, count = 0, source = this; return new AnonymousObservable(function (observer) { var shouldConnect, subscription; count++; shouldConnect = count === 1; subscription = source.subscribe(observer); if (shouldConnect) { connectableSubscription = source.connect(); } return disposableCreate(function () { subscription.dispose(); count--; if (count === 0) { connectableSubscription.dispose(); } }); }); }; return ConnectableObservable; }(Observable)); // Real Dictionary var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647]; var noSuchkey = "no such key"; var duplicatekey = "duplicate key"; function isPrime(candidate) { if (candidate & 1 === 0) { return candidate === 2; } var num1 = Math.sqrt(candidate), num2 = 3; while (num2 <= num1) { if (candidate % num2 === 0) { return false; } num2 += 2; } return true; } function getPrime(min) { var index, num, candidate; for (index = 0; index < primes.length; ++index) { num = primes[index]; if (num >= min) { return num; } } candidate = min | 1; while (candidate < primes[primes.length - 1]) { if (isPrime(candidate)) { return candidate; } candidate += 2; } return min; } function stringHashFn(str) { var hash = 757602046; if (!str.length) { return hash; } for (var i = 0, len = str.length; i < len; i++) { var character = str.charCodeAt(i); hash = ((hash<<5)-hash)+character; hash = hash & hash; } return hash; } function numberHashFn(key) { var c2 = 0x27d4eb2d; key = (key ^ 61) ^ (key >>> 16); key = key + (key << 3); key = key ^ (key >>> 4); key = key * c2; key = key ^ (key >>> 15); return key; } var getHashCode = (function () { var uniqueIdCounter = 0; return function (obj) { if (obj == null) { throw new Error(noSuchkey); } // Check for built-ins before tacking on our own for any object if (typeof obj === 'string') { return stringHashFn(obj); } if (typeof obj === 'number') { return numberHashFn(obj); } if (typeof obj === 'boolean') { return obj === true ? 1 : 0; } if (obj instanceof Date) { return obj.getTime(); } if (obj.getHashCode) { return obj.getHashCode(); } var id = 17 * uniqueIdCounter++; obj.getHashCode = function () { return id; }; return id; }; } ()); function newEntry() { return { key: null, value: null, next: 0, hashCode: 0 }; } // Dictionary implementation var Dictionary = function (capacity, comparer) { if (capacity < 0) { throw new Error('out of range') } if (capacity > 0) { this._initialize(capacity); } this.comparer = comparer || defaultComparer; this.freeCount = 0; this.size = 0; this.freeList = -1; }; Dictionary.prototype._initialize = function (capacity) { var prime = getPrime(capacity), i; this.buckets = new Array(prime); this.entries = new Array(prime); for (i = 0; i < prime; i++) { this.buckets[i] = -1; this.entries[i] = newEntry(); } this.freeList = -1; }; Dictionary.prototype.count = function () { return this.size; }; Dictionary.prototype.add = function (key, value) { return this._insert(key, value, true); }; Dictionary.prototype._insert = function (key, value, add) { if (!this.buckets) { this._initialize(0); } var index3; var num = getHashCode(key) & 2147483647; var index1 = num % this.buckets.length; for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) { if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) { if (add) { throw new Error(duplicatekey); } this.entries[index2].value = value; return; } } if (this.freeCount > 0) { index3 = this.freeList; this.freeList = this.entries[index3].next; --this.freeCount; } else { if (this.size === this.entries.length) { this._resize(); index1 = num % this.buckets.length; } index3 = this.size; ++this.size; } this.entries[index3].hashCode = num; this.entries[index3].next = this.buckets[index1]; this.entries[index3].key = key; this.entries[index3].value = value; this.buckets[index1] = index3; }; Dictionary.prototype._resize = function () { var prime = getPrime(this.size * 2), numArray = new Array(prime); for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; } var entryArray = new Array(prime); for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; } for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); } for (var index1 = 0; index1 < this.size; ++index1) { var index2 = entryArray[index1].hashCode % prime; entryArray[index1].next = numArray[index2]; numArray[index2] = index1; } this.buckets = numArray; this.entries = entryArray; }; Dictionary.prototype.remove = function (key) { if (this.buckets) { var num = getHashCode(key) & 2147483647; var index1 = num % this.buckets.length; var index2 = -1; for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) { if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) { if (index2 < 0) { this.buckets[index1] = this.entries[index3].next; } else { this.entries[index2].next = this.entries[index3].next; } this.entries[index3].hashCode = -1; this.entries[index3].next = this.freeList; this.entries[index3].key = null; this.entries[index3].value = null; this.freeList = index3; ++this.freeCount; return true; } else { index2 = index3; } } } return false; }; Dictionary.prototype.clear = function () { var index, len; if (this.size <= 0) { return; } for (index = 0, len = this.buckets.length; index < len; ++index) { this.buckets[index] = -1; } for (index = 0; index < this.size; ++index) { this.entries[index] = newEntry(); } this.freeList = -1; this.size = 0; }; Dictionary.prototype._findEntry = function (key) { if (this.buckets) { var num = getHashCode(key) & 2147483647; for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) { if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) { return index; } } } return -1; }; Dictionary.prototype.count = function () { return this.size - this.freeCount; }; Dictionary.prototype.tryGetValue = function (key) { var entry = this._findEntry(key); if (entry >= 0) { return this.entries[entry].value; } return undefined; }; Dictionary.prototype.getValues = function () { var index = 0, results = []; if (this.entries) { for (var index1 = 0; index1 < this.size; index1++) { if (this.entries[index1].hashCode >= 0) { results[index++] = this.entries[index1].value; } } } return results; }; Dictionary.prototype.get = function (key) { var entry = this._findEntry(key); if (entry >= 0) { return this.entries[entry].value; } throw new Error(noSuchkey); }; Dictionary.prototype.set = function (key, value) { this._insert(key, value, false); }; Dictionary.prototype.containskey = function (key) { return this._findEntry(key) >= 0; }; /** * Correlates the elements of two sequences based on overlapping durations. * * @param {Observable} right The right observable sequence to join elements for. * @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap. * @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap. * @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs. * @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration. */ observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) { var left = this; return new AnonymousObservable(function (observer) { var group = new CompositeDisposable(), leftDone = false, leftId = 0, leftMap = new Dictionary(), rightDone = false, rightId = 0, rightMap = new Dictionary(); group.add(left.subscribe(function (value) { var duration, expire, id = leftId++, md = new SingleAssignmentDisposable(), result, values; leftMap.add(id, value); group.add(md); expire = function () { if (leftMap.remove(id) && leftMap.count() === 0 && leftDone) { observer.onCompleted(); } return group.remove(md); }; try { duration = leftDurationSelector(value); } catch (e) { observer.onError(e); return; } md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), function () { expire(); })); values = rightMap.getValues(); for (var i = 0; i < values.length; i++) { try { result = resultSelector(value, values[i]); } catch (exception) { observer.onError(exception); return; } observer.onNext(result); } }, observer.onError.bind(observer), function () { leftDone = true; if (rightDone || leftMap.count() === 0) { observer.onCompleted(); } })); group.add(right.subscribe(function (value) { var duration, expire, id = rightId++, md = new SingleAssignmentDisposable(), result, values; rightMap.add(id, value); group.add(md); expire = function () { if (rightMap.remove(id) && rightMap.count() === 0 && rightDone) { observer.onCompleted(); } return group.remove(md); }; try { duration = rightDurationSelector(value); } catch (exception) { observer.onError(exception); return; } md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), function () { expire(); })); values = leftMap.getValues(); for (var i = 0; i < values.length; i++) { try { result = resultSelector(values[i], value); } catch (exception) { observer.onError(exception); return; } observer.onNext(result); } }, observer.onError.bind(observer), function () { rightDone = true; if (leftDone || rightMap.count() === 0) { observer.onCompleted(); } })); return group; }); }; /** * Correlates the elements of two sequences based on overlapping durations, and groups the results. * * @param {Observable} right The right observable sequence to join elements for. * @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap. * @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap. * @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element. * @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration. */ observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) { var left = this; return new AnonymousObservable(function (observer) { var nothing = function () {}; var group = new CompositeDisposable(); var r = new RefCountDisposable(group); var leftMap = new Dictionary(); var rightMap = new Dictionary(); var leftID = 0; var rightID = 0; group.add(left.subscribe( function (value) { var s = new Subject(); var id = leftID++; leftMap.add(id, s); var i, len, leftValues, rightValues; var result; try { result = resultSelector(value, addRef(s, r)); } catch (e) { leftValues = leftMap.getValues(); for (i = 0, len = leftValues.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); return; } observer.onNext(result); rightValues = rightMap.getValues(); for (i = 0, len = rightValues.length; i < len; i++) { s.onNext(rightValues[i]); } var md = new SingleAssignmentDisposable(); group.add(md); var expire = function () { if (leftMap.remove(id)) { s.onCompleted(); } group.remove(md); }; var duration; try { duration = leftDurationSelector(value); } catch (e) { leftValues = leftMap.getValues(); for (i = 0, len = leftMap.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); return; } md.setDisposable(duration.take(1).subscribe( nothing, function (e) { leftValues = leftMap.getValues(); for (i = 0, len = leftValues.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); }, expire) ); }, function (e) { var leftValues = leftMap.getValues(); for (var i = 0, len = leftValues.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); }, observer.onCompleted.bind(observer))); group.add(right.subscribe( function (value) { var leftValues, i, len; var id = rightID++; rightMap.add(id, value); var md = new SingleAssignmentDisposable(); group.add(md); var expire = function () { rightMap.remove(id); group.remove(md); }; var duration; try { duration = rightDurationSelector(value); } catch (e) { leftValues = leftMap.getValues(); for (i = 0, len = leftMap.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); return; } md.setDisposable(duration.take(1).subscribe( nothing, function (e) { leftValues = leftMap.getValues(); for (i = 0, len = leftMap.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); }, expire) ); leftValues = leftMap.getValues(); for (i = 0, len = leftValues.length; i < len; i++) { leftValues[i].onNext(value); } }, function (e) { var leftValues = leftMap.getValues(); for (var i = 0, len = leftValues.length; i < len; i++) { leftValues[i].onError(e); } observer.onError(e); })); return r; }); }; /** * Projects each element of an observable sequence into zero or more buffers. * * @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows). * @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored. * @returns {Observable} An observable sequence of windows. */ observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) { return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); }); }; /** * Projects each element of an observable sequence into zero or more windows. * * @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows). * @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored. * @returns {Observable} An observable sequence of windows. */ observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) { if (arguments.length === 1 && typeof arguments[0] !== 'function') { return observableWindowWithBounaries.call(this, windowOpeningsOrClosingSelector); } return typeof windowOpeningsOrClosingSelector === 'function' ? observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) : observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector); }; function observableWindowWithOpenings(windowOpenings, windowClosingSelector) { return windowOpenings.groupJoin(this, windowClosingSelector, function () { return observableEmpty(); }, function (_, window) { return window; }); } function observableWindowWithBounaries(windowBoundaries) { var source = this; return new AnonymousObservable(function (observer) { var window = new Subject(), d = new CompositeDisposable(), r = new RefCountDisposable(d); observer.onNext(addRef(window, r)); d.add(source.subscribe(function (x) { window.onNext(x); }, function (err) { window.onError(err); observer.onError(err); }, function () { window.onCompleted(); observer.onCompleted(); })); d.add(windowBoundaries.subscribe(function (w) { window.onCompleted(); window = new Subject(); observer.onNext(addRef(window, r)); }, function (err) { window.onError(err); observer.onError(err); }, function () { window.onCompleted(); observer.onCompleted(); })); return r; }); } function observableWindowWithClosingSelector(windowClosingSelector) { var source = this; return new AnonymousObservable(function (observer) { var createWindowClose, m = new SerialDisposable(), d = new CompositeDisposable(m), r = new RefCountDisposable(d), window = new Subject(); observer.onNext(addRef(window, r)); d.add(source.subscribe(function (x) { window.onNext(x); }, function (ex) { window.onError(ex); observer.onError(ex); }, function () { window.onCompleted(); observer.onCompleted(); })); createWindowClose = function () { var m1, windowClose; try { windowClose = windowClosingSelector(); } catch (exception) { observer.onError(exception); return; } m1 = new SingleAssignmentDisposable(); m.setDisposable(m1); m1.setDisposable(windowClose.take(1).subscribe(noop, function (ex) { window.onError(ex); observer.onError(ex); }, function () { window.onCompleted(); window = new Subject(); observer.onNext(addRef(window, r)); createWindowClose(); })); }; createWindowClose(); return r; }); } /** * Returns a new observable that triggers on the second and subsequent triggerings of the input observable. * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair. * The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs. * @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array. */ observableProto.pairwise = function () { var source = this; return new AnonymousObservable(function (observer) { var previous, hasPrevious = false; return source.subscribe( function (x) { if (hasPrevious) { observer.onNext([previous, x]); } else { hasPrevious = true; } previous = x; }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }); }; /** * Returns two observables which partition the observations of the source by the given function. * The first will trigger observations for those values for which the predicate returns true. * The second will trigger observations for those values where the predicate returns false. * The predicate is executed once for each subscribed observer. * Both also propagate all error observations arising from the source and each completes * when the source completes. * @param {Function} predicate * The function to determine which output Observable will trigger a particular observation. * @returns {Array} * An array of observables. The first triggers when the predicate returns true, * and the second triggers when the predicate returns false. */ observableProto.partition = function(predicate, thisArg) { var published = this.publish().refCount(); return [ published.filter(predicate, thisArg), published.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); }) ]; }; function enumerableWhile(condition, source) { return new Enumerable(function () { return new Enumerator(function () { return condition() ? { done: false, value: source } : { done: true, value: undefined }; }); }); } /** * Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions. * This operator allows for a fluent style of writing queries that use the same sequence multiple times. * * @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.letBind = observableProto['let'] = function (func) { return func(this); }; /** * Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9 * * @example * 1 - res = Rx.Observable.if(condition, obs1); * 2 - res = Rx.Observable.if(condition, obs1, obs2); * 3 - res = Rx.Observable.if(condition, obs1, scheduler); * @param {Function} condition The condition which determines if the thenSource or elseSource will be run. * @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler. * @returns {Observable} An observable sequence which is either the thenSource or elseSource. */ Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) { return observableDefer(function () { elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty()); isPromise(thenSource) && (thenSource = observableFromPromise(thenSource)); isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler)); // Assume a scheduler for empty only typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler)); return condition() ? thenSource : elseSourceOrScheduler; }); }; /** * Concatenates the observable sequences obtained by running the specified result selector for each element in source. * There is an alias for this method called 'forIn' for browsers <IE9 * @param {Array} sources An array of values to turn into an observable sequence. * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence. * @returns {Observable} An observable sequence from the concatenated observable sequences. */ Observable['for'] = Observable.forIn = function (sources, resultSelector) { return enumerableFor(sources, resultSelector).concat(); }; /** * Repeats source as long as condition holds emulating a while loop. * There is an alias for this method called 'whileDo' for browsers <IE9 * * @param {Function} condition The condition which determines if the source will be repeated. * @param {Observable} source The observable sequence that will be run if the condition function returns true. * @returns {Observable} An observable sequence which is repeated as long as the condition holds. */ var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) { isPromise(source) && (source = observableFromPromise(source)); return enumerableWhile(condition, source).concat(); }; /** * Repeats source as long as condition holds emulating a do while loop. * * @param {Function} condition The condition which determines if the source will be repeated. * @param {Observable} source The observable sequence that will be run if the condition function returns true. * @returns {Observable} An observable sequence which is repeated as long as the condition holds. */ observableProto.doWhile = function (condition) { return observableConcat([this, observableWhileDo(condition, this)]); }; /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers <IE9. * * @example * 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }); * 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0); * 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler); * * @param {Function} selector The function which extracts the value for to test in a case statement. * @param {Array} sources A object which has keys which correspond to the case statement labels. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler. * * @returns {Observable} An observable sequence which is determined by a case statement. */ Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) { return observableDefer(function () { defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty()); typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler)); var result = sources[selector()]; isPromise(result) && (result = observableFromPromise(result)); return result || defaultSourceOrScheduler; }); }; /** * Expands an observable sequence by recursively invoking selector. * * @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again. * @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler. * @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion. */ observableProto.expand = function (selector, scheduler) { scheduler || (scheduler = immediateScheduler); var source = this; return new AnonymousObservable(function (observer) { var q = [], m = new SerialDisposable(), d = new CompositeDisposable(m), activeCount = 0, isAcquired = false; var ensureActive = function () { var isOwner = false; if (q.length > 0) { isOwner = !isAcquired; isAcquired = true; } if (isOwner) { m.setDisposable(scheduler.scheduleRecursive(function (self) { var work; if (q.length > 0) { work = q.shift(); } else { isAcquired = false; return; } var m1 = new SingleAssignmentDisposable(); d.add(m1); m1.setDisposable(work.subscribe(function (x) { observer.onNext(x); var result = null; try { result = selector(x); } catch (e) { observer.onError(e); } q.push(result); activeCount++; ensureActive(); }, observer.onError.bind(observer), function () { d.remove(m1); activeCount--; if (activeCount === 0) { observer.onCompleted(); } })); self(); })); } }; q.push(source); activeCount++; ensureActive(); return d; }); }; /** * Runs all observable sequences in parallel and collect their last elements. * * @example * 1 - res = Rx.Observable.forkJoin([obs1, obs2]); * 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...); * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences. */ Observable.forkJoin = function () { var allSources = argsOrArray(arguments, 0); return new AnonymousObservable(function (subscriber) { var count = allSources.length; if (count === 0) { subscriber.onCompleted(); return disposableEmpty; } var group = new CompositeDisposable(), finished = false, hasResults = new Array(count), hasCompleted = new Array(count), results = new Array(count); for (var idx = 0; idx < count; idx++) { (function (i) { var source = allSources[i]; isPromise(source) && (source = observableFromPromise(source)); group.add( source.subscribe( function (value) { if (!finished) { hasResults[i] = true; results[i] = value; } }, function (e) { finished = true; subscriber.onError(e); group.dispose(); }, function () { if (!finished) { if (!hasResults[i]) { subscriber.onCompleted(); return; } hasCompleted[i] = true; for (var ix = 0; ix < count; ix++) { if (!hasCompleted[ix]) { return; } } finished = true; subscriber.onNext(results); subscriber.onCompleted(); } })); })(idx); } return group; }); }; /** * Runs two observable sequences in parallel and combines their last elemenets. * * @param {Observable} second Second observable sequence. * @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences. * @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences. */ observableProto.forkJoin = function (second, resultSelector) { var first = this; return new AnonymousObservable(function (observer) { var leftStopped = false, rightStopped = false, hasLeft = false, hasRight = false, lastLeft, lastRight, leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(second) && (second = observableFromPromise(second)); leftSubscription.setDisposable( first.subscribe(function (left) { hasLeft = true; lastLeft = left; }, function (err) { rightSubscription.dispose(); observer.onError(err); }, function () { leftStopped = true; if (rightStopped) { if (!hasLeft) { observer.onCompleted(); } else if (!hasRight) { observer.onCompleted(); } else { var result; try { result = resultSelector(lastLeft, lastRight); } catch (e) { observer.onError(e); return; } observer.onNext(result); observer.onCompleted(); } } }) ); rightSubscription.setDisposable( second.subscribe(function (right) { hasRight = true; lastRight = right; }, function (err) { leftSubscription.dispose(); observer.onError(err); }, function () { rightStopped = true; if (leftStopped) { if (!hasLeft) { observer.onCompleted(); } else if (!hasRight) { observer.onCompleted(); } else { var result; try { result = resultSelector(lastLeft, lastRight); } catch (e) { observer.onError(e); return; } observer.onNext(result); observer.onCompleted(); } } }) ); return new CompositeDisposable(leftSubscription, rightSubscription); }); }; /** * Comonadic bind operator. * @param {Function} selector A transform function to apply to each element. * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler. * @returns {Observable} An observable sequence which results from the comonadic bind operation. */ observableProto.manySelect = function (selector, scheduler) { scheduler || (scheduler = immediateScheduler); var source = this; return observableDefer(function () { var chain; return source .select( function (x) { var curr = new ChainObservable(x); if (chain) { chain.onNext(x); } chain = curr; return curr; }) .doAction( noop, function (e) { if (chain) { chain.onError(e); } }, function () { if (chain) { chain.onCompleted(); } }) .observeOn(scheduler) .select(function (x, i, o) { return selector(x, i, o); }); }); }; var ChainObservable = (function (_super) { function subscribe (observer) { var self = this, g = new CompositeDisposable(); g.add(currentThreadScheduler.schedule(function () { observer.onNext(self.head); g.add(self.tail.mergeObservable().subscribe(observer)); })); return g; } inherits(ChainObservable, _super); function ChainObservable(head) { _super.call(this, subscribe); this.head = head; this.tail = new AsyncSubject(); } addProperties(ChainObservable.prototype, Observer, { onCompleted: function () { this.onNext(Observable.empty()); }, onError: function (e) { this.onNext(Observable.throwException(e)); }, onNext: function (v) { this.tail.onNext(v); this.tail.onCompleted(); } }); return ChainObservable; }(Observable)); /** @private */ var Map = (function () { /** * @constructor * @private */ function Map() { this.keys = []; this.values = []; } /** * @private * @memberOf Map# */ Map.prototype['delete'] = function (key) { var i = this.keys.indexOf(key); if (i !== -1) { this.keys.splice(i, 1); this.values.splice(i, 1); } return i !== -1; }; /** * @private * @memberOf Map# */ Map.prototype.get = function (key, fallback) { var i = this.keys.indexOf(key); return i !== -1 ? this.values[i] : fallback; }; /** * @private * @memberOf Map# */ Map.prototype.set = function (key, value) { var i = this.keys.indexOf(key); if (i !== -1) { this.values[i] = value; } this.values[this.keys.push(key) - 1] = value; }; /** * @private * @memberOf Map# */ Map.prototype.size = function () { return this.keys.length; }; /** * @private * @memberOf Map# */ Map.prototype.has = function (key) { return this.keys.indexOf(key) !== -1; }; /** * @private * @memberOf Map# */ Map.prototype.getKeys = function () { return this.keys.slice(0); }; /** * @private * @memberOf Map# */ Map.prototype.getValues = function () { return this.values.slice(0); }; return Map; }()); /** * @constructor * Represents a join pattern over observable sequences. */ function Pattern(patterns) { this.patterns = patterns; } /** * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value. * * @param other Observable sequence to match in addition to the current pattern. * @return Pattern object that matches when all observable sequences in the pattern have an available value. */ Pattern.prototype.and = function (other) { var patterns = this.patterns.slice(0); patterns.push(other); return new Pattern(patterns); }; /** * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values. * * @param selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern. * @return Plan that produces the projected values, to be fed (with other plans) to the when operator. */ Pattern.prototype.then = function (selector) { return new Plan(this, selector); }; function Plan(expression, selector) { this.expression = expression; this.selector = selector; } Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) { var self = this; var joinObservers = []; for (var i = 0, len = this.expression.patterns.length; i < len; i++) { joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer))); } var activePlan = new ActivePlan(joinObservers, function () { var result; try { result = self.selector.apply(self, arguments); } catch (exception) { observer.onError(exception); return; } observer.onNext(result); }, function () { for (var j = 0, jlen = joinObservers.length; j < jlen; j++) { joinObservers[j].removeActivePlan(activePlan); } deactivate(activePlan); }); for (i = 0, len = joinObservers.length; i < len; i++) { joinObservers[i].addActivePlan(activePlan); } return activePlan; }; function planCreateObserver(externalSubscriptions, observable, onError) { var entry = externalSubscriptions.get(observable); if (!entry) { var observer = new JoinObserver(observable, onError); externalSubscriptions.set(observable, observer); return observer; } return entry; } // Active Plan function ActivePlan(joinObserverArray, onNext, onCompleted) { var i, joinObserver; this.joinObserverArray = joinObserverArray; this.onNext = onNext; this.onCompleted = onCompleted; this.joinObservers = new Map(); for (i = 0; i < this.joinObserverArray.length; i++) { joinObserver = this.joinObserverArray[i]; this.joinObservers.set(joinObserver, joinObserver); } } ActivePlan.prototype.dequeue = function () { var values = this.joinObservers.getValues(); for (var i = 0, len = values.length; i < len; i++) { values[i].queue.shift(); } }; ActivePlan.prototype.match = function () { var firstValues, i, len, isCompleted, values, hasValues = true; for (i = 0, len = this.joinObserverArray.length; i < len; i++) { if (this.joinObserverArray[i].queue.length === 0) { hasValues = false; break; } } if (hasValues) { firstValues = []; isCompleted = false; for (i = 0, len = this.joinObserverArray.length; i < len; i++) { firstValues.push(this.joinObserverArray[i].queue[0]); if (this.joinObserverArray[i].queue[0].kind === 'C') { isCompleted = true; } } if (isCompleted) { this.onCompleted(); } else { this.dequeue(); values = []; for (i = 0; i < firstValues.length; i++) { values.push(firstValues[i].value); } this.onNext.apply(this, values); } } }; /** @private */ var JoinObserver = (function (_super) { inherits(JoinObserver, _super); /** * @constructor * @private */ function JoinObserver(source, onError) { _super.call(this); this.source = source; this.onError = onError; this.queue = []; this.activePlans = []; this.subscription = new SingleAssignmentDisposable(); this.isDisposed = false; } var JoinObserverPrototype = JoinObserver.prototype; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.next = function (notification) { if (!this.isDisposed) { if (notification.kind === 'E') { this.onError(notification.exception); return; } this.queue.push(notification); var activePlans = this.activePlans.slice(0); for (var i = 0, len = activePlans.length; i < len; i++) { activePlans[i].match(); } } }; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.error = noop; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.completed = noop; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.addActivePlan = function (activePlan) { this.activePlans.push(activePlan); }; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.subscribe = function () { this.subscription.setDisposable(this.source.materialize().subscribe(this)); }; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.removeActivePlan = function (activePlan) { var idx = this.activePlans.indexOf(activePlan); this.activePlans.splice(idx, 1); if (this.activePlans.length === 0) { this.dispose(); } }; /** * @memberOf JoinObserver# * @private */ JoinObserverPrototype.dispose = function () { _super.prototype.dispose.call(this); if (!this.isDisposed) { this.isDisposed = true; this.subscription.dispose(); } }; return JoinObserver; } (AbstractObserver)); /** * Creates a pattern that matches when both observable sequences have an available value. * * @param right Observable sequence to match with the current sequence. * @return {Pattern} Pattern object that matches when both observable sequences have an available value. */ observableProto.and = function (right) { return new Pattern([this, right]); }; /** * Matches when the observable sequence has an available value and projects the value. * * @param selector Selector that will be invoked for values in the source sequence. * @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator. */ observableProto.then = function (selector) { return new Pattern([this]).then(selector); }; /** * Joins together the results from several patterns. * * @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns. * @returns {Observable} Observable sequence with the results form matching several patterns. */ Observable.when = function () { var plans = argsOrArray(arguments, 0); return new AnonymousObservable(function (observer) { var activePlans = [], externalSubscriptions = new Map(), group, i, len, joinObserver, joinValues, outObserver; outObserver = observerCreate(observer.onNext.bind(observer), function (exception) { var values = externalSubscriptions.getValues(); for (var j = 0, jlen = values.length; j < jlen; j++) { values[j].onError(exception); } observer.onError(exception); }, observer.onCompleted.bind(observer)); try { for (i = 0, len = plans.length; i < len; i++) { activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) { var idx = activePlans.indexOf(activePlan); activePlans.splice(idx, 1); if (activePlans.length === 0) { outObserver.onCompleted(); } })); } } catch (e) { observableThrow(e).subscribe(observer); } group = new CompositeDisposable(); joinValues = externalSubscriptions.getValues(); for (i = 0, len = joinValues.length; i < len; i++) { joinObserver = joinValues[i]; joinObserver.subscribe(); group.add(joinObserver); } return group; }); }; function observableTimerDate(dueTime, scheduler) { return new AnonymousObservable(function (observer) { return scheduler.scheduleWithAbsolute(dueTime, function () { observer.onNext(0); observer.onCompleted(); }); }); } function observableTimerDateAndPeriod(dueTime, period, scheduler) { var p = normalizeTime(period); return new AnonymousObservable(function (observer) { var count = 0, d = dueTime; return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { var now; if (p > 0) { now = scheduler.now(); d = d + p; if (d <= now) { d = now + p; } } observer.onNext(count++); self(d); }); }); } function observableTimerTimeSpan(dueTime, scheduler) { var d = normalizeTime(dueTime); return new AnonymousObservable(function (observer) { return scheduler.scheduleWithRelative(d, function () { observer.onNext(0); observer.onCompleted(); }); }); } function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { if (dueTime === period) { return new AnonymousObservable(function (observer) { return scheduler.schedulePeriodicWithState(0, period, function (count) { observer.onNext(count); return count + 1; }); }); } return observableDefer(function () { return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); }); } /** * Returns an observable sequence that produces a value after each period. * * @example * 1 - res = Rx.Observable.interval(1000); * 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout); * * @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds). * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used. * @returns {Observable} An observable sequence that produces a value after each period. */ var observableinterval = Observable.interval = function (period, scheduler) { scheduler || (scheduler = timeoutScheduler); return observableTimerTimeSpanAndPeriod(period, period, scheduler); }; /** * Returns an observable sequence that produces a value after dueTime has elapsed and then after each period. * * @example * 1 - res = Rx.Observable.timer(new Date()); * 2 - res = Rx.Observable.timer(new Date(), 1000); * 3 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout); * 4 - res = Rx.Observable.timer(new Date(), 1000, Rx.Scheduler.timeout); * * 5 - res = Rx.Observable.timer(5000); * 6 - res = Rx.Observable.timer(5000, 1000); * 7 - res = Rx.Observable.timer(5000, Rx.Scheduler.timeout); * 8 - res = Rx.Observable.timer(5000, 1000, Rx.Scheduler.timeout); * * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value. * @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period. */ var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) { var period; scheduler || (scheduler = timeoutScheduler); if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') { period = periodOrScheduler; } else if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'object') { scheduler = periodOrScheduler; } if (dueTime instanceof Date && period === undefined) { return observableTimerDate(dueTime.getTime(), scheduler); } if (dueTime instanceof Date && period !== undefined) { period = periodOrScheduler; return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler); } if (period === undefined) { return observableTimerTimeSpan(dueTime, scheduler); } return observableTimerTimeSpanAndPeriod(dueTime, period, scheduler); }; function observableDelayTimeSpan(dueTime, scheduler) { var source = this; return new AnonymousObservable(function (observer) { var active = false, cancelable = new SerialDisposable(), exception = null, q = [], running = false, subscription; subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) { var d, shouldRun; if (notification.value.kind === 'E') { q = []; q.push(notification); exception = notification.value.exception; shouldRun = !running; } else { q.push({ value: notification.value, timestamp: notification.timestamp + dueTime }); shouldRun = !active; active = true; } if (shouldRun) { if (exception !== null) { observer.onError(exception); } else { d = new SingleAssignmentDisposable(); cancelable.setDisposable(d); d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) { var e, recurseDueTime, result, shouldRecurse; if (exception !== null) { return; } running = true; do { result = null; if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) { result = q.shift().value; } if (result !== null) { result.accept(observer); } } while (result !== null); shouldRecurse = false; recurseDueTime = 0; if (q.length > 0) { shouldRecurse = true; recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now()); } else { active = false; } e = exception; running = false; if (e !== null) { observer.onError(e); } else if (shouldRecurse) { self(recurseDueTime); } })); } } }); return new CompositeDisposable(subscription, cancelable); }); } function observableDelayDate(dueTime, scheduler) { var self = this; return observableDefer(function () { var timeSpan = dueTime - scheduler.now(); return observableDelayTimeSpan.call(self, timeSpan, scheduler); }); } /** * Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved. * * @example * 1 - res = Rx.Observable.delay(new Date()); * 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout); * * 3 - res = Rx.Observable.delay(5000); * 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout); * @memberOf Observable# * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence. * @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used. * @returns {Observable} Time-shifted sequence. */ observableProto.delay = function (dueTime, scheduler) { scheduler || (scheduler = timeoutScheduler); return dueTime instanceof Date ? observableDelayDate.call(this, dueTime.getTime(), scheduler) : observableDelayTimeSpan.call(this, dueTime, scheduler); }; /** * Ignores values from an observable sequence which are followed by another value before dueTime. * * @example * 1 - res = source.throttle(5000); // 5 seconds * 2 - res = source.throttle(5000, scheduler); * * @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds). * @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used. * @returns {Observable} The throttled sequence. */ observableProto.throttle = function (dueTime, scheduler) { scheduler || (scheduler = timeoutScheduler); var source = this; return this.throttleWithSelector(function () { return observableTimer(dueTime, scheduler); }) }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on timing information. * * @example * 1 - res = xs.windowWithTime(1000, scheduler); // non-overlapping segments of 1 second * 2 - res = xs.windowWithTime(1000, 500 , scheduler); // segments of 1 second with time shift 0.5 seconds * * @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds). * @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows. * @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) { var source = this, timeShift; if (timeShiftOrScheduler === undefined) { timeShift = timeSpan; } if (scheduler === undefined) { scheduler = timeoutScheduler; } if (typeof timeShiftOrScheduler === 'number') { timeShift = timeShiftOrScheduler; } else if (typeof timeShiftOrScheduler === 'object') { timeShift = timeSpan; scheduler = timeShiftOrScheduler; } return new AnonymousObservable(function (observer) { var groupDisposable, nextShift = timeShift, nextSpan = timeSpan, q = [], refCountDisposable, timerD = new SerialDisposable(), totalTime = 0; groupDisposable = new CompositeDisposable(timerD), refCountDisposable = new RefCountDisposable(groupDisposable); function createTimer () { var m = new SingleAssignmentDisposable(), isSpan = false, isShift = false; timerD.setDisposable(m); if (nextSpan === nextShift) { isSpan = true; isShift = true; } else if (nextSpan < nextShift) { isSpan = true; } else { isShift = true; } var newTotalTime = isSpan ? nextSpan : nextShift, ts = newTotalTime - totalTime; totalTime = newTotalTime; if (isSpan) { nextSpan += timeShift; } if (isShift) { nextShift += timeShift; } m.setDisposable(scheduler.scheduleWithRelative(ts, function () { var s; if (isShift) { s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); } if (isSpan) { s = q.shift(); s.onCompleted(); } createTimer(); })); }; q.push(new Subject()); observer.onNext(addRef(q[0], refCountDisposable)); createTimer(); groupDisposable.add(source.subscribe(function (x) { var i, s; for (i = 0; i < q.length; i++) { s = q[i]; s.onNext(x); } }, function (e) { var i, s; for (i = 0; i < q.length; i++) { s = q[i]; s.onError(e); } observer.onError(e); }, function () { var i, s; for (i = 0; i < q.length; i++) { s = q[i]; s.onCompleted(); } observer.onCompleted(); })); return refCountDisposable; }); }; /** * Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed. * @example * 1 - res = source.windowWithTimeOrCount(5000, 50); // 5s or 50 items * 2 - res = source.windowWithTimeOrCount(5000, 50, scheduler); //5s or 50 items * * @memberOf Observable# * @param {Number} timeSpan Maximum time length of a window. * @param {Number} count Maximum element count of a window. * @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) { var source = this; scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var createTimer, groupDisposable, n = 0, refCountDisposable, s, timerD = new SerialDisposable(), windowId = 0; groupDisposable = new CompositeDisposable(timerD); refCountDisposable = new RefCountDisposable(groupDisposable); createTimer = function (id) { var m = new SingleAssignmentDisposable(); timerD.setDisposable(m); m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () { var newId; if (id !== windowId) { return; } n = 0; newId = ++windowId; s.onCompleted(); s = new Subject(); observer.onNext(addRef(s, refCountDisposable)); createTimer(newId); })); }; s = new Subject(); observer.onNext(addRef(s, refCountDisposable)); createTimer(0); groupDisposable.add(source.subscribe(function (x) { var newId = 0, newWindow = false; s.onNext(x); n++; if (n === count) { newWindow = true; n = 0; newId = ++windowId; s.onCompleted(); s = new Subject(); observer.onNext(addRef(s, refCountDisposable)); } if (newWindow) { createTimer(newId); } }, function (e) { s.onError(e); observer.onError(e); }, function () { s.onCompleted(); observer.onCompleted(); })); return refCountDisposable; }); }; /** * Projects each element of an observable sequence into zero or more buffers which are produced based on timing information. * * @example * 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second * 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds * * @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds). * @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers. * @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) { return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); }); }; /** * Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed. * * @example * 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array * 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array * * @param {Number} timeSpan Maximum time length of a buffer. * @param {Number} count Maximum element count of a buffer. * @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) { return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) { return x.toArray(); }); }; /** * Records the time interval between consecutive values in an observable sequence. * * @example * 1 - res = source.timeInterval(); * 2 - res = source.timeInterval(Rx.Scheduler.timeout); * * @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence with time interval information on values. */ observableProto.timeInterval = function (scheduler) { var source = this; scheduler || (scheduler = timeoutScheduler); return observableDefer(function () { var last = scheduler.now(); return source.select(function (x) { var now = scheduler.now(), span = now - last; last = now; return { value: x, interval: span }; }); }); }; /** * Records the timestamp for each value in an observable sequence. * * @example * 1 - res = source.timestamp(); // produces { value: x, timestamp: ts } * 2 - res = source.timestamp(Rx.Scheduler.timeout); * * @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence with timestamp information on values. */ observableProto.timestamp = function (scheduler) { scheduler || (scheduler = timeoutScheduler); return this.select(function (x) { return { value: x, timestamp: scheduler.now() }; }); }; function sampleObservable(source, sampler) { return new AnonymousObservable(function (observer) { var atEnd, value, hasValue; function sampleSubscribe() { if (hasValue) { hasValue = false; observer.onNext(value); } if (atEnd) { observer.onCompleted(); } } return new CompositeDisposable( source.subscribe(function (newValue) { hasValue = true; value = newValue; }, observer.onError.bind(observer), function () { atEnd = true; }), sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe) ); }); } /** * Samples the observable sequence at each interval. * * @example * 1 - res = source.sample(sampleObservable); // Sampler tick sequence * 2 - res = source.sample(5000); // 5 seconds * 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds * * @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable. * @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used. * @returns {Observable} Sampled observable sequence. */ observableProto.sample = function (intervalOrSampler, scheduler) { scheduler || (scheduler = timeoutScheduler); if (typeof intervalOrSampler === 'number') { return sampleObservable(this, observableinterval(intervalOrSampler, scheduler)); } return sampleObservable(this, intervalOrSampler); }; /** * Returns the source observable sequence or the other observable sequence if dueTime elapses. * * @example * 1 - res = source.timeout(new Date()); // As a date * 2 - res = source.timeout(5000); // 5 seconds * 3 - res = source.timeout(new Date(), Rx.Observable.returnValue(42)); // As a date and timeout observable * 4 - res = source.timeout(5000, Rx.Observable.returnValue(42)); // 5 seconds and timeout observable * 5 - res = source.timeout(new Date(), Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // As a date and timeout observable * 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable * * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs. * @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used. * @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used. * @returns {Observable} The source sequence switching to the other sequence in case of a timeout. */ observableProto.timeout = function (dueTime, other, scheduler) { other || (other = observableThrow(new Error('Timeout'))); scheduler || (scheduler = timeoutScheduler); var source = this, schedulerMethod = dueTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (observer) { var id = 0, original = new SingleAssignmentDisposable(), subscription = new SerialDisposable(), switched = false, timer = new SerialDisposable(); subscription.setDisposable(original); var createTimer = function () { var myId = id; timer.setDisposable(scheduler[schedulerMethod](dueTime, function () { if (id === myId) { isPromise(other) && (other = observableFromPromise(other)); subscription.setDisposable(other.subscribe(observer)); } })); }; createTimer(); original.setDisposable(source.subscribe(function (x) { if (!switched) { id++; observer.onNext(x); createTimer(); } }, function (e) { if (!switched) { id++; observer.onError(e); } }, function () { if (!switched) { id++; observer.onCompleted(); } })); return new CompositeDisposable(subscription, timer); }); }; /** * Generates an observable sequence by iterating a state from an initial state until the condition fails. * * @example * res = source.generateWithAbsoluteTime(0, * function (x) { return return true; }, * function (x) { return x + 1; }, * function (x) { return x; }, * function (x) { return new Date(); } * }); * * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used. * @returns {Observable} The generated sequence. */ Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) { scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var first = true, hasResult = false, result, state = initialState, time; return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) { if (hasResult) { observer.onNext(result); } try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); if (hasResult) { result = resultSelector(state); time = timeSelector(state); } } catch (e) { observer.onError(e); return; } if (hasResult) { self(time); } else { observer.onCompleted(); } }); }); }; /** * Generates an observable sequence by iterating a state from an initial state until the condition fails. * * @example * res = source.generateWithRelativeTime(0, * function (x) { return return true; }, * function (x) { return x + 1; }, * function (x) { return x; }, * function (x) { return 500; } * ); * * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used. * @returns {Observable} The generated sequence. */ Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) { scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var first = true, hasResult = false, result, state = initialState, time; return scheduler.scheduleRecursiveWithRelative(0, function (self) { if (hasResult) { observer.onNext(result); } try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); if (hasResult) { result = resultSelector(state); time = timeSelector(state); } } catch (e) { observer.onError(e); return; } if (hasResult) { self(time); } else { observer.onCompleted(); } }); }); }; /** * Time shifts the observable sequence by delaying the subscription. * * @example * 1 - res = source.delaySubscription(5000); // 5s * 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds * * @param {Number} dueTime Absolute or relative time to perform the subscription at. * @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used. * @returns {Observable} Time-shifted sequence. */ observableProto.delaySubscription = function (dueTime, scheduler) { scheduler || (scheduler = timeoutScheduler); return this.delayWithSelector(observableTimer(dueTime, scheduler), function () { return observableEmpty(); }); }; /** * Time shifts the observable sequence based on a subscription delay and a delay selector function for each element. * * @example * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only * 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector * * @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source. * @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element. * @returns {Observable} Time-shifted sequence. */ observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) { var source = this, subDelay, selector; if (typeof subscriptionDelay === 'function') { selector = subscriptionDelay; } else { subDelay = subscriptionDelay; selector = delayDurationSelector; } return new AnonymousObservable(function (observer) { var delays = new CompositeDisposable(), atEnd = false, done = function () { if (atEnd && delays.length === 0) { observer.onCompleted(); } }, subscription = new SerialDisposable(), start = function () { subscription.setDisposable(source.subscribe(function (x) { var delay; try { delay = selector(x); } catch (error) { observer.onError(error); return; } var d = new SingleAssignmentDisposable(); delays.add(d); d.setDisposable(delay.subscribe(function () { observer.onNext(x); delays.remove(d); done(); }, observer.onError.bind(observer), function () { observer.onNext(x); delays.remove(d); done(); })); }, observer.onError.bind(observer), function () { atEnd = true; subscription.dispose(); done(); })); }; if (!subDelay) { start(); } else { subscription.setDisposable(subDelay.subscribe(function () { start(); }, observer.onError.bind(observer), function () { start(); })); } return new CompositeDisposable(subscription, delays); }); }; /** * Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled. * * @example * 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500)); * 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }); * 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42)); * * @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never(). * @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element. * @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException(). * @returns {Observable} The source sequence switching to the other sequence in case of a timeout. */ observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) { if (arguments.length === 1) { timeoutdurationSelector = firstTimeout; var firstTimeout = observableNever(); } other || (other = observableThrow(new Error('Timeout'))); var source = this; return new AnonymousObservable(function (observer) { var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable(); subscription.setDisposable(original); var id = 0, switched = false, setTimer = function (timeout) { var myId = id, timerWins = function () { return id === myId; }; var d = new SingleAssignmentDisposable(); timer.setDisposable(d); d.setDisposable(timeout.subscribe(function () { if (timerWins()) { subscription.setDisposable(other.subscribe(observer)); } d.dispose(); }, function (e) { if (timerWins()) { observer.onError(e); } }, function () { if (timerWins()) { subscription.setDisposable(other.subscribe(observer)); } })); }; setTimer(firstTimeout); var observerWins = function () { var res = !switched; if (res) { id++; } return res; }; original.setDisposable(source.subscribe(function (x) { if (observerWins()) { observer.onNext(x); var timeout; try { timeout = timeoutdurationSelector(x); } catch (e) { observer.onError(e); return; } setTimer(timeout); } }, function (e) { if (observerWins()) { observer.onError(e); } }, function () { if (observerWins()) { observer.onCompleted(); } })); return new CompositeDisposable(subscription, timer); }); }; /** * Ignores values from an observable sequence which are followed by another value within a computed throttle duration. * * @example * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); }); * * @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element. * @returns {Observable} The throttled sequence. */ observableProto.throttleWithSelector = function (throttleDurationSelector) { var source = this; return new AnonymousObservable(function (observer) { var value, hasValue = false, cancelable = new SerialDisposable(), id = 0, subscription = source.subscribe(function (x) { var throttle; try { throttle = throttleDurationSelector(x); } catch (e) { observer.onError(e); return; } hasValue = true; value = x; id++; var currentid = id, d = new SingleAssignmentDisposable(); cancelable.setDisposable(d); d.setDisposable(throttle.subscribe(function () { if (hasValue && id === currentid) { observer.onNext(value); } hasValue = false; d.dispose(); }, observer.onError.bind(observer), function () { if (hasValue && id === currentid) { observer.onNext(value); } hasValue = false; d.dispose(); })); }, function (e) { cancelable.dispose(); observer.onError(e); hasValue = false; id++; }, function () { cancelable.dispose(); if (hasValue) { observer.onNext(value); } observer.onCompleted(); hasValue = false; id++; }); return new CompositeDisposable(subscription, cancelable); }); }; /** * Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers. * * 1 - res = source.skipLastWithTime(5000); * 2 - res = source.skipLastWithTime(5000, scheduler); * * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for skipping elements from the end of the sequence. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence. */ observableProto.skipLastWithTime = function (duration, scheduler) { scheduler || (scheduler = timeoutScheduler); var source = this; return new AnonymousObservable(function (observer) { var q = []; return source.subscribe(function (x) { var now = scheduler.now(); q.push({ interval: now, value: x }); while (q.length > 0 && now - q[0].interval >= duration) { observer.onNext(q.shift().value); } }, observer.onError.bind(observer), function () { var now = scheduler.now(); while (q.length > 0 && now - q[0].interval >= duration) { observer.onNext(q.shift().value); } observer.onCompleted(); }); }); }; /** * Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements. * * @example * 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop scheduler]); * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the end of the sequence. * @param {Scheduler} [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @param {Scheduler} [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate. * @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence. */ observableProto.takeLastWithTime = function (duration, timerScheduler, loopScheduler) { return this.takeLastBufferWithTime(duration, timerScheduler).selectMany(function (xs) { return observableFromArray(xs, loopScheduler); }); }; /** * Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers. * * @example * 1 - res = source.takeLastBufferWithTime(5000, [optional scheduler]); * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the end of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence. */ observableProto.takeLastBufferWithTime = function (duration, scheduler) { var source = this; scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var q = []; return source.subscribe(function (x) { var now = scheduler.now(); q.push({ interval: now, value: x }); while (q.length > 0 && now - q[0].interval >= duration) { q.shift(); } }, observer.onError.bind(observer), function () { var now = scheduler.now(), res = []; while (q.length > 0) { var next = q.shift(); if (now - next.interval <= duration) { res.push(next.value); } } observer.onNext(res); observer.onCompleted(); }); }); }; /** * Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. * * @example * 1 - res = source.takeWithTime(5000, [optional scheduler]); * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the start of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence. */ observableProto.takeWithTime = function (duration, scheduler) { var source = this; scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var t = scheduler.scheduleWithRelative(duration, function () { observer.onCompleted(); }); return new CompositeDisposable(t, source.subscribe(observer)); }); }; /** * Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. * * @example * 1 - res = source.skipWithTime(5000, [optional scheduler]); * * @description * Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence. * This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded * may not execute immediately, despite the zero due time. * * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration. * @param {Number} duration Duration for skipping elements from the start of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence. */ observableProto.skipWithTime = function (duration, scheduler) { var source = this; scheduler || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var open = false, t = scheduler.scheduleWithRelative(duration, function () { open = true; }), d = source.subscribe(function (x) { if (open) { observer.onNext(x); } }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); return new CompositeDisposable(t, d); }); }; /** * Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers. * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time. * * @examples * 1 - res = source.skipUntilWithTime(new Date(), [optional scheduler]); * 2 - res = source.skipUntilWithTime(5000, [optional scheduler]); * @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped. * @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements skipped until the specified start time. */ observableProto.skipUntilWithTime = function (startTime, scheduler) { scheduler || (scheduler = timeoutScheduler); var source = this, schedulerMethod = startTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (observer) { var open = false; return new CompositeDisposable( scheduler[schedulerMethod](startTime, function () { open = true; }), source.subscribe( function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer))); }); }; /** * Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers. * * @example * 1 - res = source.takeUntilWithTime(new Date(), [optional scheduler]); * 2 - res = source.takeUntilWithTime(5000, [optional scheduler]); * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately. * @param {Scheduler} scheduler Scheduler to run the timer on. * @returns {Observable} An observable sequence with the elements taken until the specified end time. */ observableProto.takeUntilWithTime = function (endTime, scheduler) { scheduler || (scheduler = timeoutScheduler); var source = this, schedulerMethod = endTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (observer) { return new CompositeDisposable(scheduler[schedulerMethod](endTime, function () { observer.onCompleted(); }), source.subscribe(observer)); }); }; /** Provides a set of extension methods for virtual time scheduling. */ Rx.VirtualTimeScheduler = (function (_super) { function notImplemented() { throw new Error('Not implemented'); } function localNow() { return this.toDateTimeOffset(this.clock); } function scheduleNow(state, action) { return this.scheduleAbsoluteWithState(state, this.clock, action); } function scheduleRelative(state, dueTime, action) { return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action); } function invokeAction(scheduler, action) { action(); return disposableEmpty; } inherits(VirtualTimeScheduler, _super); /** * Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer. * * @constructor * @param {Number} initialClock Initial value for the clock. * @param {Function} comparer Comparer to determine causality of events based on absolute time. */ function VirtualTimeScheduler(initialClock, comparer) { this.clock = initialClock; this.comparer = comparer; this.isEnabled = false; this.queue = new PriorityQueue(1024); _super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute); } var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype; /** * Adds a relative time value to an absolute time value. * @param {Number} absolute Absolute virtual time value. * @param {Number} relative Relative virtual time value to add. * @return {Number} Resulting absolute virtual time sum value. */ VirtualTimeSchedulerPrototype.add = notImplemented; /** * Converts an absolute time to a number * @param {Any} The absolute time. * @returns {Number} The absolute time in ms */ VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented; /** * Converts the TimeSpan value to a relative virtual time value. * @param {Number} timeSpan TimeSpan value to convert. * @return {Number} Corresponding relative virtual time value. */ VirtualTimeSchedulerPrototype.toRelative = notImplemented; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) { var s = new SchedulePeriodicRecursive(this, state, period, action); return s.start(); }; /** * Schedules an action to be executed after dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) { var runAt = this.add(this.clock, dueTime); return this.scheduleAbsoluteWithState(state, runAt, action); }; /** * Schedules an action to be executed at dueTime. * @param {Number} dueTime Relative time after which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) { return this.scheduleRelativeWithState(action, dueTime, invokeAction); }; /** * Starts the virtual time scheduler. */ VirtualTimeSchedulerPrototype.start = function () { var next; if (!this.isEnabled) { this.isEnabled = true; do { next = this.getNext(); if (next !== null) { if (this.comparer(next.dueTime, this.clock) > 0) { this.clock = next.dueTime; } next.invoke(); } else { this.isEnabled = false; } } while (this.isEnabled); } }; /** * Stops the virtual time scheduler. */ VirtualTimeSchedulerPrototype.stop = function () { this.isEnabled = false; }; /** * Advances the scheduler's clock to the specified time, running all work till that point. * @param {Number} time Absolute time to advance the scheduler's clock to. */ VirtualTimeSchedulerPrototype.advanceTo = function (time) { var next; var dueToClock = this.comparer(this.clock, time); if (this.comparer(this.clock, time) > 0) { throw new Error(argumentOutOfRange); } if (dueToClock === 0) { return; } if (!this.isEnabled) { this.isEnabled = true; do { next = this.getNext(); if (next !== null && this.comparer(next.dueTime, time) <= 0) { if (this.comparer(next.dueTime, this.clock) > 0) { this.clock = next.dueTime; } next.invoke(); } else { this.isEnabled = false; } } while (this.isEnabled); this.clock = time; } }; /** * Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan. * @param {Number} time Relative time to advance the scheduler's clock by. */ VirtualTimeSchedulerPrototype.advanceBy = function (time) { var dt = this.add(this.clock, time); var dueToClock = this.comparer(this.clock, dt); if (dueToClock > 0) { throw new Error(argumentOutOfRange); } if (dueToClock === 0) { return; } this.advanceTo(dt); }; /** * Advances the scheduler's clock by the specified relative time. * @param {Number} time Relative time to advance the scheduler's clock by. */ VirtualTimeSchedulerPrototype.sleep = function (time) { var dt = this.add(this.clock, time); if (this.comparer(this.clock, dt) >= 0) { throw new Error(argumentOutOfRange); } this.clock = dt; }; /** * Gets the next scheduled item to be executed. * @returns {ScheduledItem} The next scheduled item. */ VirtualTimeSchedulerPrototype.getNext = function () { var next; while (this.queue.length > 0) { next = this.queue.peek(); if (next.isCancelled()) { this.queue.dequeue(); } else { return next; } } return null; }; /** * Schedules an action to be executed at dueTime. * @param {Scheduler} scheduler Scheduler to execute the action on. * @param {Number} dueTime Absolute time at which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) { return this.scheduleAbsoluteWithState(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Number} dueTime Absolute time at which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) { var self = this, run = function (scheduler, state1) { self.queue.remove(si); return action(scheduler, state1); }, si = new ScheduledItem(self, state, run, dueTime, self.comparer); self.queue.enqueue(si); return si.disposable; }; return VirtualTimeScheduler; }(Scheduler)); /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */ Rx.HistoricalScheduler = (function (_super) { inherits(HistoricalScheduler, _super); /** * Creates a new historical scheduler with the specified initial clock value. * * @constructor * @param {Number} initialClock Initial value for the clock. * @param {Function} comparer Comparer to determine causality of events based on absolute time. */ function HistoricalScheduler(initialClock, comparer) { var clock = initialClock == null ? 0 : initialClock; var cmp = comparer || defaultSubComparer; _super.call(this, clock, cmp); } var HistoricalSchedulerProto = HistoricalScheduler.prototype; /** * Adds a relative time value to an absolute time value. * @param {Number} absolute Absolute virtual time value. * @param {Number} relative Relative virtual time value to add. * @return {Number} Resulting absolute virtual time sum value. */ HistoricalSchedulerProto.add = function (absolute, relative) { return absolute + relative; }; /** * @private */ HistoricalSchedulerProto.toDateTimeOffset = function (absolute) { return new Date(absolute).getTime(); }; /** * Converts the TimeSpan value to a relative virtual time value. * * @memberOf HistoricalScheduler * @param {Number} timeSpan TimeSpan value to convert. * @return {Number} Corresponding relative virtual time value. */ HistoricalSchedulerProto.toRelative = function (timeSpan) { return timeSpan; }; return HistoricalScheduler; }(Rx.VirtualTimeScheduler)); var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) { inherits(AnonymousObservable, __super__); // Fix subscriber to check for undefined or function returned to decorate as Disposable function fixSubscriber(subscriber) { if (typeof subscriber === 'undefined') { subscriber = disposableEmpty; } else if (typeof subscriber === 'function') { subscriber = disposableCreate(subscriber); } return subscriber; } function AnonymousObservable(subscribe) { if (!(this instanceof AnonymousObservable)) { return new AnonymousObservable(subscribe); } function s(observer) { var autoDetachObserver = new AutoDetachObserver(observer); if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.schedule(function () { try { autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver))); } catch (e) { if (!autoDetachObserver.fail(e)) { throw e; } } }); } else { try { autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver))); } catch (e) { if (!autoDetachObserver.fail(e)) { throw e; } } } return autoDetachObserver; } __super__.call(this, s); } return AnonymousObservable; }(Observable)); /** @private */ var AutoDetachObserver = (function (_super) { inherits(AutoDetachObserver, _super); function AutoDetachObserver(observer) { _super.call(this); this.observer = observer; this.m = new SingleAssignmentDisposable(); } var AutoDetachObserverPrototype = AutoDetachObserver.prototype; AutoDetachObserverPrototype.next = function (value) { var noError = false; try { this.observer.onNext(value); noError = true; } catch (e) { throw e; } finally { if (!noError) { this.dispose(); } } }; AutoDetachObserverPrototype.error = function (exn) { try { this.observer.onError(exn); } catch (e) { throw e; } finally { this.dispose(); } }; AutoDetachObserverPrototype.completed = function () { try { this.observer.onCompleted(); } catch (e) { throw e; } finally { this.dispose(); } }; AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); }; AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); }; /* @private */ AutoDetachObserverPrototype.disposable = function (value) { return arguments.length ? this.getDisposable() : setDisposable(value); }; AutoDetachObserverPrototype.dispose = function () { _super.prototype.dispose.call(this); this.m.dispose(); }; return AutoDetachObserver; }(AbstractObserver)); /** @private */ var GroupedObservable = (function (_super) { inherits(GroupedObservable, _super); function subscribe(observer) { return this.underlyingObservable.subscribe(observer); } /** * @constructor * @private */ function GroupedObservable(key, underlyingObservable, mergedDisposable) { _super.call(this, subscribe); this.key = key; this.underlyingObservable = !mergedDisposable ? underlyingObservable : new AnonymousObservable(function (observer) { return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer)); }); } return GroupedObservable; }(Observable)); /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed observers. */ var Subject = Rx.Subject = (function (_super) { function subscribe(observer) { checkDisposed.call(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.exception) { observer.onError(this.exception); return disposableEmpty; } observer.onCompleted(); return disposableEmpty; } inherits(Subject, _super); /** * Creates a subject. * @constructor */ function Subject() { _super.call(this, subscribe); this.isDisposed = false, this.isStopped = false, this.observers = []; } addProperties(Subject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; for (var i = 0, len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers = []; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (exception) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; this.exception = exception; for (var i = 0, len = os.length; i < len; i++) { os[i].onError(exception); } this.observers = []; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); for (var i = 0, len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); /** * Creates a subject from the specified observer and observable. * @param {Observer} observer The observer used to send messages to the subject. * @param {Observable} observable The observable used to subscribe to messages sent from the subject. * @returns {Subject} Subject implemented using the given observer and observable. */ Subject.create = function (observer, observable) { return new AnonymousSubject(observer, observable); }; return Subject; }(Observable)); /** * Represents the result of an asynchronous operation. * The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers. */ var AsyncSubject = Rx.AsyncSubject = (function (_super) { function subscribe(observer) { checkDisposed.call(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } var ex = this.exception, hv = this.hasValue, v = this.value; if (ex) { observer.onError(ex); } else if (hv) { observer.onNext(v); observer.onCompleted(); } else { observer.onCompleted(); } return disposableEmpty; } inherits(AsyncSubject, _super); /** * Creates a subject that can only receive one value and that value is cached for all future observations. * @constructor */ function AsyncSubject() { _super.call(this, subscribe); this.isDisposed = false; this.isStopped = false; this.value = null; this.hasValue = false; this.observers = []; this.exception = null; } addProperties(AsyncSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { checkDisposed.call(this); return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). */ onCompleted: function () { var o, i, len; checkDisposed.call(this); if (!this.isStopped) { this.isStopped = true; var os = this.observers.slice(0), v = this.value, hv = this.hasValue; if (hv) { for (i = 0, len = os.length; i < len; i++) { o = os[i]; o.onNext(v); o.onCompleted(); } } else { for (i = 0, len = os.length; i < len; i++) { os[i].onCompleted(); } } this.observers = []; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (exception) { checkDisposed.call(this); if (!this.isStopped) { var os = this.observers.slice(0); this.isStopped = true; this.exception = exception; for (var i = 0, len = os.length; i < len; i++) { os[i].onError(exception); } this.observers = []; } }, /** * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers. * @param {Mixed} value The value to store in the subject. */ onNext: function (value) { checkDisposed.call(this); if (!this.isStopped) { this.value = value; this.hasValue = true; } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.exception = null; this.value = null; } }); return AsyncSubject; }(Observable)); /** @private */ var AnonymousSubject = (function (_super) { inherits(AnonymousSubject, _super); function subscribe(observer) { return this.observable.subscribe(observer); } /** * @private * @constructor */ function AnonymousSubject(observer, observable) { _super.call(this, subscribe); this.observer = observer; this.observable = observable; } addProperties(AnonymousSubject.prototype, Observer, { /** * @private * @memberOf AnonymousSubject# */ onCompleted: function () { this.observer.onCompleted(); }, /** * @private * @memberOf AnonymousSubject# */ onError: function (exception) { this.observer.onError(exception); }, /** * @private * @memberOf AnonymousSubject# */ onNext: function (value) { this.observer.onNext(value); } }); return AnonymousSubject; }(Observable)); if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { root.Rx = Rx; define(function() { return Rx; }); } else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = Rx).Rx = Rx; } else { freeExports.Rx = Rx; } } else { // in a browser or Rhino root.Rx = Rx; } }.call(this));
src/svg-icons/content/weekend.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ContentWeekend = (props) => ( <SvgIcon {...props}> <path d="M21 10c-1.1 0-2 .9-2 2v3H5v-3c0-1.1-.9-2-2-2s-2 .9-2 2v5c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2zm-3-5H6c-1.1 0-2 .9-2 2v2.15c1.16.41 2 1.51 2 2.82V14h12v-2.03c0-1.3.84-2.4 2-2.82V7c0-1.1-.9-2-2-2z"/> </SvgIcon> ); ContentWeekend = pure(ContentWeekend); ContentWeekend.displayName = 'ContentWeekend'; ContentWeekend.muiName = 'SvgIcon'; export default ContentWeekend;
client/containers/DevTools.js
theogravity/beatbox-player
import React from 'react' import { createDevTools } from 'redux-devtools' import LogMonitor from 'redux-devtools-log-monitor' import DockMonitor from 'redux-devtools-dock-monitor' export default createDevTools( <DockMonitor defaultIsVisible={false} toggleVisibilityKey='H' changePositionKey='Q' defaultPosition='left'> <LogMonitor /> </DockMonitor> )
client/core/Loader/components/Loader.js
jacob-ebey/DashboardTemplate
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; import { Dialog, DialogType, DialogFooter } from 'office-ui-fabric-react/lib/Dialog'; import { Spinner, SpinnerSize } from 'office-ui-fabric-react/lib/Spinner'; import { createLoaderModel, modelProps } from '../model'; export default function (loaderParameters) { return (ChildComponent) => { class Loader extends React.Component { componentDidMount = () => { const { loadAction, loaderState: { hasTriedLoad, isLoading }, match: { params } } = this.props; if (!hasTriedLoad && !isLoading) { loadAction(params); } } componentWillUnmount = () => { if (loaderParameters.clearOnBack) { const { reset } = this.props; reset(); } } closeDialog = () => { const { reset } = this.props; reset(); } render = () => { const { loaderState, loaderState: { hasTriedLoad, isLoading, showGenericError }, ...rest } = this.props; if (!hasTriedLoad || isLoading || showGenericError) { return ( <div> <Spinner size={SpinnerSize.large} /> <Dialog title='UH-OH, An Error Occured :(' hidden={!showGenericError} onDismiss={this.closeDialog} modalProps={{ isBlocking: true, }} > <p>An un-recoverable error has occured and you will be re-directed after this dialog is closed.</p> <DialogFooter> <PrimaryButton onClick={this.closeDialog}> <Link to={loaderParameters.redirect || '/'}>Close</Link> </PrimaryButton> </DialogFooter> </Dialog> </div> ); } return <ChildComponent loaderState={loaderState} {...rest} />; } } Loader.propTypes = { reset: PropTypes.func.isRequired, loadAction: PropTypes.func.isRequired, loaderState: PropTypes.shape(modelProps), }; Loader.defaultProps = { loaderState: createLoaderModel(), }; const mapStateToProps = (state) => { return { loaderState: loaderParameters.selector(state), }; }; const mapDispatchToProps = (dispatch, props) => { return { reset: () => { dispatch({ type: loaderParameters.handleLoad, subType: 'reset', isLoading: false, showGenericError: false, hasTriedLoad: false, }); }, loadAction: (params) => { dispatch({ type: loaderParameters.handleLoad, subType: 'load', isLoading: true, showGenericError: false, data: null, }); dispatch((dispatch2) => { Promise.resolve(loaderParameters.loadAction(params)) .then((result) => { dispatch2({ type: loaderParameters.handleLoad, subType: 'done', isLoading: false, showGenericError: false, data: result, }); }) .catch((exception) => { if (loaderParameters.loadFailed) { dispatch2({ type: loaderParameters.handleLoad, subType: 'failed', isLoading: true, showGenericError: true, data: null, }); dispatch2({ type: loaderParameters.loadFailed, subType: 'failed', exception, }); } else { dispatch2({ type: loaderParameters.handleLoad, subType: 'failed', isLoading: true, showGenericError: true, data: null, }); } }); }); }, }; }; return connect(mapStateToProps, mapDispatchToProps)(Loader); }; }
pootle/static/js/admin/general/components/ContentPreview.js
phlax/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ import React from 'react'; const ContentPreview = React.createClass({ propTypes: { value: React.PropTypes.string.isRequired, style: React.PropTypes.object, }, render() { return ( <div className="content-preview" style={this.props.style} > {this.props.value ? <div className="staticpage" dangerouslySetInnerHTML={{ __html: this.props.value }} /> : <div className="placeholder"> {gettext('Preview will be displayed here.')} </div> } </div> ); }, }); export default ContentPreview;
app/components/AppBar/index.js
rahsheen/scalable-react-app
/** * * AppBar * */ import React from 'react'; import FontAwesome from 'react-fontawesome'; import { Link } from 'react-router'; import styles from './styles.css'; function AppBar({ toggleDrawer, email }) { const loginLink = email || (<Link to="/login"> login </Link>); return ( <div className={styles.appBar}> <div className={styles.iconButton} onClick={toggleDrawer} > <FontAwesome className={styles.icon} name="bars" /> </div> <div className={styles.heading} > Coder Daily </div> <div className={styles.linkContainer} > { loginLink } </div> </div> ); } AppBar.propTypes = { toggleDrawer: React.PropTypes.func.isRequired, email: React.PropTypes.string, }; export default AppBar;
frontend/modules/recipe/containers/Recipe.js
rustymyers/OpenEats
import React from 'react' import PropTypes from 'prop-types' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import Loading from '../../base/components/Loading' import RecipeScheme from '../components/RecipeScheme' import * as RecipeActions from '../actions/RecipeActions' import * as RecipeItemActions from '../actions/RecipeItemActions' import bindIndexToActionCreators from '../../common/bindIndexToActionCreators' import documentTitle from '../../common/documentTitle' require("./../css/recipe.scss"); class Recipe extends React.Component { componentDidMount() { this.props.recipeActions.load(this.props.match.params.recipe); } componentWillUnmount() { documentTitle(); } componentWillReceiveProps(nextProps) { if (nextProps.match.params.recipe !== this.props.match.params.recipe) { nextProps.recipeItemActions.reset(); nextProps.recipeActions.load(nextProps.match.params.recipe); window.scrollTo(0, 0); } } render() { let { lists, recipes, match, status, user } = this.props; let { recipeActions, recipeItemActions } = this.props; let data = recipes.find(t => t.id == match.params.recipe); if (data) { let showEditLink = (user !== null && user.id === data.author); documentTitle(data.title); return ( <RecipeScheme { ...data } listStatus={ status } lists={ lists } showEditLink={ showEditLink } recipeActions={ recipeActions } recipeItemActions={ recipeItemActions } /> ); } else { return ( <Loading message="Loading"/> ) } } } Recipe.propTypes = { recipes: PropTypes.array.isRequired, lists: PropTypes.array.isRequired, status: PropTypes.string.isRequired, user: PropTypes.object.isRequired, match: PropTypes.object.isRequired, recipeActions: PropTypes.object.isRequired, recipeItemActions: PropTypes.object.isRequired, }; const mapStateToProps = state => ({ user: state.user, recipes: state.recipe.recipes, status: state.recipe.status, lists: state.list.lists, }); const mapDispatchToProps = (dispatch, props) => ({ recipeItemActions: bindActionCreators(RecipeItemActions, dispatch), recipeActions: bindActionCreators( bindIndexToActionCreators(RecipeActions, props.match.params.recipe), dispatch ), }); export default connect( mapStateToProps, mapDispatchToProps )(Recipe);
examples/js/pagination/demo.js
prajapati-parth/react-bootstrap-table
/* eslint max-len: 0 */ import React from 'react'; import DefaultPaginationTable from './default-pagination-table'; import CustomPaginationTable from './custom-pagination-table'; import PaginationHookTable from './pagination-hook-table'; class Demo extends React.Component { render() { return ( <div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>Basic Pagination Example</div> <div className='panel-body'> <h5>Source in /examples/js/pagination/default-pagination-table.js</h5> <DefaultPaginationTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>Custom Pagination Example</div> <div className='panel-body'> <h5>Source in /examples/js/pagination/custom-pagination-table.js</h5> <CustomPaginationTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>Pagination Hooks(onPageChange) Example</div> <div className='panel-body'> <h5>Source in /examples/js/pagination/pagination-hook-table.js</h5> <PaginationHookTable /> </div> </div> </div> </div> ); } } export default Demo;
src/components/topic/TopicPageTitle.js
mitmedialab/MediaCloud-Web-Tools
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import PageTitle from '../common/PageTitle'; const TopicPageTitle = (props) => { let newValue; if (props.value instanceof Array) { newValue = [...props.value, props.topicName]; } else { newValue = [props.value, props.topicName]; } return (<PageTitle value={newValue} />); }; TopicPageTitle.propTypes = { // from parent value: PropTypes.oneOfType([ PropTypes.string, PropTypes.object, ]), // from state topicName: PropTypes.string.isRequired, }; const mapStateToProps = state => ({ topicName: state.topics.selected.info.name, }); export default connect(mapStateToProps)( TopicPageTitle );
src/components/auth/signout.js
juthatip/authentication-client
import React, { Component } from 'react'; import { connect } from 'react-redux'; import * as actions from '../../actions' class Signout extends Component { componentWillMount() { this.props.signoutUser(); } render() { return <div>Sorry to see you go</div>; } } export default connect(null, actions)(Signout);
ajax/libs/tinymce/4.3.2/plugins/legacyoutput/plugin.js
kennynaoh/cdnjs
/** * plugin.js * * Released under LGPL License. * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing * * This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align * attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash * * However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are * not apart of the newer specifications for HTML and XHTML. */ /*global tinymce:true */ (function(tinymce) { // Override inline_styles setting to force TinyMCE to produce deprecated contents tinymce.on('AddEditor', function(e) { e.editor.settings.inline_styles = false; }); tinymce.PluginManager.add('legacyoutput', function(editor, url, $) { editor.on('init', function() { var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', fontSizes = tinymce.explode(editor.settings.font_size_style_values), schema = editor.schema; // Override some internal formats to produce legacy elements and attributes editor.formatter.register({ // Change alignment formats to use the deprecated align attribute alignleft: {selector: alignElements, attributes: {align: 'left'}}, aligncenter: {selector: alignElements, attributes: {align: 'center'}}, alignright: {selector: alignElements, attributes: {align: 'right'}}, alignjustify: {selector: alignElements, attributes: {align: 'justify'}}, // Change the basic formatting elements to use deprecated element types bold: [ {inline: 'b', remove: 'all'}, {inline: 'strong', remove: 'all'}, {inline: 'span', styles: {fontWeight: 'bold'}} ], italic: [ {inline: 'i', remove: 'all'}, {inline: 'em', remove: 'all'}, {inline: 'span', styles: {fontStyle: 'italic'}} ], underline: [ {inline: 'u', remove: 'all'}, {inline: 'span', styles: {textDecoration: 'underline'}, exact: true} ], strikethrough: [ {inline: 'strike', remove: 'all'}, {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true} ], // Change font size and font family to use the deprecated font element fontname: {inline: 'font', attributes: {face: '%value'}}, fontsize: { inline: 'font', attributes: { size: function(vars) { return tinymce.inArray(fontSizes, vars.value) + 1; } } }, // Setup font elements for colors as well forecolor: {inline: 'font', attributes: {color: '%value'}}, hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}} }); // Check that deprecated elements are allowed if not add them tinymce.each('b,i,u,strike'.split(','), function(name) { schema.addValidElements(name + '[*]'); }); // Add font element if it's missing if (!schema.getElementRule("font")) { schema.addValidElements("font[face|size|color|style]"); } // Add the missing and depreacted align attribute for the serialization engine tinymce.each(alignElements.split(','), function(name) { var rule = schema.getElementRule(name); if (rule) { if (!rule.attributes.align) { rule.attributes.align = {}; rule.attributesOrder.push('align'); } } }); }); editor.addButton('fontsizeselect', function() { var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7'; var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; editor.$.each(fontsize_formats.split(' '), function(i, item) { var text = item, value = item; var values = item.split('='); if (values.length > 1) { text = values[0]; value = values[1]; } items.push({text: text, value: value}); }); return { type: 'listbox', text: 'Font Sizes', tooltip: 'Font Sizes', values: items, fixedWidth: true, onPostRender: function() { var self = this; editor.on('NodeChange', function() { var fontElm; fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); if (fontElm) { self.value(fontElm.size); } else { self.value(''); } }); }, onclick: function(e) { if (e.control.settings.value) { editor.execCommand('FontSize', false, e.control.settings.value); } } }; }); editor.addButton('fontselect', function() { function createFormats(formats) { formats = formats.replace(/;$/, '').split(';'); var i = formats.length; while (i--) { formats[i] = formats[i].split('='); } return formats; } var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats'; var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); $.each(fonts, function(i, font) { items.push({ text: {raw: font[0]}, value: font[1], textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' }); }); return { type: 'listbox', text: 'Font Family', tooltip: 'Font Family', values: items, fixedWidth: true, onPostRender: function() { var self = this; editor.on('NodeChange', function() { var fontElm; fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); if (fontElm) { self.value(fontElm.face); } else { self.value(''); } }); }, onselect: function(e) { if (e.control.settings.value) { editor.execCommand('FontName', false, e.control.settings.value); } } }; }); }); })(tinymce);
client/src/pages/404.js
hstandaert/hstandaert.com
import React from 'react' import Layout from '../components/layout' const NotFoundPage = () => ( <Layout> <h1>NOT FOUND</h1> <p>You just hit a route that doesn&#39;t exist... the sadness.</p> </Layout> ) export default NotFoundPage
src/js/components/icons/base/Login.js
kylebyerly-hp/grommet
// (C) Copyright 2014-2015 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 Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-login`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'login'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M9,15 L9,22 L22,22 L22,2 L9,2 L9,9 M18,12 L0,12 M13,7 L18,12 L13,17"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Login'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
packages/material-ui-icons/src/Wifi.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" /> , 'Wifi');
src/components/ProposalInput/DateInput.js
nambawan/g-old
import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage } from 'react-intl'; import FormField from '../FormField'; import { utcCorrectedDate } from '../../core/helpers'; import Box from '../Box'; import FormValidation from '../FormValidation'; import { dateToValidation, timeToValidation } from '../../core/validation'; const messages = defineMessages({ dateTo: { id: 'date.to', defaultMessage: 'End date', description: 'Date until', }, timeTo: { id: 'time.to', defaultMessage: 'End time', description: 'Time until', }, }); class DateInput extends React.Component { constructor(props) { super(props); this.handleNext = this.handleNext.bind(this); this.onBeforeNextStep = this.onBeforeNextStep.bind(this); this.form = React.createRef(); } componentDidMount() { const { callback, stepId } = this.props; if (callback) { callback(stepId, this.onBeforeNextStep); } } onBeforeNextStep() { if (this.form.current) { const validationResult = this.form.current.enforceValidation([ 'dateTo', 'timeTo', ]); if (validationResult.isValid) { this.handleNext(validationResult.values); return true; } } return false; } handleNext(values) { const { onExit, data } = this.props; if (onExit) { onExit([ { name: 'dateTo', value: values.dateTo || data.dateTo }, { name: 'timeTo', value: values.timeTo || data.timeTo }, ]); } } render() { const { data } = this.props; return ( <FormValidation submit={this.handleNext} validations={{ dateTo: { fn: dateToValidation }, timeTo: { fn: timeToValidation }, }} data={data} ref={this.form} > {({ handleValueChanges, errorMessages, onBlur, values }) => ( <Box column> <FormField label={<FormattedMessage {...messages.dateTo} />} error={errorMessages.dateToError} > <input type="date" defaultValue={utcCorrectedDate(3).slice(0, 10)} onChange={handleValueChanges} pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="dateTo" onBlur={onBlur} value={values.dateTo || utcCorrectedDate(3).slice(0, 10)} /> </FormField> <FormField label={<FormattedMessage {...messages.timeTo} />} error={errorMessages.timeToError} > <input type="time" name="timeTo" value={values.timeTo || utcCorrectedDate().slice(11, 16)} defaultValue={utcCorrectedDate().slice(11, 16)} onChange={handleValueChanges} onBlur={onBlur} /> </FormField> </Box> )} </FormValidation> ); } } DateInput.propTypes = { handleChange: PropTypes.func.isRequired, handleBlur: PropTypes.func.isRequired, dateToError: PropTypes.shape({}), timeToError: PropTypes.shape({}), }; DateInput.defaultProps = { dateToError: null, timeToError: null, }; export default DateInput;
__tests__/components/icons/status/Warning-test.js
nickjvm/grommet
// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP import React from 'react'; import renderer from 'react-test-renderer'; import Warning from '../../../../src/js/components/icons/status/Warning'; describe('Warning', () => { it('has correct default options', () => { const component = renderer.create( <Warning /> ); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); it('has correct className rendering', () => { const component = renderer.create( <Warning className='testing' /> ); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); });
src/client/story_box.js
mkobar/hacker-menu
import React from 'react' import _ from 'lodash' import Client from 'electron-rpc/client' import StoryList from './story_list.js' import Spinner from './spinner.js' import Menu from './menu.js' import StoryType from '../model/story_type' export default class StoryBox extends React.Component { constructor (props) { super(props) this.client = new Client() this.state = { stories: [], selected: StoryType.TOP_TYPE, status: '', version: '', upgradeVersion: '' } } componentDidMount () { var self = this self.client.request('current-version', function (err, version) { if (err) { console.error(err) return } self.setState({ version: version }) }) self.onNavbarClick(self.state.selected) } onQuitClick () { this.client.request('terminate') } onUrlClick (url) { this.client.request('open-url', { url: url }) } onMarkAsRead (id) { this.client.request('mark-as-read', { id: id }, function () { var story = _.findWhere(this.state.stories, { id: id }) story.hasRead = true this.setState({ stories: this.state.stories }) }.bind(this)) } onNavbarClick (selected) { var self = this self.setState({ stories: [], selected: selected }) self.client.localEventEmitter.removeAllListeners() self.client.on('update-available', function (err, releaseVersion) { if (err) { console.error(err) return } self.setState({ status: 'update-available', upgradeVersion: releaseVersion }) }) var storycb = function (err, storiesMap) { if (err) { return } // console.log(JSON.stringify(Object.keys(storiesMap), null, 2)) var stories = storiesMap[self.state.selected] if (!stories) { return } // console.log(JSON.stringify(stories, null, 2)) self.setState({stories: stories}) } self.client.request(selected, storycb) self.client.on(selected, storycb) } render () { var navNodes = _.map(StoryType.ALL, function (selection) { var className = 'control-item' if (this.state.selected === selection) { className = className + ' active' } return ( <a key={selection} className={className} onClick={this.onNavbarClick.bind(this, selection)}>{selection}</a> ) }, this) var content = null if (_.isEmpty(this.state.stories)) { content = <Spinner /> } else { content = <StoryList stories={this.state.stories} onUrlClick={this.onUrlClick.bind(this)} onMarkAsRead={this.onMarkAsRead.bind(this)} /> } return ( <div className='story-menu'> <header className='bar bar-nav'> <div className='segmented-control'> {navNodes} </div> </header> {content} <Menu onQuitClick={this.onQuitClick.bind(this)} status={this.state.status} version={this.state.version} upgradeVersion={this.state.upgradeVersion} /> </div> ) } }
src/index.js
zestxjest/sf-movies
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import finalCreateStore from './redux/createStore'; import App from './App'; const store = finalCreateStore(); ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') );
node_modules/react-router/es6/withRouter.js
Shwrndasink/btholt-react-tutorial
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; }; import invariant from 'invariant'; import React from 'react'; import hoistStatics from 'hoist-non-react-statics'; import { routerShape } from './PropTypes'; function getDisplayName(WrappedComponent) { return WrappedComponent.displayName || WrappedComponent.name || 'Component'; } export default function withRouter(WrappedComponent, options) { var withRef = options && options.withRef; var WithRouter = React.createClass({ displayName: 'WithRouter', contextTypes: { router: routerShape }, propTypes: { router: routerShape }, getWrappedInstance: function getWrappedInstance() { !withRef ? process.env.NODE_ENV !== 'production' ? invariant(false, 'To access the wrapped instance, you need to specify ' + '`{ withRef: true }` as the second argument of the withRouter() call.') : invariant(false) : void 0; return this.wrappedInstance; }, render: function render() { var _this = this; var router = this.props.router || this.context.router; var props = _extends({}, this.props, { router: router }); if (withRef) { props.ref = function (c) { _this.wrappedInstance = c; }; } return React.createElement(WrappedComponent, props); } }); WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')'; WithRouter.WrappedComponent = WrappedComponent; return hoistStatics(WithRouter, WrappedComponent); }
docs/src/pages/components/tables/MaterialTableDemo.js
allanalexandre/material-ui
import React from 'react'; import MaterialTable from 'material-table'; export default function MaterialTableDemo() { const [state, setState] = React.useState({ columns: [ { title: 'Name', field: 'name' }, { title: 'Surname', field: 'surname' }, { title: 'Birth Year', field: 'birthYear', type: 'numeric' }, { title: 'Birth Place', field: 'birthCity', lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' }, }, ], data: [ { name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 }, { name: 'Zerya Betül', surname: 'Baran', birthYear: 2017, birthCity: 34, }, ], }); return ( <MaterialTable title="Editable Example" columns={state.columns} data={state.data} editable={{ onRowAdd: newData => new Promise(resolve => { setTimeout(() => { resolve(); const data = [...state.data]; data.push(newData); setState({ ...state, data }); }, 600); }), onRowUpdate: (newData, oldData) => new Promise(resolve => { setTimeout(() => { resolve(); const data = [...state.data]; data[data.indexOf(oldData)] = newData; setState({ ...state, data }); }, 600); }), onRowDelete: oldData => new Promise(resolve => { setTimeout(() => { resolve(); const data = [...state.data]; data.splice(data.indexOf(oldData), 1); setState({ ...state, data }); }, 600); }), }} /> ); }
app/javascript/mastodon/features/directory/components/account_card.js
ashfurrow/mastodon
import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; import Avatar from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import Permalink from 'mastodon/components/permalink'; import Button from 'mastodon/components/button'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; import { autoPlayGif, me, unfollowModal } from 'mastodon/initial_state'; import ShortNumber from 'mastodon/components/short_number'; import { followAccount, unfollowAccount, unblockAccount, unmuteAccount, } from 'mastodon/actions/accounts'; import { openModal } from 'mastodon/actions/modal'; import classNames from 'classnames'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' }, cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Cancel follow request' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, unblock: { id: 'account.unblock_short', defaultMessage: 'Unblock' }, unmute: { id: 'account.unmute_short', defaultMessage: 'Unmute' }, unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, }); const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = (state, { id }) => ({ account: getAccount(state, id), }); return mapStateToProps; }; const mapDispatchToProps = (dispatch, { intl }) => ({ onFollow(account) { if ( account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested']) ) { if (unfollowModal) { dispatch( openModal('CONFIRM', { message: ( <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} /> ), confirm: intl.formatMessage(messages.unfollowConfirm), onConfirm: () => dispatch(unfollowAccount(account.get('id'))), }), ); } else { dispatch(unfollowAccount(account.get('id'))); } } else { dispatch(followAccount(account.get('id'))); } }, onBlock(account) { if (account.getIn(['relationship', 'blocking'])) { dispatch(unblockAccount(account.get('id'))); } }, onMute(account) { if (account.getIn(['relationship', 'muting'])) { dispatch(unmuteAccount(account.get('id'))); } }, }); export default @injectIntl @connect(makeMapStateToProps, mapDispatchToProps) class AccountCard extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, intl: PropTypes.object.isRequired, onFollow: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired, }; handleMouseEnter = ({ currentTarget }) => { if (autoPlayGif) { return; } const emojis = currentTarget.querySelectorAll('.custom-emoji'); for (var i = 0; i < emojis.length; i++) { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-original'); } } handleMouseLeave = ({ currentTarget }) => { if (autoPlayGif) { return; } const emojis = currentTarget.querySelectorAll('.custom-emoji'); for (var i = 0; i < emojis.length; i++) { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-static'); } } handleFollow = () => { this.props.onFollow(this.props.account); }; handleBlock = () => { this.props.onBlock(this.props.account); }; handleMute = () => { this.props.onMute(this.props.account); } handleEditProfile = () => { window.open('/settings/profile', '_blank'); } render() { const { account, intl } = this.props; let actionBtn; if (me !== account.get('id')) { if (!account.get('relationship')) { // Wait until the relationship is loaded actionBtn = ''; } else if (account.getIn(['relationship', 'requested'])) { actionBtn = <Button className={classNames('logo-button')} text={intl.formatMessage(messages.cancel_follow_request)} title={intl.formatMessage(messages.requested)} onClick={this.handleFollow} />; } else if (account.getIn(['relationship', 'muting'])) { actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.unmute)} onClick={this.handleMute} />; } else if (!account.getIn(['relationship', 'blocking'])) { actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames('logo-button', { 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.handleFollow} />; } else if (account.getIn(['relationship', 'blocking'])) { actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.unblock)} onClick={this.handleBlock} />; } } else { actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.edit_profile)} onClick={this.handleEditProfile} />; } return ( <div className='account-card'> <Permalink href={account.get('url')} to={`/@${account.get('acct')}`} className='account-card__permalink'> <div className='account-card__header'> <img src={ autoPlayGif ? account.get('header') : account.get('header_static') } alt='' /> </div> <div className='account-card__title'> <div className='account-card__title__avatar'><Avatar account={account} size={56} /></div> <DisplayName account={account} /> </div> </Permalink> {account.get('note').length > 0 && ( <div className='account-card__bio translate' onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} dangerouslySetInnerHTML={{ __html: account.get('note_emojified') }} /> )} <div className='account-card__actions'> <div className='account-card__counters'> <div className='account-card__counters__item'> <ShortNumber value={account.get('statuses_count')} /> <small> <FormattedMessage id='account.posts' defaultMessage='Posts' /> </small> </div> <div className='account-card__counters__item'> <ShortNumber value={account.get('followers_count')} />{' '} <small> <FormattedMessage id='account.followers' defaultMessage='Followers' /> </small> </div> <div className='account-card__counters__item'> <ShortNumber value={account.get('following_count')} />{' '} <small> <FormattedMessage id='account.following' defaultMessage='Following' /> </small> </div> </div> <div className='account-card__actions__button'> {actionBtn} </div> </div> </div> ); } }
packages/netlify-cms-widget-image/src/ImagePreview.js
netlify/netlify-cms
import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; import { List } from 'immutable'; import { WidgetPreviewContainer } from 'netlify-cms-ui-default'; const StyledImage = styled(({ src }) => <img src={src || ''} role="presentation" />)` display: block; max-width: 100%; height: auto; `; function StyledImageAsset({ getAsset, value, field }) { return <StyledImage src={getAsset(value, field)} />; } function ImagePreviewContent(props) { const { value, getAsset, field } = props; if (Array.isArray(value) || List.isList(value)) { return value.map(val => ( <StyledImageAsset key={val} value={val} getAsset={getAsset} field={field} /> )); } return <StyledImageAsset {...props} />; } function ImagePreview(props) { return ( <WidgetPreviewContainer> {props.value ? <ImagePreviewContent {...props} /> : null} </WidgetPreviewContainer> ); } ImagePreview.propTypes = { getAsset: PropTypes.func.isRequired, value: PropTypes.node, }; export default ImagePreview;
packages/material-ui-icons/src/RepeatOneRounded.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M7 7h10v1.79c0 .45.54.67.85.35l2.79-2.79c.2-.2.2-.51 0-.71l-2.79-2.79c-.31-.31-.85-.09-.85.36V5H6c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1V7zm10 10H7v-1.79c0-.45-.54-.67-.85-.35l-2.79 2.79c-.2.2-.2.51 0 .71l2.79 2.79c.31.31.85.09.85-.36V19h11c.55 0 1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1v3zm-4-2.75V9.81c0-.45-.36-.81-.81-.81-.13 0-.25.03-.36.09l-1.49.74c-.21.1-.34.32-.34.55 0 .34.28.62.62.62h.88v3.25c0 .41.34.75.75.75s.75-.34.75-.75z" /> , 'RepeatOneRounded');
classic/src/scenes/mailboxes/src/Scenes/SwitcherScene/SwitcherScene.js
wavebox/waveboxapp
import React from 'react' import PropTypes from 'prop-types' import shallowCompare from 'react-addons-shallow-compare' import { withStyles } from '@material-ui/core/styles' import Zoom from '@material-ui/core/Zoom' import SwitcherSceneContent from './SwitcherSceneContent' import { RouterDialog, RouterDialogStateProvider } from 'wbui/RouterDialog' import { WB_QUICK_SWITCH_NEXT, WB_QUICK_SWITCH_PREV, WB_QUICK_SWITCH_PRESENT_NEXT, WB_QUICK_SWITCH_PRESENT_PREV } from 'shared/ipcEvents' import { ipcRenderer } from 'electron' import { accountActions } from 'stores/account' const TRANSITION_DURATION = 50 const styles = { root: { maxWidth: '100%', backgroundColor: 'rgba(245, 245, 245, 0.95)', borderRadius: 10 } } @withStyles(styles) class SwitcherScene extends React.Component { /* **************************************************************************/ // Class /* **************************************************************************/ static propTypes = { routeName: PropTypes.string.isRequired } /* **************************************************************************/ // Component lifecycle /* **************************************************************************/ componentDidMount () { ipcRenderer.on(WB_QUICK_SWITCH_NEXT, this.handleIPCNext) ipcRenderer.on(WB_QUICK_SWITCH_PREV, this.handleIPCPrev) ipcRenderer.on(WB_QUICK_SWITCH_PRESENT_NEXT, this.handleIPCPresentNext) ipcRenderer.on(WB_QUICK_SWITCH_PRESENT_PREV, this.handleIPCPresentPrev) } componentWillUnmount () { ipcRenderer.removeListener(WB_QUICK_SWITCH_NEXT, this.handleIPCNext) ipcRenderer.removeListener(WB_QUICK_SWITCH_PREV, this.handleIPCPrev) ipcRenderer.removeListener(WB_QUICK_SWITCH_PRESENT_NEXT, this.handleIPCPresentNext) ipcRenderer.removeListener(WB_QUICK_SWITCH_PRESENT_PREV, this.handleIPCPresentPrev) } /* **************************************************************************/ // User Interaction /* **************************************************************************/ /** * Quick switches to the next account */ handleIPCNext = (evt) => { window.location.hash = '/' accountActions.quickSwitchNextService() } /** * Quick switches to the prev account */ handleIPCPrev = (evt) => { window.location.hash = '/' accountActions.quickSwitchPrevService() } /** * Launches quick switch in next mode */ handleIPCPresentNext = (evt) => { window.location.hash = '/switcher/next' } /** * Launches quick switch in prev mode */ handleIPCPresentPrev = (evt) => { window.location.hash = '/switcher/prev' } /** * Closes the modal */ handleClose = () => { window.location.hash = '/' } /* **************************************************************************/ // Rendering /* **************************************************************************/ shouldComponentUpdate (nextProps, nextState) { return shallowCompare(this, nextProps, nextState) } render () { const { classes, routeName } = this.props return ( <RouterDialog routeName={routeName} disableEnforceFocus transitionDuration={TRANSITION_DURATION} TransitionComponent={Zoom} onClose={this.handleClose} classes={{ paper: classes.root }}> <RouterDialogStateProvider routeName={routeName} Component={SwitcherSceneContent} /> </RouterDialog> ) } } export default SwitcherScene
ajax/libs/muicss/0.6.1/extra/mui-react-combined.min.js
tholu/cdnjs
!function(e){var t=e.babelHelpers={};t.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t.createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),t["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},t.inherits=function(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)},t.interopRequireDefault=function(e){return e&&e.__esModule?e:{"default":e}},t.interopRequireWildcard=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t},t.objectWithoutProperties=function(e,t){var i={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o]);return i},t.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}}("undefined"==typeof global?self:global),function e(t,i,o){function l(r,a){if(!i[r]){if(!t[r]){var s="function"==typeof require&&require;if(!a&&s)return s(r,!0);if(n)return n(r,!0);throw new Error("Cannot find module '"+r+"'")}var u=i[r]={exports:{}};t[r][0].call(u.exports,function(e){var i=t[r][1][e];return l(i?i:e)},u,u.exports,e,t,i,o)}return i[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)l(o[r]);return l}({1:[function(e,t,i){"use strict";!function(t){if(!t._muiReactLoaded){t._muiReactLoaded=!0;var i=t.mui=t.mui||[],o=i.react={};o.Appbar=e("src/react/appbar"),o.Button=e("src/react/button"),o.Caret=e("src/react/caret"),o.Checkbox=e("src/react/checkbox"),o.Col=e("src/react/col"),o.Container=e("src/react/container"),o.Divider=e("src/react/divider"),o.Dropdown=e("src/react/dropdown"),o.DropdownItem=e("src/react/dropdown-item"),o.Form=e("src/react/form"),o.Input=e("src/react/input"),o.Option=e("src/react/option"),o.Panel=e("src/react/panel"),o.Radio=e("src/react/radio"),o.Row=e("src/react/row"),o.Select=e("src/react/select"),o.Tab=e("src/react/tab"),o.Tabs=e("src/react/tabs"),o.Textarea=e("src/react/textarea")}}(window)},{"src/react/appbar":14,"src/react/button":15,"src/react/caret":16,"src/react/checkbox":17,"src/react/col":18,"src/react/container":19,"src/react/divider":20,"src/react/dropdown":22,"src/react/dropdown-item":21,"src/react/form":23,"src/react/input":24,"src/react/option":25,"src/react/panel":26,"src/react/radio":27,"src/react/row":28,"src/react/select":29,"src/react/tab":30,"src/react/tabs":31,"src/react/textarea":32}],2:[function(e,t,i){"use strict";!function(t){if(!t._muiReactCombinedLoaded){t._muiReactCombinedLoaded=!0;var i=e("src/js/lib/util");i.loadStyle(e("mui.min.css")),e("./cdn-react")}}(window)},{"./cdn-react":1,"mui.min.css":12,"src/js/lib/util":13}],3:[function(e,t,i){"use strict";t.exports={debug:!0}},{}],4:[function(e,t,i){"use strict";function o(e,t,i){var o,s,u,c,p=document.documentElement.clientHeight,d=t*r+2*a,m=Math.min(d,p);s=a+r-(l+n),s-=i*r,u=-1*e.getBoundingClientRect().top,c=p-m+u,o=Math.min(Math.max(s,u),c);var b,f,h=0;return d>p&&(b=a+(i+1)*r-(-1*o+l+n),f=t*r+2*a-m,h=Math.min(b,f)),{height:m+"px",top:o+"px",scrollTop:h}}var l=15,n=32,r=42,a=8;t.exports={getMenuPositionalCSS:o}},{}],5:[function(e,t,i){"use strict";function o(e,t){if(t&&e.setAttribute){for(var i,o=f(e),l=t.split(" "),n=0;n<l.length;n++)i=l[n].trim(),-1===o.indexOf(" "+i+" ")&&(o+=i+" ");e.setAttribute("class",o.trim())}}function l(e,t,i){if(void 0===t)return getComputedStyle(e);var o=r(t);{if("object"!==o){"string"===o&&void 0!==i&&(e.style[h(t)]=i);var l=getComputedStyle(e),n="array"===r(t);if(!n)return g(e,t,l);for(var a,s={},u=0;u<t.length;u++)a=t[u],s[a]=g(e,a,l);return s}for(var a in t)e.style[h(a)]=t[a]}}function n(e,t){return t&&e.getAttribute?f(e).indexOf(" "+t+" ")>-1:!1}function r(e){if(void 0===e)return"undefined";var t=Object.prototype.toString.call(e);if(0===t.indexOf("[object "))return t.slice(8,-1).toLowerCase();throw new Error("MUI: Could not understand type: "+t)}function a(e,t,i,o){o=void 0===o?!1:o;var l=e._muiEventCache=e._muiEventCache||{};t.split(" ").map(function(t){e.addEventListener(t,i,o),l[t]=l[t]||[],l[t].push([i,o])})}function s(e,t,i,o){o=void 0===o?!1:o;var l,n,r,a=e._muiEventCache=e._muiEventCache||{};t.split(" ").map(function(t){for(l=a[t]||[],r=l.length;r--;)n=l[r],(void 0===i||n[0]===i&&n[1]===o)&&(l.splice(r,1),e.removeEventListener(t,n[0],n[1]))})}function u(e,t,i,o){t.split(" ").map(function(t){a(e,t,function l(o){i&&i.apply(this,arguments),s(e,t,l)},o)})}function c(e,t){var i=window;if(void 0===t){if(e===i){var o=document.documentElement;return(i.pageXOffset||o.scrollLeft)-(o.clientLeft||0)}return e.scrollLeft}e===i?i.scrollTo(t,p(i)):e.scrollLeft=t}function p(e,t){var i=window;if(void 0===t){if(e===i){var o=document.documentElement;return(i.pageYOffset||o.scrollTop)-(o.clientTop||0)}return e.scrollTop}e===i?i.scrollTo(c(i),t):e.scrollTop=t}function d(e){var t=window,i=e.getBoundingClientRect(),o=p(t),l=c(t);return{top:i.top+o,left:i.left+l,height:i.height,width:i.width}}function m(e){var t=!1,i=!0,o=document,l=o.defaultView,n=o.documentElement,r=o.addEventListener?"addEventListener":"attachEvent",a=o.addEventListener?"removeEventListener":"detachEvent",s=o.addEventListener?"":"on",u=function d(i){"readystatechange"==i.type&&"complete"!=o.readyState||(("load"==i.type?l:o)[a](s+i.type,d,!1),!t&&(t=!0)&&e.call(l,i.type||i))},c=function m(){try{n.doScroll("left")}catch(e){return void setTimeout(m,50)}u("poll")};if("complete"==o.readyState)e.call(l,"lazy");else{if(o.createEventObject&&n.doScroll){try{i=!l.frameElement}catch(p){}i&&c()}o[r](s+"DOMContentLoaded",u,!1),o[r](s+"readystatechange",u,!1),l[r](s+"load",u,!1)}}function b(e,t){if(t&&e.setAttribute){for(var i,o=f(e),l=t.split(" "),n=0;n<l.length;n++)for(i=l[n].trim();o.indexOf(" "+i+" ")>=0;)o=o.replace(" "+i+" "," ");e.setAttribute("class",o.trim())}}function f(e){var t=(e.getAttribute("class")||"").replace(/[\n\t]/g,"");return" "+t+" "}function h(e){return e.replace(v,function(e,t,i,o){return o?i.toUpperCase():i}).replace(y,"Moz$1")}function g(e,t,i){var o;return o=i.getPropertyValue(t),""!==o||e.ownerDocument||(o=e.style[h(t)]),o}var x,v=/([\:\-\_]+(.))/g,y=/^moz([A-Z])/;x={multiple:!0,selected:!0,checked:!0,disabled:!0,readonly:!0,required:!0,open:!0},t.exports={addClass:o,css:l,hasClass:n,off:s,offset:d,on:a,one:u,ready:m,removeClass:b,type:r,scrollLeft:c,scrollTop:p}},{}],6:[function(e,t,i){"use strict";function o(){var e=window;if(g.debug&&"undefined"!=typeof e.console)try{e.console.log.apply(e.console,arguments)}catch(t){var i=Array.prototype.slice.call(arguments);e.console.log(i.join("\n"))}}function l(e){var t,i=document;t=i.head||i.getElementsByTagName("head")[0]||i.documentElement;var o=i.createElement("style");return o.type="text/css",o.styleSheet?o.styleSheet.cssText=e:o.appendChild(i.createTextNode(e)),t.insertBefore(o,t.firstChild),o}function n(e,t){if(!t)throw new Error("MUI: "+e);"undefined"!=typeof console&&console.error("MUI Warning: "+e)}function r(e){if(v.push(e),void 0===v._initialized){var t=document,i="animationstart mozAnimationStart webkitAnimationStart";x.on(t,i,a),v._initialized=!0}}function a(e){if("mui-node-inserted"===e.animationName)for(var t=e.target,i=v.length-1;i>=0;i--)v[i](t)}function s(e){var t="";for(var i in e)t+=e[i]?i+" ":"";return t.trim()}function u(){if(void 0!==h)return h;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",h="auto"===e.style.pointerEvents}function c(e,t){return function(){e[t].apply(e,arguments)}}function p(e,t,i,o,l){var n,r=document.createEvent("HTMLEvents"),i=void 0!==i?i:!0,o=void 0!==o?o:!0;if(r.initEvent(t,i,o),l)for(n in l)r[n]=l[n];return e&&e.dispatchEvent(r),r}function d(){if(y+=1,1===y){var e=window,t=document;f={left:x.scrollLeft(e),top:x.scrollTop(e)},x.addClass(t.body,w),e.scrollTo(f.left,f.top)}}function m(){if(0!==y&&(y-=1,0===y)){var e=window,t=document;x.removeClass(t.body,w),e.scrollTo(f.left,f.top)}}function b(e){window.requestAnimationFrame?b(e):setTimeout(e,0)}var f,h,g=e("../config"),x=e("./jqLite"),v=[],y=0,w="mui-body--scroll-lock";t.exports={callback:c,classNames:s,disableScrollLock:m,dispatchEvent:p,enableScrollLock:d,log:o,loadStyle:l,onNodeInserted:r,raiseError:n,requestAnimationFrame:b,supportsPointerEvents:u}},{"../config":3,"./jqLite":5}],7:[function(e,t,i){"use strict";var o="You provided a `value` prop to a form field without an `OnChange` handler. Please see React documentation on controlled components";t.exports={controlledMessage:o}},{}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/jqLite"),r=babelHelpers.interopRequireWildcard(n),a=e("../js/lib/util"),s=babelHelpers.interopRequireWildcard(a),u=l["default"].PropTypes,c="mui-btn",p={color:1,variant:1,size:1},d=600,m="ontouchstart"in document.documentElement,b=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));i.state={ripples:{}},i.rippleTimers=[];var o=s.callback;return i.onClickCB=o(i,"onClick"),i.onMouseDownCB=o(i,"onMouseDown"),i.onMouseUpCB=o(i,"onMouseUp"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){var e=this.refs.buttonEl;e._muiDropdown=!0,e._muiRipple=!0}},{key:"componentWillUnmount",value:function(){for(var e=this.rippleTimers,t=e.length;t--;)clearTimeout(e[t])}},{key:"onClick",value:function(e){var t=this.props.onClick;t&&t(e)}},{key:"onMouseDown",value:function(e){if(!m||"mousedown"!==e.type){var t=r.offset(this.refs.buttonEl),i="touchstart"===e.type?e.touches[0]:e,o=t.height;"fab"===this.props.variant&&(o/=2);var l=this.state.ripples,n=Date.now();l[n]={xPos:i.pageX-t.left,yPos:i.pageY-t.top,diameter:o,animateOut:!1},this.setState({ripples:l})}}},{key:"onMouseUp",value:function(e){var t=this,i=this.state.ripples,o=Object.keys(i),l=void 0;for(l in i)i[l].animateOut=!0;this.setState({ripples:i});var n=setTimeout(function(){for(var e=t.state.ripples,i=o.length;i--;)delete e[o[i]];t.setState({ripples:e})},d);this.rippleTimers.push(n)}},{key:"render",value:function(){var e=c,t=void 0,i=void 0,o=this.state.ripples;for(t in p)i=this.props[t],"default"!==i&&(e+=" "+c+"--"+i);return l["default"].createElement("button",babelHelpers["extends"]({},this.props,{ref:"buttonEl",className:e+" "+this.props.className,onClick:this.onClickCB,onMouseDown:this.onMouseDownCB,onTouchStart:this.onMouseDownCB,onMouseUp:this.onMouseUpCB,onMouseLeave:this.onMouseUpCB,onTouchEnd:this.onMouseUpCB}),this.props.children,Object.keys(o).map(function(e,t){var i=o[e];return l["default"].createElement(f,{key:e,xPos:i.xPos,yPos:i.yPos,diameter:i.diameter,animateOut:i.animateOut})}))}}]),t}(l["default"].Component);b.propTypes={color:u.oneOf(["default","primary","danger","dark","accent"]),disabled:u.bool,size:u.oneOf(["default","small","large"]),type:u.oneOf(["submit","button"]),variant:u.oneOf(["default","flat","raised","fab"]),onClick:u.func},b.defaultProps={className:"",color:"default",disabled:!1,size:"default",type:null,variant:"default",onClick:null};var f=function(e){function t(){var e,i,o,l;babelHelpers.classCallCheck(this,t);for(var n=arguments.length,r=Array(n),a=0;n>a;a++)r[a]=arguments[a];return i=o=babelHelpers.possibleConstructorReturn(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(r))),o.state={animateIn:!1},l=i,babelHelpers.possibleConstructorReturn(o,l)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){var e=this;setTimeout(function(){e.setState({animateIn:!0})},0)}},{key:"render",value:function(){var e=this.props.diameter,t=e/2,i={height:e,width:e,top:this.props.yPos-t||0,left:this.props.xPos-t||0},o="mui-ripple-effect";return this.state.animateIn&&(o+=" mui--animate-in mui--active"),this.props.animateOut&&(o+=" mui--animate-out"),l["default"].createElement("div",{className:o,style:i})}}]),t}(l["default"].Component);f.propTypes={xPos:u.number,yPos:u.number,diameter:u.number,animateOut:u.bool},f.defaultProps={xPos:0,yPos:0,diameter:0,animateOut:!1},i["default"]=b,t.exports=i["default"]},{"../js/lib/jqLite":5,"../js/lib/util":6,react:"CwoHg3"}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.children,babelHelpers.objectWithoutProperties(e,["children"]));return l["default"].createElement("span",babelHelpers["extends"]({},t,{className:"mui-caret "+this.props.className}))}}]),t}(l["default"].Component);n.defaultProps={className:""},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=l["default"].PropTypes,r=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return null}}]),t}(l["default"].Component);r.propTypes={value:n.any,label:n.string,onActive:n.func},r.defaultProps={value:null,label:"",onActive:null},i["default"]=r,t.exports=i["default"]},{react:"CwoHg3"}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.TextField=void 0;var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/util"),r=babelHelpers.interopRequireWildcard(n),a=e("./_helpers"),s=l["default"].PropTypes,u=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e)),o=e.value,l=o||e.defaultValue;i.state={innerValue:l,isDirty:Boolean(l)},void 0!==o&&null===e.onChange&&r.raiseError(a.controlledMessage,!0);var n=r.callback;return i.onChangeCB=n(i,"onChange"),i.onFocusCB=n(i,"onFocus"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){this.refs.inputEl._muiTextfield=!0}},{key:"onChange",value:function(e){this.setState({innerValue:e.target.value});var t=this.props.onChange;t&&t(e)}},{key:"onFocus",value:function(e){this.setState({isDirty:!0})}},{key:"triggerFocus",value:function(){this.refs.inputEl.focus()}},{key:"render",value:function(){var e={},t=Boolean(this.state.innerValue),i=void 0;e["mui--is-empty"]=!t,e["mui--is-not-empty"]=t,e["mui--is-dirty"]=this.state.isDirty,e["mui--is-invalid"]=this.props.invalid,e=r.classNames(e);var o=this.props,n=(o.children,babelHelpers.objectWithoutProperties(o,["children"]));return i="textarea"===this.props.type?l["default"].createElement("textarea",babelHelpers["extends"]({},n,{ref:"inputEl",className:e,rows:this.props.rows,placeholder:this.props.hint,value:this.props.value,defaultValue:this.props.defaultValue,autoFocus:this.props.autoFocus,onChange:this.onChangeCB,onFocus:this.onFocusCB,required:this.props.required})):l["default"].createElement("input",babelHelpers["extends"]({},n,{ref:"inputEl",className:e,type:this.props.type,value:this.props.value,defaultValue:this.props.defaultValue,placeholder:this.props.hint,autoFocus:this.props.autofocus,onChange:this.onChangeCB,onFocus:this.onFocusCB,required:this.props.required}))}}]),t}(l["default"].Component);u.propTypes={hint:s.string,value:s.string,type:s.string,autoFocus:s.bool,onChange:s.func},u.defaultProps={hint:null,type:null,autoFocus:!1,onChange:null};var c=function(e){function t(){var e,i,o,l;babelHelpers.classCallCheck(this,t);for(var n=arguments.length,r=Array(n),a=0;n>a;a++)r[a]=arguments[a];return i=o=babelHelpers.possibleConstructorReturn(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(r))),o.state={style:{}},l=i,babelHelpers.possibleConstructorReturn(o,l)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){var e=this;this.styleTimer=setTimeout(function(){var t=".15s ease-out",i=void 0;i={transition:t,WebkitTransition:t,MozTransition:t,OTransition:t,msTransform:t},e.setState({style:i})},150)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.styleTimer)}},{key:"render",value:function(){return l["default"].createElement("label",{style:this.state.style,onClick:this.props.onClick},this.props.text)}}]),t}(l["default"].Component);c.defaultProps={text:"",onClick:null};var p=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return i.onClickCB=r.callback(i,"onClick"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"onClick",value:function(e){r.supportsPointerEvents()===!1&&(e.target.style.cursor="text",this.refs.inputEl.triggerFocus())}},{key:"render",value:function(){var e={},t=void 0;return this.props.label.length&&(t=l["default"].createElement(c,{text:this.props.label,onClick:this.onClickCB})),e["mui-textfield"]=!0,e["mui-textfield--float-label"]=this.props.floatingLabel,e=r.classNames(e),l["default"].createElement("div",{className:e},l["default"].createElement(u,babelHelpers["extends"]({ref:"inputEl"},this.props)),t)}}]),t}(l["default"].Component);p.propTypes={label:s.string,floatingLabel:s.bool},p.defaultProps={label:"",floatingLabel:!1},i.TextField=p},{"../js/lib/util":6,"./_helpers":7,react:"CwoHg3"}],12:[function(e,t,i){t.exports='/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}:after,:before{box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:transparent}body{font-family:Arial,Verdana,Tahoma;font-size:14px;font-weight:400;line-height:1.429;color:rgba(0,0,0,.87);background-color:#FFF}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#2196F3;text-decoration:none}a:focus,a:hover{color:#1976D2;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}p{margin:0 0 10px}ol,ul{margin-top:0;margin-bottom:10px}figure{margin:0}img{vertical-align:middle}hr{margin-top:20px;margin-bottom:20px;border:0;height:1px;background-color:rgba(0,0,0,.12)}legend{display:block;width:100%;padding:0;margin-bottom:10px;font-size:21px;color:rgba(0,0,0,.87);line-height:inherit;border:0}input[type=search]{box-sizing:border-box;-webkit-appearance:none}input[type=checkbox]:focus,input[type=radio]:focus,input[type=file]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type=checkbox]:disabled,input[type=radio]:disabled{cursor:not-allowed}strong{font-weight:700}abbr[title]{cursor:help;border-bottom:1px dotted #2196F3}h1,h2,h3{margin-top:20px;margin-bottom:10px}h4,h5,h6{margin-top:10px;margin-bottom:10px}.mui--appbar-height{height:56px}.mui--appbar-min-height,.mui-appbar{min-height:56px}.mui--appbar-line-height{line-height:56px}.mui--appbar-top{top:56px}@media (orientation:landscape) and (max-height:480px){.mui--appbar-height{height:48px}.mui--appbar-min-height,.mui-appbar{min-height:48px}.mui--appbar-line-height{line-height:48px}.mui--appbar-top{top:48px}}@media (min-width:480px){.mui--appbar-height{height:64px}.mui--appbar-min-height,.mui-appbar{min-height:64px}.mui--appbar-line-height{line-height:64px}.mui--appbar-top{top:64px}}.mui-appbar{background-color:#2196F3;color:#FFF}.mui-btn{animation-duration:.1ms;animation-name:mui-node-inserted;font-weight:500;font-size:14px;line-height:18px;text-transform:uppercase;color:rgba(0,0,0,.87);background-color:#FFF;transition:all .2s ease-in-out;display:inline-block;height:36px;padding:0 26px;margin-top:6px;margin-bottom:6px;border:none;border-radius:2px;cursor:pointer;-ms-touch-action:manipulation;touch-action:manipulation;background-image:none;text-align:center;line-height:36px;vertical-align:middle;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;letter-spacing:.03em;position:relative;overflow:hidden}.mui-btn:active,.mui-btn:focus,.mui-btn:hover{color:rgba(0,0,0,.87);background-color:#fff}.mui-btn[disabled]:active,.mui-btn[disabled]:focus,.mui-btn[disabled]:hover{color:rgba(0,0,0,.87);background-color:#FFF}.mui-btn.mui-btn--flat{color:rgba(0,0,0,.87);background-color:transparent}.mui-btn.mui-btn--flat:active,.mui-btn.mui-btn--flat:focus,.mui-btn.mui-btn--flat:hover{color:rgba(0,0,0,.87);background-color:#f2f2f2}.mui-btn.mui-btn--flat[disabled]:active,.mui-btn.mui-btn--flat[disabled]:focus,.mui-btn.mui-btn--flat[disabled]:hover{color:rgba(0,0,0,.87);background-color:transparent}.mui-btn:active,.mui-btn:focus,.mui-btn:hover{outline:0;text-decoration:none;color:rgba(0,0,0,.87)}.mui-btn:focus,.mui-btn:hover{box-shadow:0 0 2px rgba(0,0,0,.12),0 2px 2px rgba(0,0,0,.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn:focus,.mui-btn:hover{box-shadow:0 -1px 2px rgba(0,0,0,.12),-1px 0 2px rgba(0,0,0,.12),0 0 2px rgba(0,0,0,.12),0 2px 2px rgba(0,0,0,.2)}}.mui-btn:active:hover{box-shadow:0 10px 20px rgba(0,0,0,.19),0 6px 6px rgba(0,0,0,.23)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn:active:hover{box-shadow:0 -1px 2px rgba(0,0,0,.12),-1px 0 2px rgba(0,0,0,.12),0 10px 20px rgba(0,0,0,.19),0 6px 6px rgba(0,0,0,.23)}}.mui-btn.mui--is-disabled,.mui-btn:disabled{cursor:not-allowed;pointer-events:none;opacity:.6;box-shadow:none}.mui-btn+.mui-btn{margin-left:8px}.mui-btn--flat{background-color:transparent}.mui-btn--flat:active,.mui-btn--flat:active:hover,.mui-btn--flat:focus,.mui-btn--flat:hover{box-shadow:none;background-color:#f2f2f2}.mui-btn--fab,.mui-btn--raised{box-shadow:0 0 2px rgba(0,0,0,.12),0 2px 2px rgba(0,0,0,.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn--fab,.mui-btn--raised{box-shadow:0 -1px 2px rgba(0,0,0,.12),-1px 0 2px rgba(0,0,0,.12),0 0 2px rgba(0,0,0,.12),0 2px 2px rgba(0,0,0,.2)}}.mui-btn--fab:active,.mui-btn--raised:active{box-shadow:0 10px 20px rgba(0,0,0,.19),0 6px 6px rgba(0,0,0,.23)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn--fab:active,.mui-btn--raised:active{box-shadow:0 -1px 2px rgba(0,0,0,.12),-1px 0 2px rgba(0,0,0,.12),0 10px 20px rgba(0,0,0,.19),0 6px 6px rgba(0,0,0,.23)}}.mui-btn--fab{position:relative;padding:0;width:55px;height:55px;line-height:55px;border-radius:50%;z-index:1}.mui-btn--primary{color:#FFF;background-color:#2196F3}.mui-btn--primary:active,.mui-btn--primary:focus,.mui-btn--primary:hover{color:#FFF;background-color:#39a1f4}.mui-btn--primary[disabled]:active,.mui-btn--primary[disabled]:focus,.mui-btn--primary[disabled]:hover{color:#FFF;background-color:#2196F3}.mui-btn--primary.mui-btn--flat{color:#2196F3;background-color:transparent}.mui-btn--primary.mui-btn--flat:active,.mui-btn--primary.mui-btn--flat:focus,.mui-btn--primary.mui-btn--flat:hover{color:#2196F3;background-color:#f2f2f2}.mui-btn--primary.mui-btn--flat[disabled]:active,.mui-btn--primary.mui-btn--flat[disabled]:focus,.mui-btn--primary.mui-btn--flat[disabled]:hover{color:#2196F3;background-color:transparent}.mui-btn--dark{color:#FFF;background-color:#424242}.mui-btn--dark:active,.mui-btn--dark:focus,.mui-btn--dark:hover{color:#FFF;background-color:#4f4f4f}.mui-btn--dark[disabled]:active,.mui-btn--dark[disabled]:focus,.mui-btn--dark[disabled]:hover{color:#FFF;background-color:#424242}.mui-btn--dark.mui-btn--flat{color:#424242;background-color:transparent}.mui-btn--dark.mui-btn--flat:active,.mui-btn--dark.mui-btn--flat:focus,.mui-btn--dark.mui-btn--flat:hover{color:#424242;background-color:#f2f2f2}.mui-btn--dark.mui-btn--flat[disabled]:active,.mui-btn--dark.mui-btn--flat[disabled]:focus,.mui-btn--dark.mui-btn--flat[disabled]:hover{color:#424242;background-color:transparent}.mui-btn--danger{color:#FFF;background-color:#F44336}.mui-btn--danger:active,.mui-btn--danger:focus,.mui-btn--danger:hover{color:#FFF;background-color:#f55a4e}.mui-btn--danger[disabled]:active,.mui-btn--danger[disabled]:focus,.mui-btn--danger[disabled]:hover{color:#FFF;background-color:#F44336}.mui-btn--danger.mui-btn--flat{color:#F44336;background-color:transparent}.mui-btn--danger.mui-btn--flat:active,.mui-btn--danger.mui-btn--flat:focus,.mui-btn--danger.mui-btn--flat:hover{color:#F44336;background-color:#f2f2f2}.mui-btn--danger.mui-btn--flat[disabled]:active,.mui-btn--danger.mui-btn--flat[disabled]:focus,.mui-btn--danger.mui-btn--flat[disabled]:hover{color:#F44336;background-color:transparent}.mui-btn--accent{color:#FFF;background-color:#FF4081}.mui-btn--accent:active,.mui-btn--accent:focus,.mui-btn--accent:hover{color:#FFF;background-color:#ff5a92}.mui-btn--accent[disabled]:active,.mui-btn--accent[disabled]:focus,.mui-btn--accent[disabled]:hover{color:#FFF;background-color:#FF4081}.mui-btn--accent.mui-btn--flat{color:#FF4081;background-color:transparent}.mui-btn--accent.mui-btn--flat:active,.mui-btn--accent.mui-btn--flat:focus,.mui-btn--accent.mui-btn--flat:hover{color:#FF4081;background-color:#f2f2f2}.mui-btn--accent.mui-btn--flat[disabled]:active,.mui-btn--accent.mui-btn--flat[disabled]:focus,.mui-btn--accent.mui-btn--flat[disabled]:hover{color:#FF4081;background-color:transparent}.mui-btn--small{height:30.6px;line-height:30.6px;padding:0 16px;font-size:13px}.mui-btn--large{height:54px;line-height:54px;padding:0 26px;font-size:14px}.mui-btn--fab.mui-btn--small{width:44px;height:44px;line-height:44px}.mui-btn--fab.mui-btn--large{width:75px;height:75px;line-height:75px}.mui-checkbox,.mui-radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.mui-checkbox>label,.mui-radio>label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.mui-checkbox--inline>label>input[type=checkbox],.mui-checkbox>label>input[type=checkbox],.mui-radio--inline>label>input[type=radio],.mui-radio>label>input[type=radio]{position:absolute;margin-left:-20px;margin-top:4px}.mui-checkbox+.mui-checkbox,.mui-radio+.mui-radio{margin-top:-5px}.mui-checkbox--inline,.mui-radio--inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.mui-checkbox--inline>input[type=checkbox],.mui-checkbox--inline>input[type=radio],.mui-checkbox--inline>label>input[type=checkbox],.mui-checkbox--inline>label>input[type=radio],.mui-radio--inline>input[type=checkbox],.mui-radio--inline>input[type=radio],.mui-radio--inline>label>input[type=checkbox],.mui-radio--inline>label>input[type=radio]{margin:4px 0 0;line-height:normal}.mui-checkbox--inline+.mui-checkbox--inline,.mui-radio--inline+.mui-radio--inline{margin-top:0;margin-left:10px}.mui-container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.mui-container:after,.mui-container:before{content:" ";display:table}.mui-container:after{clear:both}@media (min-width:544px){.mui-container{max-width:570px}}@media (min-width:768px){.mui-container{max-width:740px}}@media (min-width:992px){.mui-container{max-width:960px}}@media (min-width:1200px){.mui-container{max-width:1170px}}.mui-container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.mui-container-fluid:after,.mui-container-fluid:before{content:" ";display:table}.mui-container-fluid:after{clear:both}.mui-divider{display:block;height:1px;background-color:rgba(0,0,0,.12)}.mui--divider-top{border-top:1px solid rgba(0,0,0,.12)}.mui--divider-bottom{border-bottom:1px solid rgba(0,0,0,.12)}.mui--divider-left{border-left:1px solid rgba(0,0,0,.12)}.mui--divider-right{border-right:1px solid rgba(0,0,0,.12)}.mui-dropdown{display:inline-block;position:relative}[data-mui-toggle=dropdown]{animation-duration:.1ms;animation-name:mui-node-inserted;outline:0}.mui-dropdown__menu{position:absolute;top:100%;left:0;display:none;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;text-align:left;background-color:#FFF;border-radius:2px;z-index:1;background-clip:padding-box}.mui-dropdown__menu.mui--is-open{display:block}.mui-dropdown__menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.429;color:rgba(0,0,0,.87);white-space:nowrap}.mui-dropdown__menu>li>a:focus,.mui-dropdown__menu>li>a:hover{text-decoration:none;color:rgba(0,0,0,.87);background-color:#EEE}.mui-dropdown__menu>.mui--is-disabled>a,.mui-dropdown__menu>.mui--is-disabled>a:focus,.mui-dropdown__menu>.mui--is-disabled>a:hover{color:#EEE}.mui-dropdown__menu>.mui--is-disabled>a:focus,.mui-dropdown__menu>.mui--is-disabled>a:hover{text-decoration:none;background-color:transparent;background-image:none;cursor:not-allowed}.mui-dropdown__menu--right{left:auto;right:0}@media (min-width:544px){.mui-form--inline>.mui-textfield{display:inline-block;margin-bottom:0}.mui-form--inline>.mui-checkbox,.mui-form--inline>.mui-radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.mui-form--inline>.mui-checkbox>label,.mui-form--inline>.mui-radio>label{padding-left:0}.mui-form--inline>.mui-checkbox>label>input[type=checkbox],.mui-form--inline>.mui-radio>label>input[type=radio]{position:relative;margin-left:0}.mui-form--inline>.mui-select{display:inline-block}.mui-form--inline>.mui-btn{margin-bottom:0;margin-top:0;vertical-align:bottom}}.mui-row{margin-left:-15px;margin-right:-15px}.mui-row:after,.mui-row:before{content:" ";display:table}.mui-row:after{clear:both}.mui-col-lg-1,.mui-col-lg-10,.mui-col-lg-11,.mui-col-lg-12,.mui-col-lg-2,.mui-col-lg-3,.mui-col-lg-4,.mui-col-lg-5,.mui-col-lg-6,.mui-col-lg-7,.mui-col-lg-8,.mui-col-lg-9,.mui-col-md-1,.mui-col-md-10,.mui-col-md-11,.mui-col-md-12,.mui-col-md-2,.mui-col-md-3,.mui-col-md-4,.mui-col-md-5,.mui-col-md-6,.mui-col-md-7,.mui-col-md-8,.mui-col-md-9,.mui-col-sm-1,.mui-col-sm-10,.mui-col-sm-11,.mui-col-sm-12,.mui-col-sm-2,.mui-col-sm-3,.mui-col-sm-4,.mui-col-sm-5,.mui-col-sm-6,.mui-col-sm-7,.mui-col-sm-8,.mui-col-sm-9,.mui-col-xs-1,.mui-col-xs-10,.mui-col-xs-11,.mui-col-xs-12,.mui-col-xs-2,.mui-col-xs-3,.mui-col-xs-4,.mui-col-xs-5,.mui-col-xs-6,.mui-col-xs-7,.mui-col-xs-8,.mui-col-xs-9{min-height:1px;padding-left:15px;padding-right:15px}.mui-col-xs-1,.mui-col-xs-10,.mui-col-xs-11,.mui-col-xs-12,.mui-col-xs-2,.mui-col-xs-3,.mui-col-xs-4,.mui-col-xs-5,.mui-col-xs-6,.mui-col-xs-7,.mui-col-xs-8,.mui-col-xs-9{float:left}.mui-col-xs-1{width:8.33333%}.mui-col-xs-2{width:16.66667%}.mui-col-xs-3{width:25%}.mui-col-xs-4{width:33.33333%}.mui-col-xs-5{width:41.66667%}.mui-col-xs-6{width:50%}.mui-col-xs-7{width:58.33333%}.mui-col-xs-8{width:66.66667%}.mui-col-xs-9{width:75%}.mui-col-xs-10{width:83.33333%}.mui-col-xs-11{width:91.66667%}.mui-col-xs-12{width:100%}.mui-col-xs-offset-0{margin-left:0}.mui-col-xs-offset-1{margin-left:8.33333%}.mui-col-xs-offset-2{margin-left:16.66667%}.mui-col-xs-offset-3{margin-left:25%}.mui-col-xs-offset-4{margin-left:33.33333%}.mui-col-xs-offset-5{margin-left:41.66667%}.mui-col-xs-offset-6{margin-left:50%}.mui-col-xs-offset-7{margin-left:58.33333%}.mui-col-xs-offset-8{margin-left:66.66667%}.mui-col-xs-offset-9{margin-left:75%}.mui-col-xs-offset-10{margin-left:83.33333%}.mui-col-xs-offset-11{margin-left:91.66667%}.mui-col-xs-offset-12{margin-left:100%}@media (min-width:544px){.mui-col-sm-1,.mui-col-sm-10,.mui-col-sm-11,.mui-col-sm-12,.mui-col-sm-2,.mui-col-sm-3,.mui-col-sm-4,.mui-col-sm-5,.mui-col-sm-6,.mui-col-sm-7,.mui-col-sm-8,.mui-col-sm-9{float:left}.mui-col-sm-1{width:8.33333%}.mui-col-sm-2{width:16.66667%}.mui-col-sm-3{width:25%}.mui-col-sm-4{width:33.33333%}.mui-col-sm-5{width:41.66667%}.mui-col-sm-6{width:50%}.mui-col-sm-7{width:58.33333%}.mui-col-sm-8{width:66.66667%}.mui-col-sm-9{width:75%}.mui-col-sm-10{width:83.33333%}.mui-col-sm-11{width:91.66667%}.mui-col-sm-12{width:100%}.mui-col-sm-offset-0{margin-left:0}.mui-col-sm-offset-1{margin-left:8.33333%}.mui-col-sm-offset-2{margin-left:16.66667%}.mui-col-sm-offset-3{margin-left:25%}.mui-col-sm-offset-4{margin-left:33.33333%}.mui-col-sm-offset-5{margin-left:41.66667%}.mui-col-sm-offset-6{margin-left:50%}.mui-col-sm-offset-7{margin-left:58.33333%}.mui-col-sm-offset-8{margin-left:66.66667%}.mui-col-sm-offset-9{margin-left:75%}.mui-col-sm-offset-10{margin-left:83.33333%}.mui-col-sm-offset-11{margin-left:91.66667%}.mui-col-sm-offset-12{margin-left:100%}}@media (min-width:768px){.mui-col-md-1,.mui-col-md-10,.mui-col-md-11,.mui-col-md-12,.mui-col-md-2,.mui-col-md-3,.mui-col-md-4,.mui-col-md-5,.mui-col-md-6,.mui-col-md-7,.mui-col-md-8,.mui-col-md-9{float:left}.mui-col-md-1{width:8.33333%}.mui-col-md-2{width:16.66667%}.mui-col-md-3{width:25%}.mui-col-md-4{width:33.33333%}.mui-col-md-5{width:41.66667%}.mui-col-md-6{width:50%}.mui-col-md-7{width:58.33333%}.mui-col-md-8{width:66.66667%}.mui-col-md-9{width:75%}.mui-col-md-10{width:83.33333%}.mui-col-md-11{width:91.66667%}.mui-col-md-12{width:100%}.mui-col-md-offset-0{margin-left:0}.mui-col-md-offset-1{margin-left:8.33333%}.mui-col-md-offset-2{margin-left:16.66667%}.mui-col-md-offset-3{margin-left:25%}.mui-col-md-offset-4{margin-left:33.33333%}.mui-col-md-offset-5{margin-left:41.66667%}.mui-col-md-offset-6{margin-left:50%}.mui-col-md-offset-7{margin-left:58.33333%}.mui-col-md-offset-8{margin-left:66.66667%}.mui-col-md-offset-9{margin-left:75%}.mui-col-md-offset-10{margin-left:83.33333%}.mui-col-md-offset-11{margin-left:91.66667%}.mui-col-md-offset-12{margin-left:100%}}@media (min-width:992px){.mui-col-lg-1,.mui-col-lg-10,.mui-col-lg-11,.mui-col-lg-12,.mui-col-lg-2,.mui-col-lg-3,.mui-col-lg-4,.mui-col-lg-5,.mui-col-lg-6,.mui-col-lg-7,.mui-col-lg-8,.mui-col-lg-9{float:left}.mui-col-lg-1{width:8.33333%}.mui-col-lg-2{width:16.66667%}.mui-col-lg-3{width:25%}.mui-col-lg-4{width:33.33333%}.mui-col-lg-5{width:41.66667%}.mui-col-lg-6{width:50%}.mui-col-lg-7{width:58.33333%}.mui-col-lg-8{width:66.66667%}.mui-col-lg-9{width:75%}.mui-col-lg-10{width:83.33333%}.mui-col-lg-11{width:91.66667%}.mui-col-lg-12{width:100%}.mui-col-lg-offset-0{margin-left:0}.mui-col-lg-offset-1{margin-left:8.33333%}.mui-col-lg-offset-2{margin-left:16.66667%}.mui-col-lg-offset-3{margin-left:25%}.mui-col-lg-offset-4{margin-left:33.33333%}.mui-col-lg-offset-5{margin-left:41.66667%}.mui-col-lg-offset-6{margin-left:50%}.mui-col-lg-offset-7{margin-left:58.33333%}.mui-col-lg-offset-8{margin-left:66.66667%}.mui-col-lg-offset-9{margin-left:75%}.mui-col-lg-offset-10{margin-left:83.33333%}.mui-col-lg-offset-11{margin-left:91.66667%}.mui-col-lg-offset-12{margin-left:100%}}@media (min-width:1200px){.mui-col-xl-1,.mui-col-xl-10,.mui-col-xl-11,.mui-col-xl-12,.mui-col-xl-2,.mui-col-xl-3,.mui-col-xl-4,.mui-col-xl-5,.mui-col-xl-6,.mui-col-xl-7,.mui-col-xl-8,.mui-col-xl-9{float:left}.mui-col-xl-1{width:8.33333%}.mui-col-xl-2{width:16.66667%}.mui-col-xl-3{width:25%}.mui-col-xl-4{width:33.33333%}.mui-col-xl-5{width:41.66667%}.mui-col-xl-6{width:50%}.mui-col-xl-7{width:58.33333%}.mui-col-xl-8{width:66.66667%}.mui-col-xl-9{width:75%}.mui-col-xl-10{width:83.33333%}.mui-col-xl-11{width:91.66667%}.mui-col-xl-12{width:100%}.mui-col-xl-offset-0{margin-left:0}.mui-col-xl-offset-1{margin-left:8.33333%}.mui-col-xl-offset-2{margin-left:16.66667%}.mui-col-xl-offset-3{margin-left:25%}.mui-col-xl-offset-4{margin-left:33.33333%}.mui-col-xl-offset-5{margin-left:41.66667%}.mui-col-xl-offset-6{margin-left:50%}.mui-col-xl-offset-7{margin-left:58.33333%}.mui-col-xl-offset-8{margin-left:66.66667%}.mui-col-xl-offset-9{margin-left:75%}.mui-col-xl-offset-10{margin-left:83.33333%}.mui-col-xl-offset-11{margin-left:91.66667%}.mui-col-xl-offset-12{margin-left:100%}}.mui-panel{padding:15px;margin-bottom:20px;border-radius:0;background-color:#FFF;box-shadow:0 2px 2px 0 rgba(0,0,0,.16),0 0 2px 0 rgba(0,0,0,.12)}.mui-panel:after,.mui-panel:before{content:" ";display:table}.mui-panel:after{clear:both}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-panel{box-shadow:0 -1px 2px 0 rgba(0,0,0,.12),-1px 0 2px 0 rgba(0,0,0,.12),0 2px 2px 0 rgba(0,0,0,.16),0 0 2px 0 rgba(0,0,0,.12)}}.mui-select{display:block;padding-top:15px;margin-bottom:20px;position:relative}.mui-select:focus{outline:0}.mui-select:focus>select{height:33px;margin-bottom:-1px;border-color:#2196F3;border-width:2px}.mui-select>select{animation-duration:.1ms;animation-name:mui-node-inserted;display:block;height:32px;width:100%;appearance:none;-webkit-appearance:none;-moz-appearance:none;outline:0;border:none;border-bottom:1px solid rgba(0,0,0,.26);border-radius:0;box-shadow:none;background-color:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNiIgd2lkdGg9IjEwIj48cG9seWdvbiBwb2ludHM9IjAsMCAxMCwwIDUsNiIgc3R5bGU9ImZpbGw6cmdiYSgwLDAsMCwuMjQpOyIvPjwvc3ZnPg==);background-repeat:no-repeat;background-position:right center;cursor:pointer;color:rgba(0,0,0,.87);font-size:16px;padding:0 25px 0 0}.mui-select>select::-ms-expand{display:none}.mui-select>select:focus{outline:0;height:33px;margin-bottom:-1px;border-color:#2196F3;border-width:2px}.mui-select>select:disabled{color:rgba(0,0,0,.38);cursor:not-allowed;background-color:transparent;opacity:1}.mui-select>label{position:absolute;top:0;display:block;width:100%;color:rgba(0,0,0,.54);font-size:12px;font-weight:400;line-height:15px;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}.mui-select:focus>label,.mui-select>select:focus~label{color:#2196F3}.mui-select__menu{position:absolute;z-index:2;min-width:100%;overflow-y:auto;padding:8px 0;background-color:#FFF;font-size:16px}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-select__menu{border-left:1px solid rgba(0,0,0,.12);border-top:1px solid rgba(0,0,0,.12)}}.mui-select__menu>div{padding:0 22px;height:42px;line-height:42px;cursor:pointer;white-space:nowrap}.mui-select__menu>div:hover{background-color:#E0E0E0}.mui-select__menu>div.mui--is-selected{background-color:#EEE}th{text-align:left}.mui-table{width:100%;max-width:100%;margin-bottom:20px}.mui-table>tbody>tr>td,.mui-table>tbody>tr>th,.mui-table>tfoot>tr>td,.mui-table>tfoot>tr>th,.mui-table>thead>tr>td,.mui-table>thead>tr>th{padding:10px;line-height:1.429}.mui-table>thead>tr>th{border-bottom:2px solid rgba(0,0,0,.12);font-weight:700}.mui-table>tbody+tbody{border-top:2px solid rgba(0,0,0,.12)}.mui-table.mui-table--bordered>tbody>tr>td{border-bottom:1px solid rgba(0,0,0,.12)}.mui-tabs__bar{list-style:none;padding-left:0;margin-bottom:0;background-color:transparent;white-space:nowrap;overflow-x:auto}.mui-tabs__bar>li{display:inline-block}.mui-tabs__bar>li>a{display:block;white-space:nowrap;text-transform:uppercase;font-weight:500;font-size:14px;color:rgba(0,0,0,.87);cursor:default;height:48px;line-height:48px;padding-left:24px;padding-right:24px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mui-tabs__bar>li>a:hover{text-decoration:none}.mui-tabs__bar>li.mui--is-active{border-bottom:2px solid #2196F3}.mui-tabs__bar>li.mui--is-active>a{color:#2196F3}.mui-tabs__bar.mui-tabs__bar--justified{display:table;width:100%;table-layout:fixed}.mui-tabs__bar.mui-tabs__bar--justified>li{display:table-cell}.mui-tabs__bar.mui-tabs__bar--justified>li>a{text-align:center;padding-left:0;padding-right:0}.mui-tabs__pane{display:none}.mui-tabs__pane.mui--is-active{display:block}[data-mui-toggle=tab]{animation-duration:.1ms;animation-name:mui-node-inserted}.mui-textfield{display:block;padding-top:15px;margin-bottom:20px;position:relative}.mui-textfield>label{position:absolute;top:0;display:block;width:100%;color:rgba(0,0,0,.54);font-size:12px;font-weight:400;line-height:15px;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}.mui-textfield>textarea{padding-top:5px}.mui-textfield>input,.mui-textfield>textarea{display:block}.mui-textfield>input:focus~label,.mui-textfield>textarea:focus~label{color:#2196F3}.mui-textfield--float-label>label{position:absolute;transform:translate(0,15px);font-size:16px;line-height:32px;color:rgba(0,0,0,.26);text-overflow:clip;cursor:text;pointer-events:none}.mui-textfield--float-label>input:focus~label,.mui-textfield--float-label>textarea:focus~label{transform:translate(0,0);font-size:12px;line-height:15px;text-overflow:ellipsis}.mui-textfield--float-label>input:not(:focus).mui--is-not-empty~label,.mui-textfield--float-label>input:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield--float-label>input:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield--float-label>textarea:not(:focus).mui--is-not-empty~label,.mui-textfield--float-label>textarea:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield--float-label>textarea:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label{color:rgba(0,0,0,.54);font-size:12px;line-height:15px;transform:translate(0,0);text-overflow:ellipsis}.mui-textfield--wrap-label{display:table;width:100%;padding-top:0}.mui-textfield--wrap-label:not(.mui-textfield--float-label)>label{display:table-header-group;position:static;white-space:normal;overflow-x:visible}.mui-textfield>input,.mui-textfield>textarea{animation-duration:.1ms;animation-name:mui-node-inserted;display:block;background-color:transparent;color:rgba(0,0,0,.87);border:none;border-bottom:1px solid rgba(0,0,0,.26);outline:0;width:100%;font-size:16px;padding:0;box-shadow:none;border-radius:0;background-image:none}.mui-textfield>input:focus,.mui-textfield>textarea:focus{border-color:#2196F3;border-width:2px}.mui-textfield>input:-moz-read-only,.mui-textfield>input:disabled,.mui-textfield>textarea:-moz-read-only,.mui-textfield>textarea:disabled{cursor:not-allowed;background-color:transparent;opacity:1}.mui-textfield>input:disabled,.mui-textfield>input:read-only,.mui-textfield>textarea:disabled,.mui-textfield>textarea:read-only{cursor:not-allowed;background-color:transparent;opacity:1}.mui-textfield>input::-webkit-input-placeholder,.mui-textfield>textarea::-webkit-input-placeholder{color:rgba(0,0,0,.26);opacity:1}.mui-textfield>input::-moz-placeholder,.mui-textfield>textarea::-moz-placeholder{color:rgba(0,0,0,.26);opacity:1}.mui-textfield>input:-ms-input-placeholder,.mui-textfield>textarea:-ms-input-placeholder{color:rgba(0,0,0,.26);opacity:1}.mui-textfield>input::placeholder,.mui-textfield>textarea::placeholder{color:rgba(0,0,0,.26);opacity:1}.mui-textfield>input{height:32px}.mui-textfield>input:focus{height:33px;margin-bottom:-1px}.mui-textfield>textarea{min-height:64px}.mui-textfield>textarea[rows]:not([rows="2"]):focus{margin-bottom:-1px}.mui-textfield>input:focus{height:33px;margin-bottom:-1px}.mui-textfield>input:invalid:not(:focus):not(:required),.mui-textfield>input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty,.mui-textfield>input:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:not(:required),.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty,.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:invalid:not(:focus):not(:required),.mui-textfield>textarea:invalid:not(:focus):required.mui--is-empty.mui--is-dirty,.mui-textfield>textarea:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:not(:focus).mui--is-invalid:not(:required),.mui-textfield>textarea:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty,.mui-textfield>textarea:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>textarea:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty){border-color:#F44336;border-width:2px}.mui-textfield>input:invalid:not(:focus):not(:required),.mui-textfield>input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty,.mui-textfield>input:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:not(:required),.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty,.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty){height:33px;margin-bottom:-1px}.mui-textfield>input:invalid:not(:focus):not(:required)~label,.mui-textfield>input:invalid:not(:focus):required.mui--is-not-empty~label,.mui-textfield>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>input:not(:focus).mui--is-invalid:not(:required)~label,.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-not-empty~label,.mui-textfield>input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>textarea:invalid:not(:focus):not(:required)~label,.mui-textfield>textarea:invalid:not(:focus):required.mui--is-not-empty~label,.mui-textfield>textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>textarea:not(:focus).mui--is-invalid:not(:required)~label,.mui-textfield>textarea:not(:focus).mui--is-invalid:required.mui--is-not-empty~label,.mui-textfield>textarea:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty)~label,.mui-textfield>textarea:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty)~label{color:#F44336}.mui-textfield:not(.mui-textfield--float-label)>input:invalid:not(:focus):required.mui--is-empty.mui--is-dirty~label,.mui-textfield:not(.mui-textfield--float-label)>input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty~label,.mui-textfield:not(.mui-textfield--float-label)>textarea:invalid:not(:focus):required.mui--is-empty.mui--is-dirty~label,.mui-textfield:not(.mui-textfield--float-label)>textarea:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-dirty~label{color:#F44336}@keyframes mui-node-inserted{from{opacity:.99}to{opacity:1}}.mui--no-transition{transition:none!important}.mui--no-user-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mui-caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.mui--text-left{text-align:left!important}.mui--text-right{text-align:right!important}.mui--text-center{text-align:center!important}.mui--text-justify{text-align:justify!important}.mui--text-nowrap{white-space:nowrap!important}.mui--align-baseline{vertical-align:baseline!important}.mui--align-top{vertical-align:top!important}.mui--align-middle{vertical-align:middle!important}.mui--align-bottom{vertical-align:bottom!important}.mui--text-dark{color:rgba(0,0,0,.87)}.mui--text-dark-secondary{color:rgba(0,0,0,.54)}.mui--text-dark-hint{color:rgba(0,0,0,.38)}.mui--text-light{color:#FFF}.mui--text-light-secondary{color:rgba(255,255,255,.7)}.mui--text-light-hint{color:rgba(255,255,255,.3)}.mui--text-accent{color:rgba(255,64,129,.87)}.mui--text-accent-secondary{color:rgba(255,64,129,.54)}.mui--text-accent-hint{color:rgba(255,64,129,.38)}.mui--text-black{color:#000}.mui--text-white{color:#FFF}.mui--text-danger{color:#F44336}.mui-list--unstyled{padding-left:0;list-style:none}.mui-list--inline{padding-left:0;list-style:none;margin-left:-5px}.mui-list--inline>li{display:inline-block;padding-left:5px;padding-right:5px}.mui--z1,.mui-dropdown__menu,.mui-select__menu{box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}.mui--z2{box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23)}.mui--z3{box-shadow:0 10px 20px rgba(0,0,0,.19),0 6px 6px rgba(0,0,0,.23)}.mui--z4{box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22)}.mui--z5{box-shadow:0 19px 38px rgba(0,0,0,.3),0 15px 12px rgba(0,0,0,.22)}.mui--clearfix:after,.mui--clearfix:before{content:" ";display:table}.mui--clearfix:after{clear:both}.mui--pull-right{float:right!important}.mui--pull-left{float:left!important}.mui--hide{display:none!important}.mui--show{display:block!important}.mui--invisible{visibility:hidden}.mui--overflow-hidden{overflow:hidden!important}.mui--overflow-hidden-x{overflow-x:hidden!important}.mui--overflow-hidden-y{overflow-y:hidden!important}.mui--visible-lg-block,.mui--visible-lg-inline,.mui--visible-lg-inline-block,.mui--visible-md-block,.mui--visible-md-inline,.mui--visible-md-inline-block,.mui--visible-sm-block,.mui--visible-sm-inline,.mui--visible-sm-inline-block,.mui--visible-xl-block,.mui--visible-xl-inline,.mui--visible-xl-inline-block,.mui--visible-xs-block,.mui--visible-xs-inline,.mui--visible-xs-inline-block{display:none!important}@media (max-width:543px){.mui-visible-xs{display:block!important}table.mui-visible-xs{display:table}tr.mui-visible-xs{display:table-row!important}td.mui-visible-xs,th.mui-visible-xs{display:table-cell!important}.mui--visible-xs-block{display:block!important}.mui--visible-xs-inline{display:inline!important}.mui--visible-xs-inline-block{display:inline-block!important}}@media (min-width:544px) and (max-width:767px){.mui-visible-sm{display:block!important}table.mui-visible-sm{display:table}tr.mui-visible-sm{display:table-row!important}td.mui-visible-sm,th.mui-visible-sm{display:table-cell!important}.mui--visible-sm-block{display:block!important}.mui--visible-sm-inline{display:inline!important}.mui--visible-sm-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.mui-visible-md{display:block!important}table.mui-visible-md{display:table}tr.mui-visible-md{display:table-row!important}td.mui-visible-md,th.mui-visible-md{display:table-cell!important}.mui--visible-md-block{display:block!important}.mui--visible-md-inline{display:inline!important}.mui--visible-md-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.mui-visible-lg{display:block!important}table.mui-visible-lg{display:table}tr.mui-visible-lg{display:table-row!important}td.mui-visible-lg,th.mui-visible-lg{display:table-cell!important}.mui--visible-lg-block{display:block!important}.mui--visible-lg-inline{display:inline!important}.mui--visible-lg-inline-block{display:inline-block!important}}@media (min-width:1200px){.mui-visible-xl{display:block!important}table.mui-visible-xl{display:table}tr.mui-visible-xl{display:table-row!important}td.mui-visible-xl,th.mui-visible-xl{display:table-cell!important}.mui--visible-xl-block{display:block!important}.mui--visible-xl-inline{display:inline!important}.mui--visible-xl-inline-block{display:inline-block!important}}@media (max-width:543px){.mui--hidden-xs{display:none!important}}@media (min-width:544px) and (max-width:767px){.mui--hidden-sm{display:none!important}}@media (min-width:768px) and (max-width:991px){.mui--hidden-md{display:none!important}}@media (min-width:992px) and (max-width:1199px){.mui--hidden-lg{display:none!important}}@media (min-width:1200px){.mui--hidden-xl{display:none!important}}body.mui-body--scroll-lock{overflow:hidden!important}#mui-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999999;background-color:rgba(0,0,0,.2);overflow:auto}.mui-ripple-effect{position:absolute;border-radius:50%;pointer-events:none;opacity:.4;transform:scale(1)}.mui-ripple-effect.mui--animate-in{opacity:0;transform:scale(7);transition:transform .3s cubic-bezier(0,0,.2,1),opacity .6s cubic-bezier(0,0,.2,1)}.mui-ripple-effect.mui--active{opacity:.3}.mui-ripple-effect.mui--animate-out{opacity:0;transition:opacity .6s cubic-bezier(0,0,.2,1)}.mui-btn>.mui-ripple-effect{background-color:#a6a6a6}.mui-btn--primary>.mui-ripple-effect{background-color:#FFF}.mui-btn--dark>.mui-ripple-effect{background-color:#FFF}.mui-btn--danger>.mui-ripple-effect{background-color:#FFF}.mui-btn--accent>.mui-ripple-effect{background-color:#FFF}.mui-btn--flat>.mui-ripple-effect{background-color:#a6a6a6}.mui--text-display4{font-weight:300;font-size:112px;line-height:112px}.mui--text-display3{font-weight:400;font-size:56px;line-height:56px}.mui--text-display2{font-weight:400;font-size:45px;line-height:48px}.mui--text-display1,h1{font-weight:400;font-size:34px;line-height:40px}.mui--text-headline,h2{font-weight:400;font-size:24px;line-height:32px}.mui--text-title,h3{font-weight:400;font-size:20px;line-height:28px}.mui--text-subhead,h4{font-weight:400;font-size:16px;line-height:24px}.mui--text-body2,h5{font-weight:500;font-size:14px;line-height:24px}.mui--text-body1{font-weight:400;font-size:14px;line-height:20px}.mui--text-caption{font-weight:400;font-size:12px;line-height:16px}.mui--text-menu{font-weight:500;font-size:13px;line-height:17px}.mui--text-button{font-weight:500;font-size:14px;line-height:18px;text-transform:uppercase}'; },{}],13:[function(e,t,i){t.exports=e(6)},{"../config":3,"./jqLite":5}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return l["default"].createElement("div",babelHelpers["extends"]({},this.props,{className:"mui-appbar "+this.props.className}),this.props.children)}}]),t}(l["default"].Component);n.defaultProps={className:""},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],15:[function(e,t,i){t.exports=e(8)},{"../js/lib/jqLite":5,"../js/lib/util":6,react:"CwoHg3"}],16:[function(e,t,i){t.exports=e(9)},{react:"CwoHg3"}],17:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/util"),r=(babelHelpers.interopRequireWildcard(n),e("./_helpers"),l["default"].PropTypes),a=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.children,e.onChange,babelHelpers.objectWithoutProperties(e,["children","onChange"]));return l["default"].createElement("div",babelHelpers["extends"]({},t,{className:"mui-checkbox "+this.props.className}),l["default"].createElement("label",null,l["default"].createElement("input",{ref:"inputEl",type:"checkbox",name:this.props.name,value:this.props.value,checked:this.props.checked,defaultChecked:this.props.defaultChecked,disabled:this.props.disabled,onChange:this.props.onChange}),this.props.label))}}]),t}(l["default"].Component);a.propTypes={name:r.string,label:r.string,value:r.string,checked:r.bool,defaultChecked:r.bool,disabled:r.bool,onChange:r.func},a.defaultProps={className:"",name:null,label:null,disabled:!1,onChange:null},i["default"]=a,t.exports=i["default"]},{"../js/lib/util":6,"./_helpers":7,react:"CwoHg3"}],18:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/util"),r=babelHelpers.interopRequireWildcard(n),a=["xs","sm","md","lg","xl"],s=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"defaultProps",value:function(){var e={className:""},t=void 0,i=void 0;for(t=a.length-1;t>-1;t--)i=a[t],e[i]=null,e[i+"-offset"]=null;return e}},{key:"render",value:function(){var e={},t=void 0,i=void 0,o=void 0,n=void 0;for(t=a.length-1;t>-1;t--)i=a[t],n="mui-col-"+i,o=this.props[i],o&&(e[n+"-"+o]=!0),o=this.props[i+"-offset"],o&&(e[n+"-offset-"+o]=!0);return e=r.classNames(e),l["default"].createElement("div",babelHelpers["extends"]({},this.props,{className:e+" "+this.props.className}),this.props.children)}}]),t}(l["default"].Component);i["default"]=s,t.exports=i["default"]},{"../js/lib/util":6,react:"CwoHg3"}],19:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e="mui-container";return this.props.fluid&&(e+="-fluid"),l["default"].createElement("div",babelHelpers["extends"]({},this.props,{className:e+" "+this.props.className}),this.props.children)}}]),t}(l["default"].Component);n.propTypes={fluid:l["default"].PropTypes.bool},n.defaultProps={className:"",fluid:!1},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],20:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.children,babelHelpers.objectWithoutProperties(e,["children"]));return l["default"].createElement("div",babelHelpers["extends"]({},t,{className:"mui-divider "+this.props.className}))}}]),t}(l["default"].Component);n.defaultProps={className:""},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],21:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/util"),r=babelHelpers.interopRequireWildcard(n),a=l["default"].PropTypes,s=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return i.onClickCB=r.callback(i,"onClick"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick(this,e)}},{key:"render",value:function(){var e=this.props,t=e.children,i=(e.onClick,babelHelpers.objectWithoutProperties(e,["children","onClick"]));return l["default"].createElement("li",i,l["default"].createElement("a",{href:this.props.link,target:this.props.target,"data-mui-value":this.props.value,onClick:this.onClickCB},t))}}]),t}(l["default"].Component);s.propTypes={link:a.string,target:a.string,onClick:a.func},i["default"]=s,t.exports=i["default"]},{"../js/lib/util":6,react:"CwoHg3"}],22:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("./button"),r=babelHelpers.interopRequireDefault(n),a=e("./caret"),s=babelHelpers.interopRequireDefault(a),u=e("../js/lib/jqLite"),c=babelHelpers.interopRequireWildcard(u),p=e("../js/lib/util"),d=babelHelpers.interopRequireWildcard(p),m=l["default"].PropTypes,b="mui-dropdown",f="mui-dropdown__menu",h="mui--is-open",g="mui-dropdown__menu--right",x=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));i.state={opened:!1,menuTop:0};var o=d.callback;return i.selectCB=o(i,"select"),i.onClickCB=o(i,"onClick"),i.onOutsideClickCB=o(i,"onOutsideClick"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentWillMount",value:function(){document.addEventListener("click",this.onOutsideClickCB)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.onOutsideClickCB)}},{key:"onClick",value:function(e){if(0===e.button&&!this.props.disabled&&!e.defaultPrevented){this.toggle();var t=this.props.onClick;t&&t(e)}}},{key:"toggle",value:function(){return this.props.children?void(this.state.opened?this.close():this.open()):d.raiseError("Dropdown menu element not found")}},{key:"open",value:function(){var e=this.refs.wrapperEl.getBoundingClientRect(),t=void 0;t=this.refs.button.refs.buttonEl.getBoundingClientRect(),this.setState({opened:!0,menuTop:t.top-e.top+t.height})}},{key:"close",value:function(){this.setState({opened:!1})}},{key:"select",value:function(e){this.props.onSelect&&"A"===e.target.tagName&&this.props.onSelect(e.target.getAttribute("data-mui-value")),e.defaultPrevented||this.close()}},{key:"onOutsideClick",value:function(e){var t=this.refs.wrapperEl.contains(e.target);t||this.close()}},{key:"render",value:function(){var e=void 0,t=void 0,i=void 0;if(i="string"===c.type(this.props.label)?l["default"].createElement("span",null,this.props.label," ",l["default"].createElement(s["default"],null)):this.props.label,e=l["default"].createElement(r["default"],{ref:"button",type:"button",onClick:this.onClickCB,color:this.props.color,variant:this.props.variant,size:this.props.size,disabled:this.props.disabled},i),this.state.opened){var o={};o[f]=!0,o[h]=this.state.opened,o[g]="right"===this.props.alignMenu,o=d.classNames(o),t=l["default"].createElement("ul",{ref:"menuEl",className:o,style:{top:this.state.menuTop},onClick:this.selectCB},this.props.children)}var n=this.props,a=n.className,u=(n.children,n.onClick,babelHelpers.objectWithoutProperties(n,["className","children","onClick"]));return l["default"].createElement("div",babelHelpers["extends"]({},u,{ref:"wrapperEl",className:b+" "+a}),e,t)}}]),t}(l["default"].Component);x.propTypes={color:m.oneOf(["default","primary","danger","dark","accent"]),variant:m.oneOf(["default","flat","raised","fab"]),size:m.oneOf(["default","small","large"]),label:m.oneOfType([m.string,m.element]),alignMenu:m.oneOf(["left","right"]),onClick:m.func,onSelect:m.func,disabled:m.bool},x.defaultProps={className:"",color:"default",variant:"default",size:"default",label:"",alignMenu:"left",onClick:null,onSelect:null,disabled:!1},i["default"]=x,t.exports=i["default"]},{"../js/lib/jqLite":5,"../js/lib/util":6,"./button":8,"./caret":9,react:"CwoHg3"}],23:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e="";return this.props.inline&&(e="mui-form--inline"),l["default"].createElement("form",babelHelpers["extends"]({},this.props,{className:e+" "+this.props.className}),this.props.children)}}]),t}(l["default"].Component);n.propTypes={inline:l["default"].PropTypes.bool},n.defaultProps={className:"",inline:!1},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],24:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("./text-field"),r=l["default"].PropTypes,a=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return l["default"].createElement(n.TextField,this.props)}}]),t}(l["default"].Component);a.propTypes={type:r.oneOf(["text","email","url","tel","password"])},a.defaultProps={type:"text"},i["default"]=a,t.exports=i["default"]},{"./text-field":11,react:"CwoHg3"}],25:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/forms"),r=(babelHelpers.interopRequireWildcard(n),e("../js/lib/jqLite")),a=(babelHelpers.interopRequireWildcard(r),e("../js/lib/util")),s=(babelHelpers.interopRequireWildcard(a),l["default"].PropTypes),u=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.children,babelHelpers.objectWithoutProperties(e,["children"]));return l["default"].createElement("option",babelHelpers["extends"]({},t,{value:this.props.value}),this.props.label)}}]),t}(l["default"].Component);u.propTypes={value:s.string,label:s.string},u.defaultProps={value:null,label:null},i["default"]=u,t.exports=i["default"]},{"../js/lib/forms":4,"../js/lib/jqLite":5,"../js/lib/util":6,react:"CwoHg3"}],26:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return l["default"].createElement("div",babelHelpers["extends"]({},this.props,{className:"mui-panel "+this.props.className}),this.props.children)}}]),t}(l["default"].Component);n.defaultProps={className:""},i["default"]=n,t.exports=i["default"]},{react:"CwoHg3"}],27:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=l["default"].PropTypes,r=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=(e.children,e.onChange,babelHelpers.objectWithoutProperties(e,["children","onChange"]));return l["default"].createElement("div",babelHelpers["extends"]({},t,{className:"mui-radio "+this.props.className}),l["default"].createElement("label",null,l["default"].createElement("input",{ref:"inputEl",type:"radio",name:this.props.name,value:this.props.value,checked:this.props.checked,defaultChecked:this.props.defaultChecked,disabled:this.props.disabled,onChange:this.props.onChange}),this.props.label))}}]),t}(l["default"].Component);r.propTypes={name:n.string,label:n.string,value:n.string,checked:n.bool,defaultChecked:n.bool,disabled:n.bool,onChange:n.func},r.defaultProps={className:"",name:null,label:null,disabled:!1,onChange:null},i["default"]=r,t.exports=i["default"]},{react:"CwoHg3"}],28:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/util"),r=(babelHelpers.interopRequireWildcard(n),function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return l["default"].createElement("div",babelHelpers["extends"]({},this.props,{className:"mui-row "+this.props.className}),this.props.children)}}]),t}(l["default"].Component));r.defaultProps={className:""},i["default"]=r,t.exports=i["default"]},{"../js/lib/util":6,react:"CwoHg3"}],29:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("../js/lib/forms"),r=babelHelpers.interopRequireWildcard(n),a=e("../js/lib/jqLite"),s=babelHelpers.interopRequireWildcard(a),u=e("../js/lib/util"),c=babelHelpers.interopRequireWildcard(u),p=e("./_helpers"),d=l["default"].PropTypes,m=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));i.state={showMenu:!1},e.readOnly===!1&&void 0!==e.value&&null===e.onChange&&c.raiseError(p.controlledMessage,!0),i.state.value=e.value;var o=c.callback;return i.hideMenuCB=o(i,"hideMenu"),i.onInnerChangeCB=o(i,"onInnerChange"),i.onInnerClickCB=o(i,"onInnerClick"),i.onInnerFocusCB=o(i,"onInnerFocus"),i.onInnerMouseDownCB=o(i,"onInnerMouseDown"),i.onKeydownCB=o(i,"onKeydown"),i.onMenuChangeCB=o(i,"onMenuChange"),i.onOuterFocusCB=o(i,"onOuterFocus"),i.onOuterBlurCB=o(i,"onOuterBlur"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){this.refs.selectEl._muiSelect=!0,this.refs.wrapperEl.tabIndex=-1,this.props.autoFocus&&this.refs.wrapperEl.focus()}},{key:"componentWillReceiveProps",value:function(e){this.setState({value:e.value})}},{key:"onInnerMouseDown",value:function(e){0===e.button&&this.props.useDefault!==!0&&e.preventDefault()}},{key:"onInnerChange",value:function(e){var t=e.target.value;this.setState({value:t});var i=this.props.onChange;i&&i(t)}},{key:"onInnerClick",value:function(e){0===e.button&&this.showMenu()}},{key:"onInnerFocus",value:function(e){var t=this;this.props.useDefault!==!0&&setTimeout(function(){t.refs.wrapperEl.focus()},0)}},{key:"onOuterFocus",value:function(e){if(e.target===this.refs.wrapperEl){var t=this.refs.selectEl;return t._muiOrigIndex=t.tabIndex,t.tabIndex=-1,t.disabled?this.refs.wrapperEl.blur():void s.on(document,"keydown",this.onKeydownCB)}}},{key:"onOuterBlur",value:function(e){if(e.target===this.refs.wrapperEl){var t=this.refs.selectEl;t.tabIndex=t._muiOrigIndex,s.off(document,"keydown",this.onKeydownCB)}}},{key:"onKeydown",value:function(e){32!==e.keyCode&&38!==e.keyCode&&40!==e.keyCode||(e.preventDefault(),this.refs.selectEl.disabled!==!0&&this.showMenu())}},{key:"showMenu",value:function(){this.props.useDefault!==!0&&(c.enableScrollLock(),s.on(window,"resize",this.hideMenuCB),s.on(document,"click",this.hideMenuCB),this.setState({showMenu:!0}))}},{key:"hideMenu",value:function(){c.disableScrollLock(),s.off(window,"resize",this.hideMenuCB),s.off(document,"click",this.hideMenuCB),this.setState({showMenu:!1}),this.refs.selectEl.focus()}},{key:"onMenuChange",value:function(e){if(this.props.readOnly!==!0){this.setState({value:e});var t=this.props.onChange;t&&t(e)}}},{key:"render",value:function(){var e=void 0;this.state.showMenu&&(e=l["default"].createElement(b,{optionEls:this.refs.selectEl.children,wrapperEl:this.refs.wrapperEl,onChange:this.onMenuChangeCB,onClose:this.hideMenuCB}));var t=this.props,i=(t.children,t.onChange,babelHelpers.objectWithoutProperties(t,["children","onChange"]));return l["default"].createElement("div",babelHelpers["extends"]({},i,{ref:"wrapperEl",className:"mui-select "+this.props.className,onFocus:this.onOuterFocusCB,onBlur:this.onOuterBlurCB}),l["default"].createElement("select",{ref:"selectEl",name:this.props.name,value:this.state.value,defaultValue:this.props.defaultValue,disabled:this.props.disabled,multiple:this.props.multiple,readOnly:this.props.readOnly,required:this.props.required,onChange:this.onInnerChangeCB,onMouseDown:this.onInnerMouseDownCB,onClick:this.onInnerClickCB,onFocus:this.onInnerFocusCB},this.props.children),l["default"].createElement("label",null,this.props.label),e)}}]),t}(l["default"].Component);m.propTypes={label:d.string,name:d.string,value:d.string,defaultValue:d.string,autoFocus:d.bool,disabled:d.bool,multiple:d.bool,readOnly:d.bool,required:d.bool,useDefault:d.bool,onChange:d.func},m.defaultProps={className:"",name:null,autoFocus:!1,disabled:!1,multiple:!1,readOnly:!1,required:!1,useDefault:!1,onChange:null};var b=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return i.state={origIndex:null,currentIndex:null},i.onKeydownCB=c.callback(i,"onKeydown"),i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentWillMount",value:function(){var e=this.props.optionEls,t=e.length,i=0,o=void 0;for(o=t-1;o>-1;o--)e[o].selected&&(i=o);this.setState({origIndex:i,currentIndex:i})}},{key:"componentDidMount",value:function(){this.blurTimer=setTimeout(function(){var e=document.activeElement;"body"!==e.nodeName.toLowerCase()&&e.blur()},0);var e=r.getMenuPositionalCSS(this.props.wrapperEl,this.props.optionEls.length,this.state.currentIndex),t=this.refs.wrapperEl;s.css(t,e),s.scrollTop(t,e.scrollTop),s.on(document,"keydown",this.onKeydownCB)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.blurTimer),s.off(document,"keydown",this.onKeydownCB)}},{key:"onClick",value:function(e,t){t.stopPropagation(),this.selectAndDestroy(e)}},{key:"onKeydown",value:function(e){var t=e.keyCode;return 9===t?this.destroy():(27!==t&&40!==t&&38!==t&&13!==t||e.preventDefault(),void(27===t?this.destroy():40===t?this.increment():38===t?this.decrement():13===t&&this.selectAndDestroy()))}},{key:"increment",value:function(){this.state.currentIndex!==this.props.optionEls.length-1&&this.setState({currentIndex:this.state.currentIndex+1})}},{key:"decrement",value:function(){0!==this.state.currentIndex&&this.setState({currentIndex:this.state.currentIndex-1})}},{key:"selectAndDestroy",value:function(e){e=void 0===e?this.state.currentIndex:e,e!==this.state.origIndex&&this.props.onChange(this.props.optionEls[e].value),this.destroy()}},{key:"destroy",value:function(){this.props.onClose()}},{key:"render",value:function(){var e=[],t=this.props.optionEls,i=t.length,o=void 0,n=void 0;for(n=0;i>n;n++)o=n===this.state.currentIndex?"mui--is-selected":"",e.push(l["default"].createElement("div",{key:n,className:o,onClick:this.onClick.bind(this,n)},t[n].textContent));return l["default"].createElement("div",{ref:"wrapperEl",className:"mui-select__menu"},e)}}]),t}(l["default"].Component);b.defaultProps={optionEls:[],wrapperEl:null,onChange:null,onClose:null},i["default"]=m,t.exports=i["default"]},{"../js/lib/forms":4,"../js/lib/jqLite":5,"../js/lib/util":6,"./_helpers":7,react:"CwoHg3"}],30:[function(e,t,i){t.exports=e(10)},{react:"CwoHg3"}],31:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("./tab"),r=babelHelpers.interopRequireDefault(n),a=e("../js/lib/util"),s=babelHelpers.interopRequireWildcard(a),u=l["default"].PropTypes,c="mui-tabs__bar",p="mui-tabs__bar--justified",d="mui-tabs__pane",m="mui--is-active",b=function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return i.state={currentSelectedIndex:e.initialSelectedIndex},i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"onClick",value:function(e,t,i){e!==this.state.currentSelectedIndex&&(this.setState({currentSelectedIndex:e}),t.props.onActive&&t.props.onActive(t),this.props.onChange&&this.props.onChange(e,t.props.value,t,i))}},{key:"render",value:function(){var e=this.props,t=e.children,i=babelHelpers.objectWithoutProperties(e,["children"]),o=[],n=[],a=t.length,u=this.state.currentSelectedIndex%a,b=void 0,f=void 0,h=void 0,g=void 0;for(g=0;a>g;g++)f=t[g],f.type!==r["default"]&&s.raiseError("Expecting MUITab React Element"),b=g===u,o.push(l["default"].createElement("li",{key:g,className:b?m:""},l["default"].createElement("a",{onClick:this.onClick.bind(this,g,f)},f.props.label))),h=d+" ",b&&(h+=m),n.push(l["default"].createElement("div",{key:g,className:h},f.props.children));return h=c,this.props.justified&&(h+=" "+p),l["default"].createElement("div",i,l["default"].createElement("ul",{className:h},o),n)}}]),t}(l["default"].Component);b.propTypes={initialSelectedIndex:u.number,justified:u.bool,onChange:u.func},b.defaultProps={className:"",initialSelectedIndex:0,justified:!1,onChange:null},i["default"]=b,t.exports=i["default"]},{"../js/lib/util":6,"./tab":10,react:"CwoHg3"}],32:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=window.React,l=babelHelpers.interopRequireDefault(o),n=e("./text-field"),r=l["default"].PropTypes,a=function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){return l["default"].createElement(n.TextField,this.props)}}]),t}(l["default"].Component);a.propTypes={rows:r.number},a.defaultProps={type:"textarea",rows:2},i["default"]=a,t.exports=i["default"]},{"./text-field":11,react:"CwoHg3"}]},{},[2]);
app/src/client/client.js
orYoffe/myFullstackJsNetwork
import 'babel-polyfill' import './sass/index.scss' import faviconUrl from 'file!./img/favicon.ico' import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' import routes from './js/routes' import { Router, browserHistory } from 'react-router' import { syncHistoryWithStore } from 'react-router-redux' import { configureStore } from './store' const initialState = window.__INITIAL_STATE__ const store = configureStore(browserHistory, initialState, true) const history = syncHistoryWithStore(browserHistory, store) // fixing the favicon to get webpack's result file document.getElementById('favicon').href = faviconUrl render( <Provider store={store}> <Router routes={routes} history={history} /> </Provider>, document.getElementById('root') )
src/client/index.js
JulienPradet/quizzALJP
import React from 'react' import ReactDOM from 'react-dom' import { Router, Route, IndexRoute } from 'react-router' import history from './util/history' import App from './container/App' import Landing from './container/Landing' import Manager from './container/manager/Manager' import Viewer from './container/viewer/Viewer' import Player from './container/player/Player' import QuizzCreator from './container/quizz/QuizzCreator' function initWebApp() { ReactDOM.render( <Router history={history}> <Route path="/" component={App}> <IndexRoute component={Landing} /> <Route path="quizz" component={QuizzCreator} /> <Route path="manager" component={Manager} /> <Route path="viewer/:masterId" component={Viewer} /> <Route path="player/:masterId" component={Player} /> </Route> </Router>, document.getElementById('react-container') ) } initWebApp()