/*! jQuery UI - v1.11.4 - 2015-03-11
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=l&&u.down||u,c=function(){o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);
i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);
return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),H=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=H,z=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;H>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(z)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[z]):[!0,""],j=z.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>z||$&&z>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(j&&!v?"&#xa0;":W?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===R.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)
},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;
if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};
f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val(),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision())/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));
return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e("<td>&#160;</td>",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;
this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function(){o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function(){h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function(){e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})});
var SQW=function(){};SQW=stjs.extend(SQW,null,[],function(constructor,prototype){constructor.$=null;constructor.main=function(args){SQW.$=(window)["jQuery"];};},{$:"Object"},{});if(!stjs.mainCallDisabled)
SQW.main();
var SQWUtils=function(){SQW.$.fn.sqw_reverse=[].reverse;;};SQWUtils=stjs.extend(SQWUtils,null,[],function(constructor,prototype){prototype.applet=null;prototype.array=null;prototype.css=null;prototype.is_right_to_left=null;constructor.main=function(args){SQW.utils=new SQWUtils();};prototype.hasApplet=function(){SQW.utils.applet.has();};prototype.moveAppletFix=function(id,top,left){SQW.utils.applet.moveFix(id,top,left);};prototype.applyAppletFix=function($){SQW.utils.applet.applyFix($);};prototype.removeAppletFix=function($){SQW.utils.applet.removeFix($);};prototype.hideAppletFix=function($){SQW.utils.applet.hideFix($);};prototype.FunctionProxy=function(sourceCode){return(Function('with (this){'+'return('+'(function(){'+sourceCode+'})()'+');'+'};'));;};prototype.xssPrevent=function(string){string=(string).replace(new RegExp("[\"\\'][\\s]*javascript:(.*)[\"\\']","g"),"\"\"");string=(string).replace(new RegExp("script(.*)","g"),"");string=(string).replace(new RegExp("eval\\((.*)\\)","g"),"");string=(string).replace(new RegExp("([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])"),"");return string;};prototype.highlight=function(text,highlight,filter_case){try{var regexp=new RegExp("(.*?)("+(filter_case?highlight:highlight.toLowerCase())+")(.*)","gi");text=(text).replace(regexp,"$1<em>$2</em>$3");}catch(ex){}
return text;};prototype.scrollTo=function(parent,target,settings){return new SQWVerticalScroll(parent,target,settings);};prototype.getConstructorName=function(obj){var funcNameRegex=new RegExp("function (.{1,})\\(");var results=funcNameRegex.exec((obj).constructor.toString());return results!=null&&results.length>1?results[1]:"";};prototype.stopDefaultEvent=function(event){if(event!=null&&(typeof(event)["preventDefault"])=="function"){event.preventDefault();}else{window.event.returnValue=false;}
return false;};prototype.disabledEventPropagation=function(event){if((typeof(event)["stopPropagation"])=="function"){event.stopPropagation();}else if((typeof(window)["event"])!="undefined"){window.event.cancelBubble=true;}};prototype.attributes=function(node,with_values){node=SQW.$(node).get(0);var to_ignore=["style","contenteditable","hasfocus","tabindex"];var attributes=this.to_array(node.attributes);if(with_values){return SQW.utils.array.removeByName(attributes,to_ignore);}
for(var attr in attributes){if(!(attributes).hasOwnProperty(attr))
continue;attributes.push((attr).nodeName);}
return attributes;};prototype.to_array=function(iterable){if(iterable==null){return[];}
if((typeof(iterable)["toArray"])=="function"){return(iterable).toArray();}
var length=((iterable).length||0);var results=[];while(--length>0){results[length]=(iterable)[length];}
return results;};prototype.right_to_left=function(){if(this.is_right_to_left==null){this.is_right_to_left=SQW.$("body").css("direction")=="rtl";}
return this.is_right_to_left;};},{applet:"SQWApplet",array:"SQWArray",css:"SQWCSS"},{});if(!stjs.mainCallDisabled)
SQWUtils.main();
var SQWApplet=function(){};SQWApplet=stjs.extend(SQWApplet,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.applet=new SQWApplet();};prototype.has=function(){if(SQW.$("applet").constructor.length>0){return true;}
return false;};prototype.moveFix=function(id,top,left){if(SQW.utils.applet.has()){SQW.$("#"+id).css("top",top).css("left",left);}};prototype.applyFix=function(parentElement){if(SQW.utils.applet.has()){if(parentElement.prop("id")!=null){parentElement.prop("id","appletFix_"+parseInt(Math.random()*1000));}
var id="iframe_"+parentElement.prop("id");if(SQW.$("#"+id).constructor.length==0){var iframe_template="<iframe id=\""+id+"\" src=\"javascript:false;\" frameborder=\"0\" style=\"opacity:0; position: absolute;z-index: 1;\"></iframe>";SQW.$(iframe_template).prependTo("body");}else{SQW.$("#"+id).show();}
SQW.$("#"+id).css("width",parentElement.outerWidth()).css("height",parentElement.outerHeight());SQW.utils.applet.moveFix(id,parentElement.offset().top,parentElement.offset().left);return SQW.$("#"+id);}
return null;};prototype.hideFix=function(parentElement){if(SQW.utils.applet.has()){var id="iframe_"+parentElement.prop("id");SQW.$("#"+id).hide();}};prototype.removeFix=function(parentElement){if(SQW.utils.applet.has()){var id="iframe_"+parentElement.prop("id");SQW.$("#"+id).remove();}};},{},{});if(!stjs.mainCallDisabled)
SQWApplet.main();
var SQWArray=function(){};SQWArray=stjs.extend(SQWArray,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.array=new SQWArray();};prototype.inArray=function(array,p_val){if(SQW.utils.array.search(array,p_val)!=-1){return true;}
return false;};prototype.search=function(array,p_val){var l=array.length;for(var i=0;i<l;i++){if(array[i]==p_val){return i;}}
return-1;};prototype.removeByName=function(array,to_remove){var args=[];if((typeof to_remove)=="string"){args.push(to_remove);}
var L=args.length;var ax;var what;while(L>0&&array.length>0){what=args[--L];while((ax=this.search(array,what))!=-1){array.splice(ax,1);}}
return array;};prototype.remove=function(array,from,to){var rest=array.slice(((to||from)+1||array.length));(array)["length"]=from<0?array.length+from:from;for(var item in rest){if(!(rest).hasOwnProperty(item))
continue;array.push(item);}
return rest;};prototype.unique=function(array){var a=[];var i;var j;var l;for(i=0,l=array.length;i<l;i++){for(j=0;j<=i;j++){if(array[i]==array[j]){break;}}
if(j==i){a.push(array[i]);}}
return a;};prototype.diff=function(A,B){var strA=":"+A.join("::")+":";var strB=":"+B.join(":|:")+":";var reg=new RegExp("("+strB+")","gi");var strDiff=(strA).replace(reg,"");strDiff=(strDiff).replace(new RegExp("^:"),"");strDiff=(strDiff).replace(new RegExp(":$"),"");var arrDiff=[];if(strDiff!=""){arrDiff=(strDiff).split("::");}
return arrDiff;};},{},{});if(!stjs.mainCallDisabled)
SQWArray.main();
var SQWCSS=function(){};SQWCSS=stjs.extend(SQWCSS,null,[],function(constructor,prototype){constructor.main=function(args){SQW.utils.css=new SQWCSS();};prototype.get_css=function(rule_name,delete_flag,sheet){rule_name=rule_name.toLowerCase();var css_rules=(sheet.cssRules||sheet.rules);var j=0;do{if(css_rules.length>0&&j>css_rules.length+5){return false;}
if(css_rules[j].selectorText!=""&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if((typeof(sheet)["removeRule"])=="function"){sheet.removeRule(j);}
if((typeof(sheet)["deleteRule"])=="function"){sheet.deleteRule(j);}
return true;}
return css_rules[j];}}while((typeof css_rules[++j])!="undefined");return false;};prototype.add_css=function(rule_name,sheet){if(SQW.utils.css.get_css(rule_name,false,sheet)){return false;}
if((typeof(typeof(sheet)["insertRule"]))=="function"){sheet.insertRule(rule_name+" { }",0);}else{sheet.addRule(rule_name,null,0);}
return SQW.utils.css.get_css(rule_name,null,null);};prototype.remove_css=function(rule_name,sheet){return SQW.utils.css.get_css(rule_name,true,sheet);};prototype.add_sheet=function(opts){var is_new=true;var tmp=null;if(opts.str!=null){if(opts.title!=null){tmp=SQW.$("style[id='"+opts.title+"-stylesheet']").get(0);}
if(tmp!=null){is_new=false;}else{tmp=document.createElement("style");tmp.setAttribute("type","text/css");if(opts.title!=null){tmp.setAttribute("id",opts.title+"-stylesheet");}}
if(tmp.styleSheet!=null){if(is_new){document.getElementsByTagName("head")[0].appendChild(tmp);tmp.styleSheet.cssText=opts.str;}else{tmp.styleSheet.cssText=tmp.styleSheet.cssText+" "+opts.str;}}else{tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);}
return(tmp.sheet||tmp.styleSheet);}
if(opts.url!=null){tmp=document.createElement("link");tmp.rel="stylesheet";tmp.type="text/css";tmp.media="all";tmp.href=opts.url;document.getElementsByTagName("head")[0].appendChild(tmp);return tmp.styleSheet;}
return null;};constructor.SheetOptions=function(){};constructor.SheetOptions=stjs.extend(constructor.SheetOptions,null,[],function(constructor,prototype){prototype.str=null;prototype.title=null;prototype.url=null;},{},{});},{},{});if(!stjs.mainCallDisabled)
SQWCSS.main();
var SQWVerticalScroll=function(parent,target,settings){var default_settings={"duration":0};settings=SQW.$.extend(default_settings,settings);if(target=="max"){target=9.0E9;}
var elements=(this._scrollable(parent).get());for(var key in elements){if(!(elements).hasOwnProperty(key))
continue;var elem=elements[key];var $elem=SQW.$(elem);var element=false;var top=0;var win=$elem.is("html,body");var type=(typeof target);var typeNumeric=(type=="number"||type=="string")?1:(type=="object")?2:3;switch(typeNumeric){case 1:if(new RegExp("^([+-]=)?\\d+(\\.\\d+)?(px|%)?$").test(target)){top=target;break;}
target=SQW.$(this).find(target);case 2:if((target)["is"]!=null||(target)["style"]!=null){element=true;top=((target=SQW.$(target))).offset().top;}else{}}
var scrollTop=0;if(element){scrollTop=(top+(win?0:elem.scrollTop-$elem.offset().top));if((typeof settings["margin"])!="undefined"){var margin=parseInt(settings["margin"]);if(margin!=NaN){scrollTop-=margin;}}}else{scrollTop=stjs.trunc((((typeof top)=="string"&&(top).substring(-1)=="%")?parseFloat(top)/100*this.maximum(elem):top));}
if(new RegExp("^\\d+$").test(scrollTop)){scrollTop=stjs.trunc((scrollTop<=0?0:Math.min(scrollTop,this.maximum(elem))));}
if(settings["duration"]>0){var scrollAnimation={};scrollAnimation["scrollTop"]=scrollTop;$elem.stop(false,true).animate(scrollAnimation,settings["duration"]);}else{$elem.scrollTop(scrollTop);}}};SQWVerticalScroll=stjs.extend(SQWVerticalScroll,null,[],function(constructor,prototype){prototype._scrollable=function(elements){return elements.map(stjs.bind(this,function(i,THIS){var elem=THIS;var isWin=(!elem.nodeName||SQW.$.inArray(elem.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1);if(!isWin){return elem;}
var doc=((elem.contentWindow||elem).document||elem.ownerDocument||elem);if(SQW.$.browser.safari||doc.compatMode=="BackCompat"){return doc.body;}
return doc.documentElement;},1));};prototype.maximum=function(elem){if(!SQW.$(elem).is("html,body")){return(elem.scrollHeight-SQW.$(elem).height());}
var html=elem.ownerDocument.documentElement;var body=elem.ownerDocument.body;return Math.max(html.scrollHeight,body.scrollHeight)-Math.min(html.clientHeight,body.clientHeight);};},{},{});
if(!Array.prototype.indexOf)
{Array.prototype.indexOf=function(elt)
{var len=this.length>>>0;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)
from+=len;for(;from<len;from++)
{if(from in this&&this[from]===elt)
return from;}
return-1;};}
if(!document.createElement('canvas').getContext){(function(){var m=Math;var mr=m.round;var ms=m.sin;var mc=m.cos;var abs=m.abs;var sqrt=m.sqrt;var Z=10;var Z2=Z/2;var IE_VERSION=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function getContext(){return this.context_||(this.context_=new CanvasRenderingContext2D_(this));}
var slice=Array.prototype.slice;function bind(f,obj,var_args){var a=slice.call(arguments,2);return function(){return f.apply(obj,a.concat(slice.call(arguments)));};}
function encodeHtmlAttribute(s){return String(s).replace(/&/g,'&amp;').replace(/"/g,'&quot;');}
function addNamespace(doc,prefix,urn){if(!doc.namespaces[prefix]){doc.namespaces.add(prefix,urn,'#default#VML');}}
function addNamespacesAndStylesheet(doc){addNamespace(doc,'g_vml_','urn:schemas-microsoft-com:vml');addNamespace(doc,'g_o_','urn:schemas-microsoft-com:office:office');if(!doc.styleSheets['ex_canvas_']){var ss=doc.createStyleSheet();ss.owningElement.id='ex_canvas_';ss.cssText='canvas{display:inline-block;overflow:hidden;'+'text-align:left;width:300px;height:150px}';}}
addNamespacesAndStylesheet(document);var G_vmlCanvasManager_={init:function(opt_doc){var doc=opt_doc||document;doc.createElement('canvas');doc.attachEvent('onreadystatechange',bind(this.init_,this,doc));},init_:function(doc){var els=doc.getElementsByTagName('canvas');for(var i=0;i<els.length;i++){this.initElement(els[i]);}},initElement:function(el){if(!el.getContext){el.getContext=getContext;addNamespacesAndStylesheet(el.ownerDocument);el.innerHTML='';el.attachEvent('onpropertychange',onPropertyChange);el.attachEvent('onresize',onResize);var attrs=el.attributes;if(attrs.width&&attrs.width.specified){el.style.width=attrs.width.nodeValue+'px';}else{el.width=el.clientWidth;}
if(attrs.height&&attrs.height.specified){el.style.height=attrs.height.nodeValue+'px';}else{el.height=el.clientHeight;}}
return el;}};function onPropertyChange(e){var el=e.srcElement;switch(e.propertyName){case'width':el.getContext().clearRect();el.style.width=el.attributes.width.nodeValue+'px';el.firstChild.style.width=el.clientWidth+'px';break;case'height':el.getContext().clearRect();el.style.height=el.attributes.height.nodeValue+'px';el.firstChild.style.height=el.clientHeight+'px';break;}}
function onResize(e){var el=e.srcElement;if(el.firstChild){el.firstChild.style.width=el.clientWidth+'px';el.firstChild.style.height=el.clientHeight+'px';}}
G_vmlCanvasManager_.init();var decToHex=[];for(var i=0;i<16;i++){for(var j=0;j<16;j++){decToHex[i*16+j]=i.toString(16)+j.toString(16);}}
function createMatrixIdentity(){return[[1,0,0],[0,1,0],[0,0,1]];}
function matrixMultiply(m1,m2){var result=createMatrixIdentity();for(var x=0;x<3;x++){for(var y=0;y<3;y++){var sum=0;for(var z=0;z<3;z++){sum+=m1[x][z]*m2[z][y];}
result[x][y]=sum;}}
return result;}
function copyState(o1,o2){o2.fillStyle=o1.fillStyle;o2.lineCap=o1.lineCap;o2.lineJoin=o1.lineJoin;o2.lineWidth=o1.lineWidth;o2.miterLimit=o1.miterLimit;o2.shadowBlur=o1.shadowBlur;o2.shadowColor=o1.shadowColor;o2.shadowOffsetX=o1.shadowOffsetX;o2.shadowOffsetY=o1.shadowOffsetY;o2.strokeStyle=o1.strokeStyle;o2.globalAlpha=o1.globalAlpha;o2.font=o1.font;o2.textAlign=o1.textAlign;o2.textBaseline=o1.textBaseline;o2.arcScaleX_=o1.arcScaleX_;o2.arcScaleY_=o1.arcScaleY_;o2.lineScale_=o1.lineScale_;}
var colorData={aliceblue:'#F0F8FF',antiquewhite:'#FAEBD7',aquamarine:'#7FFFD4',azure:'#F0FFFF',beige:'#F5F5DC',bisque:'#FFE4C4',black:'#000000',blanchedalmond:'#FFEBCD',blueviolet:'#8A2BE2',brown:'#A52A2A',burlywood:'#DEB887',cadetblue:'#5F9EA0',chartreuse:'#7FFF00',chocolate:'#D2691E',coral:'#FF7F50',cornflowerblue:'#6495ED',cornsilk:'#FFF8DC',crimson:'#DC143C',cyan:'#00FFFF',darkblue:'#00008B',darkcyan:'#008B8B',darkgoldenrod:'#B8860B',darkgray:'#A9A9A9',darkgreen:'#006400',darkgrey:'#A9A9A9',darkkhaki:'#BDB76B',darkmagenta:'#8B008B',darkolivegreen:'#556B2F',darkorange:'#FF8C00',darkorchid:'#9932CC',darkred:'#8B0000',darksalmon:'#E9967A',darkseagreen:'#8FBC8F',darkslateblue:'#483D8B',darkslategray:'#2F4F4F',darkslategrey:'#2F4F4F',darkturquoise:'#00CED1',darkviolet:'#9400D3',deeppink:'#FF1493',deepskyblue:'#00BFFF',dimgray:'#696969',dimgrey:'#696969',dodgerblue:'#1E90FF',firebrick:'#B22222',floralwhite:'#FFFAF0',forestgreen:'#228B22',gainsboro:'#DCDCDC',ghostwhite:'#F8F8FF',gold:'#FFD700',goldenrod:'#DAA520',grey:'#808080',greenyellow:'#ADFF2F',honeydew:'#F0FFF0',hotpink:'#FF69B4',indianred:'#CD5C5C',indigo:'#4B0082',ivory:'#FFFFF0',khaki:'#F0E68C',lavender:'#E6E6FA',lavenderblush:'#FFF0F5',lawngreen:'#7CFC00',lemonchiffon:'#FFFACD',lightblue:'#ADD8E6',lightcoral:'#F08080',lightcyan:'#E0FFFF',lightgoldenrodyellow:'#FAFAD2',lightgreen:'#90EE90',lightgrey:'#D3D3D3',lightpink:'#FFB6C1',lightsalmon:'#FFA07A',lightseagreen:'#20B2AA',lightskyblue:'#87CEFA',lightslategray:'#778899',lightslategrey:'#778899',lightsteelblue:'#B0C4DE',lightyellow:'#FFFFE0',limegreen:'#32CD32',linen:'#FAF0E6',magenta:'#FF00FF',mediumaquamarine:'#66CDAA',mediumblue:'#0000CD',mediumorchid:'#BA55D3',mediumpurple:'#9370DB',mediumseagreen:'#3CB371',mediumslateblue:'#7B68EE',mediumspringgreen:'#00FA9A',mediumturquoise:'#48D1CC',mediumvioletred:'#C71585',midnightblue:'#191970',mintcream:'#F5FFFA',mistyrose:'#FFE4E1',moccasin:'#FFE4B5',navajowhite:'#FFDEAD',oldlace:'#FDF5E6',olivedrab:'#6B8E23',orange:'#FFA500',orangered:'#FF4500',orchid:'#DA70D6',palegoldenrod:'#EEE8AA',palegreen:'#98FB98',paleturquoise:'#AFEEEE',palevioletred:'#DB7093',papayawhip:'#FFEFD5',peachpuff:'#FFDAB9',peru:'#CD853F',pink:'#FFC0CB',plum:'#DDA0DD',powderblue:'#B0E0E6',rosybrown:'#BC8F8F',royalblue:'#4169E1',saddlebrown:'#8B4513',salmon:'#FA8072',sandybrown:'#F4A460',seagreen:'#2E8B57',seashell:'#FFF5EE',sienna:'#A0522D',skyblue:'#87CEEB',slateblue:'#6A5ACD',slategray:'#708090',slategrey:'#708090',snow:'#FFFAFA',springgreen:'#00FF7F',steelblue:'#4682B4',tan:'#D2B48C',thistle:'#D8BFD8',tomato:'#FF6347',turquoise:'#40E0D0',violet:'#EE82EE',wheat:'#F5DEB3',whitesmoke:'#F5F5F5',yellowgreen:'#9ACD32'};function getRgbHslContent(styleString){var start=styleString.indexOf('(',3);var end=styleString.indexOf(')',start+1);var parts=styleString.substring(start+1,end).split(',');if(parts.length!=4||styleString.charAt(3)!='a'){parts[3]=1;}
return parts;}
function percent(s){return parseFloat(s)/100;}
function clamp(v,min,max){return Math.min(max,Math.max(min,v));}
function hslToRgb(parts){var r,g,b,h,s,l;h=parseFloat(parts[0])/360%360;if(h<0)
h++;s=clamp(percent(parts[1]),0,1);l=clamp(percent(parts[2]),0,1);if(s==0){r=g=b=l;}else{var q=l<0.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hueToRgb(p,q,h+1/3);g=hueToRgb(p,q,h);b=hueToRgb(p,q,h-1/3);}
return'#'+decToHex[Math.floor(r*255)]+
decToHex[Math.floor(g*255)]+
decToHex[Math.floor(b*255)];}
function hueToRgb(m1,m2,h){if(h<0)
h++;if(h>1)
h--;if(6*h<1)
return m1+(m2-m1)*6*h;else if(2*h<1)
return m2;else if(3*h<2)
return m1+(m2-m1)*(2/3-h)*6;else
return m1;}
var processStyleCache={};function processStyle(styleString){if(styleString in processStyleCache){return processStyleCache[styleString];}
var str,alpha=1;styleString=String(styleString);if(styleString.charAt(0)=='#'){str=styleString;}else if(/^rgb/.test(styleString)){var parts=getRgbHslContent(styleString);var str='#',n;for(var i=0;i<3;i++){if(parts[i].indexOf('%')!=-1){n=Math.floor(percent(parts[i])*255);}else{n=+parts[i];}
str+=decToHex[clamp(n,0,255)];}
alpha=+parts[3];}else if(/^hsl/.test(styleString)){var parts=getRgbHslContent(styleString);str=hslToRgb(parts);alpha=parts[3];}else{str=colorData[styleString]||styleString;}
return processStyleCache[styleString]={color:str,alpha:alpha};}
var DEFAULT_STYLE={style:'normal',variant:'normal',weight:'normal',size:10,family:'sans-serif'};var fontStyleCache={};function processFontStyle(styleString){if(fontStyleCache[styleString]){return fontStyleCache[styleString];}
var el=document.createElement('div');var style=el.style;try{style.font=styleString;}catch(ex){}
return fontStyleCache[styleString]={style:style.fontStyle||DEFAULT_STYLE.style,variant:style.fontVariant||DEFAULT_STYLE.variant,weight:style.fontWeight||DEFAULT_STYLE.weight,size:style.fontSize||DEFAULT_STYLE.size,family:style.fontFamily||DEFAULT_STYLE.family};}
function getComputedStyle(style,element){var computedStyle={};for(var p in style){computedStyle[p]=style[p];}
var canvasFontSize=parseFloat(element.currentStyle.fontSize),fontSize=parseFloat(style.size);if(typeof style.size=='number'){computedStyle.size=style.size;}else if(style.size.indexOf('px')!=-1){computedStyle.size=fontSize;}else if(style.size.indexOf('em')!=-1){computedStyle.size=canvasFontSize*fontSize;}else if(style.size.indexOf('%')!=-1){computedStyle.size=(canvasFontSize/100)*fontSize;}else if(style.size.indexOf('pt')!=-1){computedStyle.size=fontSize/.75;}else{computedStyle.size=canvasFontSize;}
computedStyle.size*=0.981;return computedStyle;}
function buildStyle(style){return style.style+' '+style.variant+' '+style.weight+' '+
style.size+'px '+style.family;}
var lineCapMap={'butt':'flat','round':'round'};function processLineCap(lineCap){return lineCapMap[lineCap]||'square';}
function CanvasRenderingContext2D_(canvasElement){this.m_=createMatrixIdentity();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle='#000';this.fillStyle='#000';this.lineWidth=1;this.lineJoin='miter';this.lineCap='butt';this.miterLimit=Z*1;this.globalAlpha=1;this.font='10px sans-serif';this.textAlign='left';this.textBaseline='alphabetic';this.canvas=canvasElement;var cssText='width:'+canvasElement.clientWidth+'px;height:'+
canvasElement.clientHeight+'px;overflow:hidden;position:absolute';var el=canvasElement.ownerDocument.createElement('div');el.style.cssText=cssText;canvasElement.appendChild(el);var overlayEl=el.cloneNode(false);overlayEl.style.backgroundColor='red';overlayEl.style.filter='alpha(opacity=0)';canvasElement.appendChild(overlayEl);this.element_=el;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1;}
var contextPrototype=CanvasRenderingContext2D_.prototype;contextPrototype.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null;}
this.element_.innerHTML='';};contextPrototype.beginPath=function(){this.currentPath_=[];};contextPrototype.moveTo=function(aX,aY){var p=getCoords(this,aX,aY);this.currentPath_.push({type:'moveTo',x:p.x,y:p.y});this.currentX_=p.x;this.currentY_=p.y;};contextPrototype.lineTo=function(aX,aY){var p=getCoords(this,aX,aY);this.currentPath_.push({type:'lineTo',x:p.x,y:p.y});this.currentX_=p.x;this.currentY_=p.y;};contextPrototype.bezierCurveTo=function(aCP1x,aCP1y,aCP2x,aCP2y,aX,aY){var p=getCoords(this,aX,aY);var cp1=getCoords(this,aCP1x,aCP1y);var cp2=getCoords(this,aCP2x,aCP2y);bezierCurveTo(this,cp1,cp2,p);};function bezierCurveTo(self,cp1,cp2,p){self.currentPath_.push({type:'bezierCurveTo',cp1x:cp1.x,cp1y:cp1.y,cp2x:cp2.x,cp2y:cp2.y,x:p.x,y:p.y});self.currentX_=p.x;self.currentY_=p.y;}
contextPrototype.quadraticCurveTo=function(aCPx,aCPy,aX,aY){var cp=getCoords(this,aCPx,aCPy);var p=getCoords(this,aX,aY);var cp1={x:this.currentX_+2.0/3.0*(cp.x-this.currentX_),y:this.currentY_+2.0/3.0*(cp.y-this.currentY_)};var cp2={x:cp1.x+(p.x-this.currentX_)/3.0,y:cp1.y+(p.y-this.currentY_)/3.0};bezierCurveTo(this,cp1,cp2,p);};contextPrototype.arc=function(aX,aY,aRadius,aStartAngle,aEndAngle,aClockwise){aRadius*=Z;var arcType=aClockwise?'at':'wa';var xStart=aX+mc(aStartAngle)*aRadius-Z2;var yStart=aY+ms(aStartAngle)*aRadius-Z2;var xEnd=aX+mc(aEndAngle)*aRadius-Z2;var yEnd=aY+ms(aEndAngle)*aRadius-Z2;if(xStart==xEnd&&!aClockwise){xStart+=0.125;}
var p=getCoords(this,aX,aY);var pStart=getCoords(this,xStart,yStart);var pEnd=getCoords(this,xEnd,yEnd);this.currentPath_.push({type:arcType,x:p.x,y:p.y,radius:aRadius,xStart:pStart.x,yStart:pStart.y,xEnd:pEnd.x,yEnd:pEnd.y});};contextPrototype.rect=function(aX,aY,aWidth,aHeight){this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();};contextPrototype.strokeRect=function(aX,aY,aWidth,aHeight){var oldPath=this.currentPath_;this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.stroke();this.currentPath_=oldPath;};contextPrototype.fillRect=function(aX,aY,aWidth,aHeight){var oldPath=this.currentPath_;this.beginPath();this.moveTo(aX,aY);this.lineTo(aX+aWidth,aY);this.lineTo(aX+aWidth,aY+aHeight);this.lineTo(aX,aY+aHeight);this.closePath();this.fill();this.currentPath_=oldPath;};contextPrototype.createLinearGradient=function(aX0,aY0,aX1,aY1){var gradient=new CanvasGradient_('gradient');gradient.x0_=aX0;gradient.y0_=aY0;gradient.x1_=aX1;gradient.y1_=aY1;return gradient;};contextPrototype.createRadialGradient=function(aX0,aY0,aR0,aX1,aY1,aR1){var gradient=new CanvasGradient_('gradientradial');gradient.x0_=aX0;gradient.y0_=aY0;gradient.r0_=aR0;gradient.x1_=aX1;gradient.y1_=aY1;gradient.r1_=aR1;return gradient;};contextPrototype.drawImage=function(image,var_args){var dx,dy,dw,dh,sx,sy,sw,sh;var oldRuntimeWidth=image.runtimeStyle.width;var oldRuntimeHeight=image.runtimeStyle.height;image.runtimeStyle.width='auto';image.runtimeStyle.height='auto';var w=image.width;var h=image.height;image.runtimeStyle.width=oldRuntimeWidth;image.runtimeStyle.height=oldRuntimeHeight;if(arguments.length==3){dx=arguments[1];dy=arguments[2];sx=sy=0;sw=dw=w;sh=dh=h;}else if(arguments.length==5){dx=arguments[1];dy=arguments[2];dw=arguments[3];dh=arguments[4];sx=sy=0;sw=w;sh=h;}else if(arguments.length==9){sx=arguments[1];sy=arguments[2];sw=arguments[3];sh=arguments[4];dx=arguments[5];dy=arguments[6];dw=arguments[7];dh=arguments[8];}else{throw Error('Invalid number of arguments');}
var d=getCoords(this,dx,dy);var w2=sw/2;var h2=sh/2;var vmlStr=[];var W=10;var H=10;vmlStr.push(' <g_vml_:group',' coordsize="',Z*W,',',Z*H,'"',' coordorigin="0,0"',' style="width:',W,'px;height:',H,'px;position:absolute;');if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var filter=[];filter.push('M11=',this.m_[0][0],',','M12=',this.m_[1][0],',','M21=',this.m_[0][1],',','M22=',this.m_[1][1],',','Dx=',mr(d.x/Z),',','Dy=',mr(d.y/Z),'');var max=d;var c2=getCoords(this,dx+dw,dy);var c3=getCoords(this,dx,dy+dh);var c4=getCoords(this,dx+dw,dy+dh);max.x=m.max(max.x,c2.x,c3.x,c4.x);max.y=m.max(max.y,c2.y,c3.y,c4.y);vmlStr.push('padding:0 ',mr(max.x/Z),'px ',mr(max.y/Z),'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',filter.join(''),", sizingmethod='clip');");}else{vmlStr.push('top:',mr(d.y/Z),'px;left:',mr(d.x/Z),'px;');}
vmlStr.push(' ">','<g_vml_:image src="',image.src,'"',' style="width:',Z*dw,'px;',' height:',Z*dh,'px"',' cropleft="',sx/w,'"',' croptop="',sy/h,'"',' cropright="',(w-sx-sw)/w,'"',' cropbottom="',(h-sy-sh)/h,'"',' />','</g_vml_:group>');this.element_.insertAdjacentHTML('BeforeEnd',vmlStr.join(''));};contextPrototype.stroke=function(aFill){var lineStr=[];var lineOpen=false;var W=10;var H=10;lineStr.push('<g_vml_:shape',' filled="',!!aFill,'"',' style="position:absolute;width:',W,'px;height:',H,'px;"',' coordorigin="0,0"',' coordsize="',Z*W,',',Z*H,'"',' stroked="',!aFill,'"',' path="');var newSeq=false;var min={x:null,y:null};var max={x:null,y:null};for(var i=0;i<this.currentPath_.length;i++){var p=this.currentPath_[i];var c;switch(p.type){case'moveTo':c=p;lineStr.push(' m ',mr(p.x),',',mr(p.y));break;case'lineTo':lineStr.push(' l ',mr(p.x),',',mr(p.y));break;case'close':lineStr.push(' x ');p=null;break;case'bezierCurveTo':lineStr.push(' c ',mr(p.cp1x),',',mr(p.cp1y),',',mr(p.cp2x),',',mr(p.cp2y),',',mr(p.x),',',mr(p.y));break;case'at':case'wa':lineStr.push(' ',p.type,' ',mr(p.x-this.arcScaleX_*p.radius),',',mr(p.y-this.arcScaleY_*p.radius),' ',mr(p.x+this.arcScaleX_*p.radius),',',mr(p.y+this.arcScaleY_*p.radius),' ',mr(p.xStart),',',mr(p.yStart),' ',mr(p.xEnd),',',mr(p.yEnd));break;}
if(p){if(min.x==null||p.x<min.x){min.x=p.x;}
if(max.x==null||p.x>max.x){max.x=p.x;}
if(min.y==null||p.y<min.y){min.y=p.y;}
if(max.y==null||p.y>max.y){max.y=p.y;}}}
lineStr.push(' ">');if(!aFill){appendStroke(this,lineStr);}else{appendFill(this,lineStr,min,max);}
lineStr.push('</g_vml_:shape>');this.element_.insertAdjacentHTML('beforeEnd',lineStr.join(''));};function appendStroke(ctx,lineStr){var a=processStyle(ctx.strokeStyle);var color=a.color;var opacity=a.alpha*ctx.globalAlpha;var lineWidth=ctx.lineScale_*ctx.lineWidth;if(lineWidth<1){opacity*=lineWidth;}
lineStr.push('<g_vml_:stroke',' opacity="',opacity,'"',' joinstyle="',ctx.lineJoin,'"',' miterlimit="',ctx.miterLimit,'"',' endcap="',processLineCap(ctx.lineCap),'"',' weight="',lineWidth,'px"',' color="',color,'" />');}
function appendFill(ctx,lineStr,min,max){var fillStyle=ctx.fillStyle;var arcScaleX=ctx.arcScaleX_;var arcScaleY=ctx.arcScaleY_;var width=max.x-min.x;var height=max.y-min.y;if(fillStyle instanceof CanvasGradient_){var angle=0;var focus={x:0,y:0};var shift=0;var expansion=1;if(fillStyle.type_=='gradient'){var x0=fillStyle.x0_/arcScaleX;var y0=fillStyle.y0_/arcScaleY;var x1=fillStyle.x1_/arcScaleX;var y1=fillStyle.y1_/arcScaleY;var p0=getCoords(ctx,x0,y0);var p1=getCoords(ctx,x1,y1);var dx=p1.x-p0.x;var dy=p1.y-p0.y;angle=Math.atan2(dx,dy)*180/Math.PI;if(angle<0){angle+=360;}
if(angle<1e-6){angle=0;}}else{var p0=getCoords(ctx,fillStyle.x0_,fillStyle.y0_);focus={x:(p0.x-min.x)/width,y:(p0.y-min.y)/height};width/=arcScaleX*Z;height/=arcScaleY*Z;var dimension=m.max(width,height);shift=2*fillStyle.r0_/dimension;expansion=2*fillStyle.r1_/dimension-shift;}
var stops=fillStyle.colors_;stops.sort(function(cs1,cs2){return cs1.offset-cs2.offset;});var length=stops.length;var color1=stops[0].color;var color2=stops[length-1].color;var opacity1=stops[0].alpha*ctx.globalAlpha;var opacity2=stops[length-1].alpha*ctx.globalAlpha;var colors=[];for(var i=0;i<length;i++){var stop=stops[i];colors.push(stop.offset*expansion+shift+' '+stop.color);}
lineStr.push('<g_vml_:fill type="',fillStyle.type_,'"',' method="none" focus="100%"',' color="',color1,'"',' color2="',color2,'"',' colors="',colors.join(','),'"',' opacity="',opacity2,'"',' g_o_:opacity2="',opacity1,'"',' angle="',angle,'"',' focusposition="',focus.x,',',focus.y,'" />');}else if(fillStyle instanceof CanvasPattern_){if(width&&height){var deltaLeft=-min.x;var deltaTop=-min.y;lineStr.push('<g_vml_:fill',' position="',deltaLeft/width*arcScaleX*arcScaleX,',',deltaTop/height*arcScaleY*arcScaleY,'"',' type="tile"',' src="',fillStyle.src_,'" />');}}else{var a=processStyle(ctx.fillStyle);var color=a.color;var opacity=a.alpha*ctx.globalAlpha;lineStr.push('<g_vml_:fill color="',color,'" opacity="',opacity,'" />');}}
contextPrototype.fill=function(){this.stroke(true);};contextPrototype.closePath=function(){this.currentPath_.push({type:'close'});};function getCoords(ctx,aX,aY){var m=ctx.m_;return{x:Z*(aX*m[0][0]+aY*m[1][0]+m[2][0])-Z2,y:Z*(aX*m[0][1]+aY*m[1][1]+m[2][1])-Z2};};contextPrototype.save=function(){var o={};copyState(this,o);this.aStack_.push(o);this.mStack_.push(this.m_);this.m_=matrixMultiply(createMatrixIdentity(),this.m_);};contextPrototype.restore=function(){if(this.aStack_.length){copyState(this.aStack_.pop(),this);this.m_=this.mStack_.pop();}};function matrixIsFinite(m){return isFinite(m[0][0])&&isFinite(m[0][1])&&isFinite(m[1][0])&&isFinite(m[1][1])&&isFinite(m[2][0])&&isFinite(m[2][1]);}
function setM(ctx,m,updateLineScale){if(!matrixIsFinite(m)){return;}
ctx.m_=m;if(updateLineScale){var det=m[0][0]*m[1][1]-m[0][1]*m[1][0];ctx.lineScale_=sqrt(abs(det));}}
contextPrototype.translate=function(aX,aY){var m1=[[1,0,0],[0,1,0],[aX,aY,1]];setM(this,matrixMultiply(m1,this.m_),false);};contextPrototype.rotate=function(aRot){var c=mc(aRot);var s=ms(aRot);var m1=[[c,s,0],[-s,c,0],[0,0,1]];setM(this,matrixMultiply(m1,this.m_),false);};contextPrototype.scale=function(aX,aY){this.arcScaleX_*=aX;this.arcScaleY_*=aY;var m1=[[aX,0,0],[0,aY,0],[0,0,1]];setM(this,matrixMultiply(m1,this.m_),true);};contextPrototype.transform=function(m11,m12,m21,m22,dx,dy){var m1=[[m11,m12,0],[m21,m22,0],[dx,dy,1]];setM(this,matrixMultiply(m1,this.m_),true);};contextPrototype.setTransform=function(m11,m12,m21,m22,dx,dy){var m=[[m11,m12,0],[m21,m22,0],[dx,dy,1]];setM(this,m,true);};contextPrototype.drawText_=function(text,x,y,maxWidth,stroke){var m=this.m_,delta=1000,left=0,right=delta,offset={x:0,y:0},lineStr=[];var fontStyle=getComputedStyle(processFontStyle(this.font),this.element_);var fontStyleString=buildStyle(fontStyle);var elementStyle=this.element_.currentStyle;var textAlign=this.textAlign.toLowerCase();switch(textAlign){case'left':case'center':case'right':break;case'end':textAlign=elementStyle.direction=='ltr'?'right':'left';break;case'start':textAlign=elementStyle.direction=='rtl'?'right':'left';break;default:textAlign='left';}
switch(this.textBaseline){case'hanging':case'top':offset.y=fontStyle.size/1.75;break;case'middle':break;default:case null:case'alphabetic':case'ideographic':case'bottom':offset.y=-fontStyle.size/2.25;break;}
switch(textAlign){case'right':left=delta;right=0.05;break;case'center':left=right=delta/2;break;}
var d=getCoords(this,x+offset.x,y+offset.y);lineStr.push('<g_vml_:line from="',-left,' 0" to="',right,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!stroke,'" stroked="',!!stroke,'" style="position:absolute;width:1px;height:1px;">');if(stroke){appendStroke(this,lineStr);}else{appendFill(this,lineStr,{x:-left,y:0},{x:right,y:fontStyle.size});}
var skewM=m[0][0].toFixed(3)+','+m[1][0].toFixed(3)+','+
m[0][1].toFixed(3)+','+m[1][1].toFixed(3)+',0,0';var skewOffset=mr(d.x/Z)+','+mr(d.y/Z);lineStr.push('<g_vml_:skew on="t" matrix="',skewM,'" ',' offset="',skewOffset,'" origin="',left,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',encodeHtmlAttribute(text),'" style="v-text-align:',textAlign,';font:',encodeHtmlAttribute(fontStyleString),'" /></g_vml_:line>');this.element_.insertAdjacentHTML('beforeEnd',lineStr.join(''));};contextPrototype.fillText=function(text,x,y,maxWidth){this.drawText_(text,x,y,maxWidth,false);};contextPrototype.strokeText=function(text,x,y,maxWidth){this.drawText_(text,x,y,maxWidth,true);};contextPrototype.measureText=function(text){if(!this.textMeasureEl_){var s='<span style="position:absolute;'+'top:-20000px;left:0;padding:0;margin:0;border:none;'+'white-space:pre;"></span>';this.element_.insertAdjacentHTML('beforeEnd',s);this.textMeasureEl_=this.element_.lastChild;}
var doc=this.element_.ownerDocument;this.textMeasureEl_.innerHTML='';this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(doc.createTextNode(text));return{width:this.textMeasureEl_.offsetWidth};};contextPrototype.clip=function(){};contextPrototype.arcTo=function(){};contextPrototype.createPattern=function(image,repetition){return new CanvasPattern_(image,repetition);};function CanvasGradient_(aType){this.type_=aType;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[];}
CanvasGradient_.prototype.addColorStop=function(aOffset,aColor){aColor=processStyle(aColor);this.colors_.push({offset:aOffset,color:aColor.color,alpha:aColor.alpha});};function CanvasPattern_(image,repetition){assertImageIsValid(image);switch(repetition){case'repeat':case null:case'':this.repetition_='repeat';break
case'repeat-x':case'repeat-y':case'no-repeat':this.repetition_=repetition;break;default:throwException('SYNTAX_ERR');}
this.src_=image.src;this.width_=image.width;this.height_=image.height;}
function throwException(s){throw new DOMException_(s);}
function assertImageIsValid(img){if(!img||img.nodeType!=1||img.tagName!='IMG'){throwException('TYPE_MISMATCH_ERR');}
if(img.readyState!='complete'){throwException('INVALID_STATE_ERR');}}
function DOMException_(s){this.code=this[s];this.message=s+': DOM Exception '+this.code;}
var p=DOMException_.prototype=new Error;p.INDEX_SIZE_ERR=1;p.DOMSTRING_SIZE_ERR=2;p.HIERARCHY_REQUEST_ERR=3;p.WRONG_DOCUMENT_ERR=4;p.INVALID_CHARACTER_ERR=5;p.NO_DATA_ALLOWED_ERR=6;p.NO_MODIFICATION_ALLOWED_ERR=7;p.NOT_FOUND_ERR=8;p.NOT_SUPPORTED_ERR=9;p.INUSE_ATTRIBUTE_ERR=10;p.INVALID_STATE_ERR=11;p.SYNTAX_ERR=12;p.INVALID_MODIFICATION_ERR=13;p.NAMESPACE_ERR=14;p.INVALID_ACCESS_ERR=15;p.VALIDATION_ERR=16;p.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=G_vmlCanvasManager_;CanvasRenderingContext2D=CanvasRenderingContext2D_;CanvasGradient=CanvasGradient_;CanvasPattern=CanvasPattern_;DOMException=DOMException_;})();};
$(document).ready(function(){ie_version=(function(){var undef,v=3,div=document.createElement('div'),all=div.getElementsByTagName('i');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',all[0]);if(v==8){var vbScriptTag=document.createElement("script");vbScriptTag.text="Function BinaryToString(Binary)\nDim I,S\nFor I = 1 to LenB(Binary)\nS = S & ChrW(AscB(MidB(Binary,I,1)))\nNext\nBinaryToString = S\nEnd Function";vbScriptTag.setAttribute("language","VBScript");document.body.appendChild(vbScriptTag);}
return v>4?v:undef;}());});
(function(global){'use strict';var undefined=(void 0);var MAX_ARRAY_LENGTH=1e5;function Type(v){switch(typeof v){case'undefined':return'undefined';case'boolean':return'boolean';case'number':return'number';case'string':return'string';default:return v===null?'null':'object';}}
function Class(v){return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g,'');}
function IsCallable(o){return typeof o==='function';}
function ToObject(v){if(v===null||v===undefined)throw TypeError();return Object(v);}
function ToInt32(v){return v>>0;}
function ToUint32(v){return v>>>0;}
var LN2=Math.LN2,abs=Math.abs,floor=Math.floor,log=Math.log,max=Math.max,min=Math.min,pow=Math.pow,round=Math.round;(function(){var orig=Object.defineProperty;var dom_only=!(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}());if(!orig||dom_only){Object.defineProperty=function(o,prop,desc){if(orig)
try{return orig(o,prop,desc);}catch(_){}
if(o!==Object(o))
throw TypeError('Object.defineProperty called on non-object');if(Object.prototype.__defineGetter__&&('get'in desc))
Object.prototype.__defineGetter__.call(o,prop,desc.get);if(Object.prototype.__defineSetter__&&('set'in desc))
Object.prototype.__defineSetter__.call(o,prop,desc.set);if('value'in desc)
o[prop]=desc.value;return o;};}}());function makeArrayAccessors(obj){if(obj.length>MAX_ARRAY_LENGTH)throw RangeError('Array too large for polyfill');function makeArrayAccessor(index){Object.defineProperty(obj,index,{'get':function(){return obj._getter(index);},'set':function(v){obj._setter(index,v);},enumerable:true,configurable:false});}
var i;for(i=0;i<obj.length;i+=1){makeArrayAccessor(i);}}
function as_signed(value,bits){var s=32-bits;return(value<<s)>>s;}
function as_unsigned(value,bits){var s=32-bits;return(value<<s)>>>s;}
function packI8(n){return[n&0xff];}
function unpackI8(bytes){return as_signed(bytes[0],8);}
function packU8(n){return[n&0xff];}
function unpackU8(bytes){return as_unsigned(bytes[0],8);}
function packU8Clamped(n){n=round(Number(n));return[n<0?0:n>0xff?0xff:n&0xff];}
function packI16(n){return[(n>>8)&0xff,n&0xff];}
function unpackI16(bytes){return as_signed(bytes[0]<<8|bytes[1],16);}
function packU16(n){return[(n>>8)&0xff,n&0xff];}
function unpackU16(bytes){return as_unsigned(bytes[0]<<8|bytes[1],16);}
function packI32(n){return[(n>>24)&0xff,(n>>16)&0xff,(n>>8)&0xff,n&0xff];}
function unpackI32(bytes){return as_signed(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32);}
function packU32(n){return[(n>>24)&0xff,(n>>16)&0xff,(n>>8)&0xff,n&0xff];}
function unpackU32(bytes){return as_unsigned(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32);}
function packIEEE754(v,ebits,fbits){var bias=(1<<(ebits-1))-1,s,e,f,ln,i,bits,str,bytes;function roundToEven(n){var w=floor(n),f=n-w;if(f<0.5)
return w;if(f>0.5)
return w+1;return w%2?w+1:w;}
if(v!==v){e=(1<<ebits)-1;f=pow(2,fbits-1);s=0;}else if(v===Infinity||v===-Infinity){e=(1<<ebits)-1;f=0;s=(v<0)?1:0;}else if(v===0){e=0;f=0;s=(1/v===-Infinity)?1:0;}else{s=v<0;v=abs(v);if(v>=pow(2,1-bias)){e=min(floor(log(v)/LN2),1023);f=roundToEven(v/pow(2,e)*pow(2,fbits));if(f/pow(2,fbits)>=2){e=e+1;f=1;}
if(e>bias){e=(1<<ebits)-1;f=0;}else{e=e+bias;f=f-pow(2,fbits);}}else{e=0;f=roundToEven(v/pow(2,1-bias-fbits));}}
bits=[];for(i=fbits;i;i-=1){bits.push(f%2?1:0);f=floor(f/2);}
for(i=ebits;i;i-=1){bits.push(e%2?1:0);e=floor(e/2);}
bits.push(s?1:0);bits.reverse();str=bits.join('');bytes=[];while(str.length){bytes.push(parseInt(str.substring(0,8),2));str=str.substring(8);}
return bytes;}
function unpackIEEE754(bytes,ebits,fbits){var bits=[],i,j,b,str,bias,s,e,f;for(i=bytes.length;i;i-=1){b=bytes[i-1];for(j=8;j;j-=1){bits.push(b%2?1:0);b=b>>1;}}
bits.reverse();str=bits.join('');bias=(1<<(ebits-1))-1;s=parseInt(str.substring(0,1),2)?-1:1;e=parseInt(str.substring(1,1+ebits),2);f=parseInt(str.substring(1+ebits),2);if(e===(1<<ebits)-1){return f!==0?NaN:s*Infinity;}else if(e>0){return s*pow(2,e-bias)*(1+f/pow(2,fbits));}else if(f!==0){return s*pow(2,-(bias-1))*(f/pow(2,fbits));}else{return s<0?-0:0;}}
function unpackF64(b){return unpackIEEE754(b,11,52);}
function packF64(v){return packIEEE754(v,11,52);}
function unpackF32(b){return unpackIEEE754(b,8,23);}
function packF32(v){return packIEEE754(v,8,23);}
(function(){function ArrayBuffer(length){length=ToInt32(length);if(length<0)throw RangeError('ArrayBuffer size is not a small enough positive integer.');Object.defineProperty(this,'byteLength',{value:length});Object.defineProperty(this,'_bytes',{value:Array(length)});for(var i=0;i<length;i+=1)
this._bytes[i]=0;}
global.ArrayBuffer=global.ArrayBuffer||ArrayBuffer;function $TypedArray$(){if(!arguments.length||typeof arguments[0]!=='object'){return(function(length){length=ToInt32(length);if(length<0)throw RangeError('length is not a small enough positive integer.');Object.defineProperty(this,'length',{value:length});Object.defineProperty(this,'byteLength',{value:length*this.BYTES_PER_ELEMENT});Object.defineProperty(this,'buffer',{value:new ArrayBuffer(this.byteLength)});Object.defineProperty(this,'byteOffset',{value:0});}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&arguments[0]instanceof $TypedArray$){return(function(typedArray){if(this.constructor!==typedArray.constructor)throw TypeError();var byteLength=typedArray.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,'buffer',{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:0});Object.defineProperty(this,'length',{value:typedArray.length});for(var i=0;i<this.length;i+=1)
this._setter(i,typedArray._getter(i));}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&!(arguments[0]instanceof $TypedArray$)&&!(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==='ArrayBuffer')){return(function(array){var byteLength=array.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,'buffer',{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:0});Object.defineProperty(this,'length',{value:array.length});for(var i=0;i<this.length;i+=1){var s=array[i];this._setter(i,Number(s));}}).apply(this,arguments);}
if(arguments.length>=1&&Type(arguments[0])==='object'&&(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==='ArrayBuffer')){return(function(buffer,byteOffset,length){byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)
throw RangeError('byteOffset out of range');if(byteOffset%this.BYTES_PER_ELEMENT)
throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.');if(length===undefined){var byteLength=buffer.byteLength-byteOffset;if(byteLength%this.BYTES_PER_ELEMENT)
throw RangeError('length of buffer minus byteOffset not a multiple of the element size');length=byteLength/this.BYTES_PER_ELEMENT;}else{length=ToUint32(length);byteLength=length*this.BYTES_PER_ELEMENT;}
if((byteOffset+byteLength)>buffer.byteLength)
throw RangeError('byteOffset and length reference an area beyond the end of the buffer');Object.defineProperty(this,'buffer',{value:buffer});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:byteOffset});Object.defineProperty(this,'length',{value:length});}).apply(this,arguments);}
throw TypeError();}
Object.defineProperty($TypedArray$,'from',{value:function(iterable){return new this(iterable);}});Object.defineProperty($TypedArray$,'of',{value:function(){return new this(arguments);}});var $TypedArrayPrototype$={};$TypedArray$.prototype=$TypedArrayPrototype$;Object.defineProperty($TypedArray$.prototype,'_getter',{value:function(index){if(arguments.length<1)throw SyntaxError('Not enough arguments');index=ToUint32(index);if(index>=this.length)
return undefined;var bytes=[],i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1){bytes.push(this.buffer._bytes[o]);}
return this._unpack(bytes);}});Object.defineProperty($TypedArray$.prototype,'get',{value:$TypedArray$.prototype._getter});Object.defineProperty($TypedArray$.prototype,'_setter',{value:function(index,value){if(arguments.length<2)throw SyntaxError('Not enough arguments');index=ToUint32(index);if(index>=this.length)
return;var bytes=this._pack(value),i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1){this.buffer._bytes[o]=bytes[i];}}});Object.defineProperty($TypedArray$.prototype,'constructor',{value:$TypedArray$});Object.defineProperty($TypedArray$.prototype,'copyWithin',{value:function(target,start){var end=arguments[2];var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);len=max(len,0);var relativeTarget=ToInt32(target);var to;if(relativeTarget<0)
to=max(len+relativeTarget,0);else
to=min(relativeTarget,len);var relativeStart=ToInt32(start);var from;if(relativeStart<0)
from=max(len+relativeStart,0);else
from=min(relativeStart,len);var relativeEnd;if(end===undefined)
relativeEnd=len;else
relativeEnd=ToInt32(end);var finalVal;if(relativeEnd<0)
finalVal=max(len+relativeEnd,0);else
finalVal=min(relativeEnd,len);var count=min(finalVal-from,len-to);var direction;if(from<to&&to<from+count){direction=-1;from=from+count-1;to=to+count-1;}else{direction=1;}
while(count>0){o._setter(to,o._getter(from));from=from+direction;to=to+direction;count=count-1;}
return o;}});Object.defineProperty($TypedArray$.prototype,'every',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisArg=arguments[1];for(var i=0;i<len;i++){if(!callbackfn.call(thisArg,t._getter(i),i,t))
return false;}
return true;}});Object.defineProperty($TypedArray$.prototype,'fill',{value:function(value){var start=arguments[1],end=arguments[2];var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);len=max(len,0);var relativeStart=ToInt32(start);var k;if(relativeStart<0)
k=max((len+relativeStart),0);else
k=min(relativeStart,len);var relativeEnd;if(end===undefined)
relativeEnd=len;else
relativeEnd=ToInt32(end);var finalVal;if(relativeEnd<0)
finalVal=max((len+relativeEnd),0);else
finalVal=min(relativeEnd,len);while(k<finalVal){o._setter(k,value);k+=1;}
return o;}});Object.defineProperty($TypedArray$.prototype,'filter',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var res=[];var thisp=arguments[1];for(var i=0;i<len;i++){var val=t._getter(i);if(callbackfn.call(thisp,val,i,t))
res.push(val);}
return new this.constructor(res);}});Object.defineProperty($TypedArray$.prototype,'find',{value:function(predicate){var o=ToObject(this);var lenValue=o.length;var len=ToUint32(lenValue);if(!IsCallable(predicate))throw TypeError();var t=arguments.length>1?arguments[1]:undefined;var k=0;while(k<len){var kValue=o._getter(k);var testResult=predicate.call(t,kValue,k,o);if(Boolean(testResult))
return kValue;++k;}
return undefined;}});Object.defineProperty($TypedArray$.prototype,'findIndex',{value:function(predicate){var o=ToObject(this);var lenValue=o.length;var len=ToUint32(lenValue);if(!IsCallable(predicate))throw TypeError();var t=arguments.length>1?arguments[1]:undefined;var k=0;while(k<len){var kValue=o._getter(k);var testResult=predicate.call(t,kValue,k,o);if(Boolean(testResult))
return k;++k;}
return-1;}});Object.defineProperty($TypedArray$.prototype,'forEach',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisp=arguments[1];for(var i=0;i<len;i++)
callbackfn.call(thisp,t._getter(i),i,t);}});Object.defineProperty($TypedArray$.prototype,'indexOf',{value:function(searchElement){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(len===0)return-1;var n=0;if(arguments.length>0){n=Number(arguments[1]);if(n!==n){n=0;}else if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*floor(abs(n));}}
if(n>=len)return-1;var k=n>=0?n:max(len-abs(n),0);for(;k<len;k++){if(t._getter(k)===searchElement){return k;}}
return-1;}});Object.defineProperty($TypedArray$.prototype,'join',{value:function(separator){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var tmp=Array(len);for(var i=0;i<len;++i)
tmp[i]=t._getter(i);return tmp.join(separator===undefined?',':separator);}});Object.defineProperty($TypedArray$.prototype,'lastIndexOf',{value:function(searchElement){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(len===0)return-1;var n=len;if(arguments.length>1){n=Number(arguments[1]);if(n!==n){n=0;}else if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*floor(abs(n));}}
var k=n>=0?min(n,len-1):len-abs(n);for(;k>=0;k--){if(t._getter(k)===searchElement)
return k;}
return-1;}});Object.defineProperty($TypedArray$.prototype,'map',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var res=[];res.length=len;var thisp=arguments[1];for(var i=0;i<len;i++)
res[i]=callbackfn.call(thisp,t._getter(i),i,t);return new this.constructor(res);}});Object.defineProperty($TypedArray$.prototype,'reduce',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();if(len===0&&arguments.length===1)throw TypeError();var k=0;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{accumulator=t._getter(k++);}
while(k<len){accumulator=callbackfn.call(undefined,accumulator,t._getter(k),k,t);k++;}
return accumulator;}});Object.defineProperty($TypedArray$.prototype,'reduceRight',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();if(len===0&&arguments.length===1)throw TypeError();var k=len-1;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{accumulator=t._getter(k--);}
while(k>=0){accumulator=callbackfn.call(undefined,accumulator,t._getter(k),k,t);k--;}
return accumulator;}});Object.defineProperty($TypedArray$.prototype,'reverse',{value:function(){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var half=floor(len/2);for(var i=0,j=len-1;i<half;++i,--j){var tmp=t._getter(i);t._setter(i,t._getter(j));t._setter(j,tmp);}
return t;}});Object.defineProperty($TypedArray$.prototype,'set',{value:function(index,value){if(arguments.length<1)throw SyntaxError('Not enough arguments');var array,sequence,offset,len,i,s,d,byteOffset,byteLength,tmp;if(typeof arguments[0]==='object'&&arguments[0].constructor===this.constructor){array=arguments[0];offset=ToUint32(arguments[1]);if(offset+array.length>this.length){throw RangeError('Offset plus length of array is out of range');}
byteOffset=this.byteOffset+offset*this.BYTES_PER_ELEMENT;byteLength=array.length*this.BYTES_PER_ELEMENT;if(array.buffer===this.buffer){tmp=[];for(i=0,s=array.byteOffset;i<byteLength;i+=1,s+=1){tmp[i]=array.buffer._bytes[s];}
for(i=0,d=byteOffset;i<byteLength;i+=1,d+=1){this.buffer._bytes[d]=tmp[i];}}else{for(i=0,s=array.byteOffset,d=byteOffset;i<byteLength;i+=1,s+=1,d+=1){this.buffer._bytes[d]=array.buffer._bytes[s];}}}else if(typeof arguments[0]==='object'&&typeof arguments[0].length!=='undefined'){sequence=arguments[0];len=ToUint32(sequence.length);offset=ToUint32(arguments[1]);if(offset+len>this.length){throw RangeError('Offset plus length of array is out of range');}
for(i=0;i<len;i+=1){s=sequence[i];this._setter(offset+i,Number(s));}}else{throw TypeError('Unexpected argument type(s)');}}});Object.defineProperty($TypedArray$.prototype,'slice',{value:function(start,end){var o=ToObject(this);var lenVal=o.length;var len=ToUint32(lenVal);var relativeStart=ToInt32(start);var k=(relativeStart<0)?max(len+relativeStart,0):min(relativeStart,len);var relativeEnd=(end===undefined)?len:ToInt32(end);var finalVal=(relativeEnd<0)?max(len+relativeEnd,0):min(relativeEnd,len);var count=finalVal-k;var c=o.constructor;var a=new c(count);var n=0;while(k<finalVal){var kValue=o._getter(k);a._setter(n,kValue);++k;++n;}
return a;}});Object.defineProperty($TypedArray$.prototype,'some',{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisp=arguments[1];for(var i=0;i<len;i++){if(callbackfn.call(thisp,t._getter(i),i,t)){return true;}}
return false;}});Object.defineProperty($TypedArray$.prototype,'sort',{value:function(comparefn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var tmp=Array(len);for(var i=0;i<len;++i)
tmp[i]=t._getter(i);if(comparefn)tmp.sort(comparefn);else tmp.sort();for(i=0;i<len;++i)
t._setter(i,tmp[i]);return t;}});Object.defineProperty($TypedArray$.prototype,'subarray',{value:function(start,end){function clamp(v,min,max){return v<min?min:v>max?max:v;}
start=ToInt32(start);end=ToInt32(end);if(arguments.length<1){start=0;}
if(arguments.length<2){end=this.length;}
if(start<0){start=this.length+start;}
if(end<0){end=this.length+end;}
start=clamp(start,0,this.length);end=clamp(end,0,this.length);var len=end-start;if(len<0){len=0;}
return new this.constructor(this.buffer,this.byteOffset+start*this.BYTES_PER_ELEMENT,len);}});function makeTypedArray(elementSize,pack,unpack){var TypedArray=function(){Object.defineProperty(this,'constructor',{value:TypedArray});$TypedArray$.apply(this,arguments);makeArrayAccessors(this);};if('__proto__'in TypedArray){TypedArray.__proto__=$TypedArray$;}else{TypedArray.from=$TypedArray$.from;TypedArray.of=$TypedArray$.of;}
TypedArray.BYTES_PER_ELEMENT=elementSize;var TypedArrayPrototype=function(){};TypedArrayPrototype.prototype=$TypedArrayPrototype$;TypedArray.prototype=new TypedArrayPrototype();Object.defineProperty(TypedArray.prototype,'BYTES_PER_ELEMENT',{value:elementSize});Object.defineProperty(TypedArray.prototype,'_pack',{value:pack});Object.defineProperty(TypedArray.prototype,'_unpack',{value:unpack});return TypedArray;}
var Int8Array=makeTypedArray(1,packI8,unpackI8);var Uint8Array=makeTypedArray(1,packU8,unpackU8);var Uint8ClampedArray=makeTypedArray(1,packU8Clamped,unpackU8);var Int16Array=makeTypedArray(2,packI16,unpackI16);var Uint16Array=makeTypedArray(2,packU16,unpackU16);var Int32Array=makeTypedArray(4,packI32,unpackI32);var Uint32Array=makeTypedArray(4,packU32,unpackU32);var Float32Array=makeTypedArray(4,packF32,unpackF32);var Float64Array=makeTypedArray(8,packF64,unpackF64);global.Int8Array=global.Int8Array||Int8Array;global.Uint8Array=global.Uint8Array||Uint8Array;global.Uint8ClampedArray=global.Uint8ClampedArray||Uint8ClampedArray;global.Int16Array=global.Int16Array||Int16Array;global.Uint16Array=global.Uint16Array||Uint16Array;global.Int32Array=global.Int32Array||Int32Array;global.Uint32Array=global.Uint32Array||Uint32Array;global.Float32Array=global.Float32Array||Float32Array;global.Float64Array=global.Float64Array||Float64Array;}());(function(){function r(array,index){return IsCallable(array.get)?array.get(index):array[index];}
var IS_BIG_ENDIAN=(function(){var u16array=new Uint16Array([0x1234]),u8array=new Uint8Array(u16array.buffer);return r(u8array,0)===0x12;}());function DataView(buffer,byteOffset,byteLength){if(!(buffer instanceof ArrayBuffer||Class(buffer)==='ArrayBuffer'))throw TypeError();byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)
throw RangeError('byteOffset out of range');if(byteLength===undefined)
byteLength=buffer.byteLength-byteOffset;else
byteLength=ToUint32(byteLength);if((byteOffset+byteLength)>buffer.byteLength)
throw RangeError('byteOffset and length reference an area beyond the end of the buffer');Object.defineProperty(this,'buffer',{value:buffer});Object.defineProperty(this,'byteLength',{value:byteLength});Object.defineProperty(this,'byteOffset',{value:byteOffset});};function makeGetter(arrayType){return function GetViewValue(byteOffset,littleEndian){byteOffset=ToUint32(byteOffset);if(byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)
throw RangeError('Array index out of range');byteOffset+=this.byteOffset;var uint8Array=new Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),bytes=[];for(var i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)
bytes.push(r(uint8Array,i));if(Boolean(littleEndian)===Boolean(IS_BIG_ENDIAN))
bytes.reverse();return r(new arrayType(new Uint8Array(bytes).buffer),0);};}
Object.defineProperty(DataView.prototype,'getUint8',{value:makeGetter(Uint8Array)});Object.defineProperty(DataView.prototype,'getInt8',{value:makeGetter(Int8Array)});Object.defineProperty(DataView.prototype,'getUint16',{value:makeGetter(Uint16Array)});Object.defineProperty(DataView.prototype,'getInt16',{value:makeGetter(Int16Array)});Object.defineProperty(DataView.prototype,'getUint32',{value:makeGetter(Uint32Array)});Object.defineProperty(DataView.prototype,'getInt32',{value:makeGetter(Int32Array)});Object.defineProperty(DataView.prototype,'getFloat32',{value:makeGetter(Float32Array)});Object.defineProperty(DataView.prototype,'getFloat64',{value:makeGetter(Float64Array)});function makeSetter(arrayType){return function SetViewValue(byteOffset,value,littleEndian){byteOffset=ToUint32(byteOffset);if(byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)
throw RangeError('Array index out of range');var typeArray=new arrayType([value]),byteArray=new Uint8Array(typeArray.buffer),bytes=[],i,byteView;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)
bytes.push(r(byteArray,i));if(Boolean(littleEndian)===Boolean(IS_BIG_ENDIAN))
bytes.reverse();byteView=new Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT);byteView.set(bytes);};}
Object.defineProperty(DataView.prototype,'setUint8',{value:makeSetter(Uint8Array)});Object.defineProperty(DataView.prototype,'setInt8',{value:makeSetter(Int8Array)});Object.defineProperty(DataView.prototype,'setUint16',{value:makeSetter(Uint16Array)});Object.defineProperty(DataView.prototype,'setInt16',{value:makeSetter(Int16Array)});Object.defineProperty(DataView.prototype,'setUint32',{value:makeSetter(Uint32Array)});Object.defineProperty(DataView.prototype,'setInt32',{value:makeSetter(Int32Array)});Object.defineProperty(DataView.prototype,'setFloat32',{value:makeSetter(Float32Array)});Object.defineProperty(DataView.prototype,'setFloat64',{value:makeSetter(Float64Array)});global.DataView=global.DataView||DataView;}());}(this));
(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame'];}
if(!window.requestAnimationFrame)
window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return id;};if(!window.cancelAnimationFrame)
window.cancelAnimationFrame=function(id){clearTimeout(id);};}());
(function($){$.fn.autoGrowInput=function(o){o=$.extend({maxWidth:1000,minWidth:0,comfortZone:70,onChangeCallback:null},o);this.filter('input:text').each(function(){var minWidth=o.minWidth||$(this).width(),val='',input=$(this),testSubject=$('<tester/>').css({position:'absolute',top:-9999,left:-9999,width:'auto',fontSize:input.css('fontSize'),fontFamily:input.css('fontFamily'),fontWeight:input.css('fontWeight'),letterSpacing:input.css('letterSpacing'),whiteSpace:'nowrap'}),check=function(){if(val===(val=input.val())){return;}
var escaped=val.replace(/&/g,'&amp;').replace(/\s/g,'&nbsp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');testSubject.html(escaped);var testerWidth=testSubject.width(),newWidth=(testerWidth+o.comfortZone)>=minWidth?testerWidth+o.comfortZone:minWidth,currentWidth=input.width(),isValidWidthChange=(newWidth<currentWidth&&newWidth>=minWidth)||(newWidth>minWidth&&newWidth<o.maxWidth);if(isValidWidthChange){input.width(newWidth);if(o.onChangeCallback){o.onChangeCallback(newWidth);}}};testSubject.insertAfter(input);$(this).bind('keyup keydown blur update',check);});return this;};})(jQuery);
var Observable=function(){this.observers={};};Observable=stjs.extend(Observable,null,[],function(constructor,prototype){prototype.observers=null;prototype.attach=function(observer){if(observer!=null){this.observers[observer.getId()]=observer;}};prototype.detach=function(observer){if(observer!=null){delete this.observers[observer.getId()];}};prototype.notifyObservers=function(newData){for(var observerId in this.observers){var observer=this.observers[observerId];if(observer!=null){observer.update(newData);}}};prototype.detachAll=function(){this.observers={};};},{observers:{name:"Map",arguments:[null,"Observer"]}},{});
var Observer=function(){};Observer=stjs.extend(Observer,null,[],function(constructor,prototype){prototype.getId=function(){};prototype.update=function(newData){};},{},{});
var ChartOption=function(){};ChartOption=stjs.extend(ChartOption,null,[],function(constructor,prototype){constructor.Implementation=stjs.enumeration("CANVAS");constructor.DEFAULT=ChartOption.Implementation.CANVAS;constructor.NORMAL_BAR="normal";constructor.INVERSE_NEGATIVE_BAR="inverse_negative";prototype.implementation=null;prototype.type=null;prototype.colorStrategy=null;prototype.volumeColorStrategy=null;prototype.aggregationStrategy=null;prototype.xAxisPosition=null;prototype.y1AxisPosition=null;prototype.y2AxisPosition=null;prototype.mainAxisMinMax=null;prototype.labelFont=null;prototype.bigLabelFontSize=0;prototype.normalLabelFontSize=0;prototype.smallLabelFontSize=0;prototype.adaptedLabelFontSize=0;prototype.interactionModel=null;prototype.styleModel=null;prototype.engineModel=null;prototype.layout=null;prototype.volumeAxisPosition=null;prototype.addYesterday=false;prototype.volumeHeightRatio=0.0;prototype.graphsHalfSpacing=0;prototype.showYesterday=false;prototype.showValueInTitle=false;prototype.titleType=null;prototype.displayAtStartup=false;prototype.showIndicatorsDescriptions=false;prototype.popOverAllowed=false;prototype.zoomIconSize=0;prototype.dynamicXAxisData=false;prototype.widthParam=null;prototype.autorefreshIntervalSeconds=null;prototype.focusable=false;prototype.period=null;prototype.frequency=null;prototype.mainSerieField=null;prototype.xAxisField=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParams=null;prototype.oddLinesColor=null;prototype.oddLinesColorGradientParams=null;prototype.evenLinesColor=null;prototype.evenLinesColorGradientParams=null;prototype.gridColor=null;prototype.gridColorGradientParams=null;prototype.yesterdayLineColor=null;prototype.yesterdayLineColorGradientParams=null;prototype.tickTextColor=null;prototype.tickTextColorGradientParams=null;prototype.tickColor=null;prototype.tickColorGradientParams=null;prototype.borderColor=null;prototype.borderColorGradientParams=null;prototype.areaContourColor=null;prototype.zoomAreaColor=null;prototype.zoomAreaColorGradientParam=null;prototype.textColor=null;prototype.chartPaddingLeftPercent=0.0;prototype.chartPaddingTopPercent=0.0;prototype.chartPaddingRightPercent=0.0;prototype.chartPaddingBottomPercent=0.0;prototype.chartMarginLeftPercent=0.0;prototype.chartMarginTopPercent=0.0;prototype.chartMarginRightPercent=0.0;prototype.chartMarginBottomPercent=0.0;prototype.chartBorderLeft=0;prototype.chartBorderTop=0;prototype.chartBorderRight=0;prototype.chartBorderBottom=0;prototype.gridStyle=null;prototype.showToolTip=false;prototype.showTitle=false;prototype.titleColor=null;prototype.showYAxisTicks=false;prototype.showXAxisTicks=false;prototype.yAxisTicksColor=null;prototype.xAxisTicksColor=null;prototype.labelHighlightColor=null;prototype.xAxisFormatter=null;prototype.y1AxisFormatter=null;prototype.y2AxisFormatter=null;prototype.xLabelsValuesScale=0.0;prototype.yLabelsValuesScale=0.0;prototype.xHighlightLabelFormat=null;prototype.yHighlightLabelFormat=null;prototype.allowOverlayDrawing=false;prototype.dataFormat=null;prototype.showVolume=false;prototype.stocks=null;prototype.url=null;prototype.urls=null;prototype.data=null;prototype.dataType=null;prototype.stretchLeftSide=false;prototype.stretchRightSide=false;prototype.minimumZoomFactor=0.0;prototype.animateChart=false;prototype.animationTime=0.0;prototype.highlightType=null;prototype.barType=null;prototype.yesterdayLineDashed=false;prototype.showCopyright=false;prototype.title=null;prototype.alternateTitle=null;prototype.copyrightPosition=null;prototype.showLegend=false;prototype.legendPosition=null;prototype.legendAreaPostion=null;prototype.roundNumbers=false;prototype.font=null;prototype.showBorder=false;prototype.zoomType=null;prototype.rangeSelector=null;prototype.panEnabled=false;prototype.mode=null;prototype.startScale=null;prototype.providerClass=null;prototype.reloadFunctionId=null;prototype.columnsRelativeWidth=null;prototype._styleModel=null;prototype._engineModel=null;prototype.defaultHistoColor=null;constructor.getDefault=function(){var chartConfig=new ChartOption();chartConfig.colorStrategy=ColorStrategy.GREEN_RED;chartConfig.volumeColorStrategy=ColorStrategy.GREEN_RED;chartConfig.aggregationStrategy=AggregationStrategy.MIN_MAX;chartConfig.volumeAxisPosition=Layout.Position.LEFT;chartConfig.xAxisPosition=Layout.Position.BOTTOM;chartConfig.y1AxisPosition=Layout.Position.RIGHT;chartConfig.y2AxisPosition=Layout.Position.LEFT;chartConfig.labelHighlightColor=ChartColor.lightYellow;chartConfig.mainAxisMinMax=null;chartConfig.legendAreaPostion=Layout.Position.BOTTOM;chartConfig.bigLabelFontSize=14;chartConfig.normalLabelFontSize=12;chartConfig.smallLabelFontSize=11;chartConfig.labelFont="Arial";chartConfig.interactionModel=AbstractInteractionModel.getDefaultFromDevice();chartConfig.gridColor=ChartColor.grey;chartConfig.gridColorGradientParams=null;chartConfig.chartPaddingLeftPercent=1.5;chartConfig.chartPaddingTopPercent=3;chartConfig.chartPaddingRightPercent=1.5;chartConfig.chartPaddingBottomPercent=3;chartConfig.chartMarginLeftPercent=0;chartConfig.chartMarginTopPercent=0;chartConfig.chartMarginRightPercent=0;chartConfig.chartMarginBottomPercent=0;chartConfig.chartBorderLeft=1;chartConfig.chartBorderTop=1;chartConfig.chartBorderRight=1;chartConfig.chartBorderBottom=1;chartConfig.gridStyle=GraphStyle.CLASSIC_GRID_STYLE;chartConfig.mainSerieField=Serie.Y;chartConfig.xAxisField=Serie.X;chartConfig.dynamicXAxisData=true;chartConfig.minimumZoomFactor=4;chartConfig.stretchLeftSide=false;chartConfig.stretchRightSide=true;chartConfig.xLabelsValuesScale=DateUtil.MS_MINUTE;chartConfig.yLabelsValuesScale=0.01;chartConfig.showTitle=true;chartConfig.showCopyright=true;chartConfig.animateChart=false;chartConfig.showValueInTitle=true;chartConfig.titleType=null;chartConfig.showYAxisTicks=true;chartConfig.showXAxisTicks=false;chartConfig.showIndicatorsDescriptions=true;chartConfig.dataType="indexed";chartConfig.yAxisTicksColor=ChartColor.red;chartConfig.xAxisTicksColor=ChartColor.red;chartConfig.animationTime=1000;chartConfig.providerClass="";chartConfig.highlightType=GraphStyle.LINES_HIGHLIGHT+GraphStyle.CIRCLE_HIGHLIGHT;chartConfig.barType=ChartOption.NORMAL_BAR;chartConfig.displayAtStartup=true;chartConfig.popOverAllowed=true;chartConfig.type="LINE";chartConfig.zoomIconSize=10;chartConfig.widthParam="1000";chartConfig.autorefreshIntervalSeconds=null;chartConfig.allowOverlayDrawing=false;chartConfig.zoomAreaColor=ChartColor.lightOrangeTransparent;chartConfig.textColor=ChartColor.black;chartConfig.titleColor=ChartColor.orange;chartConfig.showYesterday=true;chartConfig.graphsHalfSpacing=2;chartConfig.volumeHeightRatio=0.35;chartConfig.showVolume=true;chartConfig.columnsRelativeWidth=[0.37,0.19,0.19,0.25];chartConfig.showToolTip=false;chartConfig.showLegend=false;chartConfig.yesterdayLineDashed=true;chartConfig.yesterdayLineColor=ChartColor.orange;chartConfig.addYesterday=false;chartConfig.roundNumbers=false;chartConfig.font="Georgia";chartConfig.tickTextColor=ChartColor.grey;chartConfig.tickColor=ChartColor.grey;chartConfig.defaultHistoColor=ChartColor.orange;chartConfig.showBorder=false;chartConfig.implementation=ChartOption.DEFAULT;chartConfig.areaContourColor=null;chartConfig.xAxisFormatter=new DateTimeFormatter();chartConfig.y1AxisFormatter=new AbbreviateNumberFormatter();chartConfig.y2AxisFormatter=new PercentNumberFormatter();chartConfig.styleModel=new DefaultStyleModel();chartConfig.layout=new DefaultLayout();chartConfig.engineModel=new DefaultEngineModel();return chartConfig;};constructor.extend=function(userDefined){var customStyleModel=null;var customEngineModel=null;if(userDefined!=null){if(userDefined.styleModel!=null){customStyleModel=userDefined.styleModel;delete userDefined.styleModel;}
if(userDefined.engineModel!=null){customEngineModel=userDefined.engineModel;delete userDefined.engineModel;}}
var fullConfig=new ChartOption();fullConfig=SQW.$.extend(fullConfig,ChartOption.getDefault(),userDefined);if(customStyleModel!=null){fullConfig._styleModel=customStyleModel;userDefined.styleModel=customStyleModel;}
if(customEngineModel!=null){fullConfig._engineModel=customEngineModel;userDefined.engineModel=customEngineModel;}
return fullConfig;};constructor.getConfigFromCSS=function(){return null;};prototype.getColorStrategy=function(){return this.colorStrategy;};prototype.setColorStrategy=function(colorStrategy){this.colorStrategy=colorStrategy;};prototype.getZoomType=function(){return this.zoomType;};prototype.setZoomType=function(zoomType){this.zoomType=zoomType;};prototype.getRangeSelector=function(){return this.rangeSelector;};prototype.setRangeSelector=function(rangeSelector){this.rangeSelector=rangeSelector;};prototype.getAggregationStrategy=function(){return this.aggregationStrategy;};prototype.setAggregationStrategy=function(aggregationStrategy){this.aggregationStrategy=aggregationStrategy;};prototype.isPanEnabled=function(){return this.panEnabled;};prototype.setPanEnabled=function(panEnabled){this.panEnabled=panEnabled;};prototype.getXAxisPosition=function(){return this.xAxisPosition;};prototype.setXAxisPosition=function(xAxisPosition){this.xAxisPosition=xAxisPosition;};prototype.getY1AxisPosition=function(){return this.y1AxisPosition;};prototype.setY1AxisPosition=function(y1AxisPosition){this.y1AxisPosition=y1AxisPosition;};prototype.getY2AxisPosition=function(){return this.y2AxisPosition;};prototype.setY2AxisPosition=function(y2AxisPosition){this.y2AxisPosition=y2AxisPosition;};prototype.getLabelFont=function(){return this.labelFont;};prototype.setLabelFont=function(labelFont){this.labelFont=labelFont;};prototype.getNormalLabelFontSize=function(){return this.normalLabelFontSize;};prototype.setNormalLabelFontSize=function(normalLabelFontSize){this.normalLabelFontSize=normalLabelFontSize;};prototype.getSmallLabelFontSize=function(){return this.smallLabelFontSize;};prototype.setSmallLabelFontSize=function(smallLabelFontSize){this.smallLabelFontSize=smallLabelFontSize;};prototype.getBigLabelFontSize=function(){return this.bigLabelFontSize;};prototype.setBigLabelFontSize=function(bigLabelFontSize){this.bigLabelFontSize=bigLabelFontSize;};prototype.getInteractionModel=function(){return this.interactionModel;};prototype.setInteractionModel=function(interactionModel){this.interactionModel=interactionModel;};prototype.getPeriod=function(){return this.period;};prototype.setPeriod=function(period){this.period=period;};prototype.getFrequency=function(){return this.frequency;};prototype.setFrequency=function(frequency){this.frequency=frequency;};prototype.getMode=function(){if(this.mode!=null&&!this.mode.isEmpty()){return this.mode;}
var periodInstance=Period.getInstance(this.period,this.frequency);if(periodInstance.isIntraday()){return Period.INTRADAY;}
return Period.HISTO;};prototype.setMode=function(mode){this.mode=mode;};prototype.getStartScale=function(){return this.startScale;};prototype.setStartScale=function(startScale){this.startScale=startScale;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParams=function(){return this.backgroundColorGradientParams;};prototype.setBackgroundColorGradientParams=function(backgroundColorGradientParams){this.backgroundColorGradientParams=backgroundColorGradientParams;};prototype.getOddLinesColorGradientParams=function(){return this.oddLinesColorGradientParams;};prototype.setOddLinesColorGradientParams=function(oddLinesColorGradientParams){this.oddLinesColorGradientParams=oddLinesColorGradientParams;};prototype.getEvenLinesColorGradientParams=function(){return this.evenLinesColorGradientParams;};prototype.setEvenLinesColorGradientParams=function(evenLinesColorGradientParams){this.evenLinesColorGradientParams=evenLinesColorGradientParams;};prototype.getGridColorGradientParams=function(){return this.gridColorGradientParams;};prototype.setGridColorGradientParams=function(gridColorGradientParams){this.gridColorGradientParams=gridColorGradientParams;};prototype.getYesterdayLineColorGradientParams=function(){return this.yesterdayLineColorGradientParams;};prototype.setYesterdayLineColorGradientParams=function(yesterdayLineColorGradientParams){this.yesterdayLineColorGradientParams=yesterdayLineColorGradientParams;};prototype.isAddYesterday=function(){return this.addYesterday;};prototype.setAddYesterday=function(addYesterday){this.addYesterday=addYesterday;};prototype.getTickTextColorGradientParams=function(){return this.tickTextColorGradientParams;};prototype.setTickTextColorGradientParams=function(tickTextColorGradientParams){this.tickTextColorGradientParams=tickTextColorGradientParams;};prototype.getTickColorGradientParams=function(){return this.tickColorGradientParams;};prototype.setTickColorGradientParams=function(tickColorGradientParams){this.tickColorGradientParams=tickColorGradientParams;};prototype.getBorderColorGradientParams=function(){return this.borderColorGradientParams;};prototype.setBorderColorGradientParams=function(borderColorGradientParams){this.borderColorGradientParams=borderColorGradientParams;};prototype.getGridStyle=function(){return this.gridStyle;};prototype.setGridStyle=function(gridStyle){this.gridStyle=gridStyle;};prototype.getOddLinesColor=function(){return this.oddLinesColor;};prototype.setOddLinesColor=function(oddLinesColor){this.oddLinesColor=oddLinesColor;};prototype.getEvenLinesColor=function(){return this.evenLinesColor;};prototype.setEvenLinesColor=function(evenLinesColor){this.evenLinesColor=evenLinesColor;};prototype.getGridColor=function(){return this.gridColor;};prototype.setGridColor=function(gridColor){this.gridColor=gridColor;};prototype.isShowTitle=function(){return this.showTitle;};prototype.setShowTitle=function(showTitle){this.showTitle=showTitle;};prototype.isShowCopyright=function(){return this.showCopyright;};prototype.setShowCopyright=function(showCopyright){this.showCopyright=showCopyright;};prototype.getCopyrightPosition=function(){return this.copyrightPosition;};prototype.setCopyrightPosition=function(copyrightPosition){this.copyrightPosition=copyrightPosition;};prototype.isShowLegend=function(){return this.showLegend;};prototype.setShowLegend=function(showLegend){this.showLegend=showLegend;};prototype.getLegendPosition=function(){return this.legendPosition;};prototype.setLegendPosition=function(legendPosition){this.legendPosition=legendPosition;};prototype.getYesterdayLineColor=function(){return this.yesterdayLineColor;};prototype.setYesterdayLineColor=function(yesterdayLineColor){this.yesterdayLineColor=yesterdayLineColor;};prototype.isYesterdayLineDashed=function(){return this.yesterdayLineDashed;};prototype.setYesterdayLineDashed=function(yesterdayLineDashed){this.yesterdayLineDashed=yesterdayLineDashed;};prototype.isRoundNumbers=function(){return this.roundNumbers;};prototype.setRoundNumbers=function(roundNumbers){this.roundNumbers=roundNumbers;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getTickTextColor=function(){return this.tickTextColor;};prototype.setTickTextColor=function(tickTextColor){this.tickTextColor=tickTextColor;};prototype.getTickColor=function(){return this.tickColor;};prototype.setTickColor=function(tickColor){this.tickColor=tickColor;};prototype.isShowBorder=function(){return this.showBorder;};prototype.setShowBorder=function(showBorder){this.showBorder=showBorder;};prototype.getBorderColor=function(){return this.borderColor;};prototype.setBorderColor=function(borderColor){this.borderColor=borderColor;};prototype.getImplementation=function(){return this.implementation;};prototype.setImplementation=function(implementation){this.implementation=implementation;};prototype.getChartPaddingLeftPercent=function(){return this.chartPaddingLeftPercent;};prototype.setChartPaddingLeftPercent=function(chartPaddingLeftPercent){this.chartPaddingLeftPercent=chartPaddingLeftPercent;};prototype.getChartPaddingTopPercent=function(){return this.chartPaddingTopPercent;};prototype.setChartPaddingTopPercent=function(chartPaddingTopPercent){this.chartPaddingTopPercent=chartPaddingTopPercent;};prototype.getChartPaddingRightPercent=function(){return this.chartPaddingRightPercent;};prototype.setChartPaddingRightPercent=function(chartPaddingRightPercent){this.chartPaddingRightPercent=chartPaddingRightPercent;};prototype.getChartPaddingBottomPercent=function(){return this.chartPaddingBottomPercent;};prototype.setChartPaddingBottomPercent=function(chartPaddingBottomPercent){this.chartPaddingBottomPercent=chartPaddingBottomPercent;};prototype.getMainSerieField=function(){return this.mainSerieField;};prototype.setMainSerieField=function(mainSerieField){this.mainSerieField=mainSerieField;};prototype.getChartMarginLeftPercent=function(){return this.chartMarginLeftPercent;};prototype.setChartMarginLeftPercent=function(chartMarginLeftPercent){this.chartMarginLeftPercent=chartMarginLeftPercent;};prototype.getChartMarginTopPercent=function(){return this.chartMarginTopPercent;};prototype.setChartMarginTopPercent=function(chartMarginTopPercent){this.chartMarginTopPercent=chartMarginTopPercent;};prototype.getChartMarginRightPercent=function(){return this.chartMarginRightPercent;};prototype.setChartMarginRightPercent=function(chartMarginRightPercent){this.chartMarginRightPercent=chartMarginRightPercent;};prototype.getChartMarginBottomPercent=function(){return this.chartMarginBottomPercent;};prototype.setChartMarginBottomPercent=function(chartMarginBottomPercent){this.chartMarginBottomPercent=chartMarginBottomPercent;};prototype.getChartBorderLeft=function(){return this.chartBorderLeft;};prototype.setChartBorderLeft=function(chartBorderLeft){this.chartBorderLeft=chartBorderLeft;};prototype.getChartBorderTop=function(){return this.chartBorderTop;};prototype.setChartBorderTop=function(chartBorderTop){this.chartBorderTop=chartBorderTop;};prototype.getChartBorderRight=function(){return this.chartBorderRight;};prototype.setChartBorderRight=function(chartBorderRight){this.chartBorderRight=chartBorderRight;};prototype.getChartBorderBottom=function(){return this.chartBorderBottom;};prototype.setChartBorderBottom=function(chartBorderBottom){this.chartBorderBottom=chartBorderBottom;};prototype.getHighlightType=function(){return this.highlightType;};prototype.setHighlightType=function(highlightType){this.highlightType=highlightType;};prototype.getUrl=function(){return this.url;};prototype.setUrl=function(url){this.url=url;};prototype.getUrls=function(){return this.urls;};prototype.setUrls=function(urls){this.urls=urls;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getXAxisField=function(){return this.xAxisField;};prototype.setXAxisField=function(xAxisField){this.xAxisField=xAxisField;};prototype.getXAxisFormatter=function(){return this.xAxisFormatter;};prototype.setxAxisFormatter=function(xAxisFormatter){this.xAxisFormatter=xAxisFormatter;};prototype.getY1AxisFormatter=function(){return this.y1AxisFormatter;};prototype.setY1AxisFormatter=function(y1AxisFormatter){this.y1AxisFormatter=y1AxisFormatter;};prototype.getY2AxisFormatter=function(){return this.y2AxisFormatter;};prototype.setY2AxisFormatter=function(y2AxisFormatter){this.y2AxisFormatter=y2AxisFormatter;};prototype.getMinimumZoomFactor=function(){return this.minimumZoomFactor;};prototype.setMinimumZoomFactor=function(minimumZoomFactor){this.minimumZoomFactor=minimumZoomFactor;};prototype.isStretchLeftSide=function(){return this.stretchLeftSide;};prototype.setStretchLeftSide=function(stretchLeftSide){this.stretchLeftSide=stretchLeftSide;};prototype.isStretchRightSide=function(){return this.stretchRightSide;};prototype.setStretchRightSide=function(stretchRightSide){this.stretchRightSide=stretchRightSide;};prototype.getXHighlightLabelFormat=function(){return this.xHighlightLabelFormat;};prototype.setXHighlightLabelFormat=function(xHighlightLabelFormat){this.xHighlightLabelFormat=xHighlightLabelFormat;};prototype.setAnimateChart=function(animateChart){this.animateChart=animateChart;};prototype.isAnimateChart=function(){return this.animateChart;};prototype.setAnimationTime=function(animationTime){this.animationTime=animationTime;};prototype.getAnimationTime=function(){return this.animationTime;};prototype.getProviderName=function(){return this.providerClass;};prototype.setProviderClass=function(providerClass){this.providerClass=providerClass;};prototype.getVolumeHeightRatio=function(){return this.volumeHeightRatio;};prototype.setVolumeHeightRatio=function(volumeHeightRatio){this.volumeHeightRatio=volumeHeightRatio;};prototype.getGraphsHalfSpacing=function(){return this.graphsHalfSpacing;};prototype.setGraphsHalfSpacing=function(graphsHalfSpacing){this.graphsHalfSpacing=graphsHalfSpacing;};prototype.getVolumeAxisPosition=function(){return this.volumeAxisPosition;};prototype.setVolumeAxisPosition=function(volumeAxisPosition){this.volumeAxisPosition=volumeAxisPosition;};prototype.isShowYesterday=function(){return this.showYesterday;};prototype.setShowYesterday=function(showYesterday){this.showYesterday=showYesterday;};prototype.isShowVolume=function(){return this.showVolume;};prototype.setShowVolume=function(showVolume){this.showVolume=showVolume;};prototype.getBarType=function(){return this.barType;};prototype.setBarType=function(barType){this.barType=barType;};prototype.getTitleColor=function(){return this.titleColor;};prototype.setTitleColor=function(titleColor){this.titleColor=titleColor;};prototype.isShowValueInTitle=function(){return this.showValueInTitle;};prototype.setShowValueInTitle=function(showValueInTitle){this.showValueInTitle=showValueInTitle;};prototype.isShowYAxisTicks=function(){return this.showYAxisTicks;};prototype.isShowXAxisTicks=function(){return this.showXAxisTicks;};prototype.setShowXAxisTicks=function(showXAxisTicks){this.showXAxisTicks=showXAxisTicks;};prototype.getYAxisTicksColor=function(){return this.yAxisTicksColor;};prototype.setYAxisTicksColor=function(yAxisTicksColor){this.yAxisTicksColor=yAxisTicksColor;};prototype.getXAxisTicksColor=function(){return this.xAxisTicksColor;};prototype.setXAxisTicksColor=function(xAxisTicksColor){this.xAxisTicksColor=xAxisTicksColor;};prototype.getRawDataType=function(){return this.dataType;};prototype.setRawDataType=function(dataType){this.dataType=dataType;};prototype.getStyleModel=function(){return this.styleModel;};prototype.setStyleModel=function(styleModel){this.styleModel=styleModel;};prototype.getEngineModel=function(){return this.engineModel;};prototype.setEngineModel=function(engineModel){this.engineModel=engineModel;};prototype.getDataProvider=function(){return DataProviderFactory.getInstance().getProvider(this);};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.getLayout=function(){return this.layout;};prototype.setLayout=function(layout){this.layout=layout;};prototype.isDisplayAtStartup=function(){return this.displayAtStartup;};prototype.setDisplayAtStartup=function(displayAtStartup){this.displayAtStartup=displayAtStartup;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getAlternateTitle=function(){return this.alternateTitle;};prototype.setAlternateTitle=function(alternateTitle){this.alternateTitle=alternateTitle;};prototype.isPopOverAllowed=function(){return this.popOverAllowed;};prototype.setPopOverAllowed=function(popOverAllowed){this.popOverAllowed=popOverAllowed;};prototype.getZoomIconSize=function(){return this.zoomIconSize;};prototype.setZoomIconSize=function(zoomIconSize){this.zoomIconSize=zoomIconSize;};prototype.getWidthParam=function(){return this.widthParam;};prototype.setWidthParam=function(widthParam){this.widthParam=widthParam;};prototype.isShowToolTip=function(){return this.showToolTip;};prototype.setShowToolTip=function(showToolTip){this.showToolTip=showToolTip;};prototype.setShowYAxisTicks=function(showYAxisTicks){this.showYAxisTicks=showYAxisTicks;};prototype.getStocks=function(){return this.stocks;};prototype.setStocks=function(stocks){this.stocks=stocks;};prototype.getLegendAreaPostion=function(){return this.legendAreaPostion;};prototype.setLegendAreaPostion=function(legendAreaPostion){this.legendAreaPostion=legendAreaPostion;};prototype.isDynamicXAxisData=function(){return this.dynamicXAxisData;};prototype.setDynamicXAxisData=function(dynamicXAxisData){this.dynamicXAxisData=dynamicXAxisData;};prototype.getReloadFunctionId=function(){return this.reloadFunctionId;};prototype.getAutorefreshIntervalSeconds=function(){return this.autorefreshIntervalSeconds;};prototype.setAutorefreshIntervalSeconds=function(autorefreshInterval){this.autorefreshIntervalSeconds=autorefreshInterval;};prototype.getTitleType=function(){return this.titleType;};prototype.setTitleType=function(titleType){this.titleType=titleType;};prototype.setColumnsRelativeWidth=function(columnsRelativeWidth){this.columnsRelativeWidth=columnsRelativeWidth;};prototype.getColumnsRelativeWidth=function(){return this.columnsRelativeWidth;};prototype.isAllowOverlayDrawing=function(){return this.allowOverlayDrawing;};prototype.setAllowOverlayDrawing=function(allowOverlayDrawing){this.allowOverlayDrawing=allowOverlayDrawing;};prototype.getZoomAreaColor=function(){return this.zoomAreaColor;};prototype.setZoomAreaColor=function(zoomAreaColor){this.zoomAreaColor=zoomAreaColor;};prototype.getZoomAreaColorGradientParam=function(){return this.zoomAreaColorGradientParam;};prototype.setZoomAreaColorGradientParam=function(zoomAreaColorGradientParam){this.zoomAreaColorGradientParam=zoomAreaColorGradientParam;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getCustomStyleModel=function(){return this._styleModel;};prototype.getCustomEngineModel=function(){return this._engineModel;};prototype.setCustomeStyleModel=function(customStyleModel){this._styleModel=customStyleModel;};prototype.setCustomeEngineModel=function(customEngineModel){this._engineModel=customEngineModel;};prototype.getMainAxisMinMax=function(){return this.mainAxisMinMax;};prototype.setMainAxisMinMax=function(mainAxisMinMax){this.mainAxisMinMax=mainAxisMinMax;};prototype.getDefaultHistoColor=function(){return this.defaultHistoColor;};prototype.setDefaultHistoColor=function(defaultHistoColor){this.defaultHistoColor=defaultHistoColor;};prototype.getLabelHighlightColor=function(){return this.labelHighlightColor;};prototype.setLabelHighlightColor=function(labelHighlightColor){this.labelHighlightColor=labelHighlightColor;};prototype.getVolumeColorStrategy=function(){return this.volumeColorStrategy;};prototype.setVolumeColorStrategy=function(volumeColorStrategy){this.volumeColorStrategy=volumeColorStrategy;};prototype.isShowIndicatorsDescriptions=function(){return this.showIndicatorsDescriptions;};prototype.setShowIndicatorsDescriptions=function(showIndicatorsDescriptions){this.showIndicatorsDescriptions=showIndicatorsDescriptions;};prototype.getAreaContourColor=function(){return this.areaContourColor;};prototype.setAreaContourColor=function(areaContourColor){this.areaContourColor=areaContourColor;};},{DEFAULT:{name:"Enum",arguments:["ChartOption.Implementation"]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},colorStrategy:"ColorStrategy",volumeColorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},xAxisPosition:{name:"Enum",arguments:["Layout.Position"]},y1AxisPosition:{name:"Enum",arguments:["Layout.Position"]},y2AxisPosition:{name:"Enum",arguments:["Layout.Position"]},mainAxisMinMax:{name:"Array",arguments:[null]},interactionModel:"AbstractInteractionModel",styleModel:"StyleModel",engineModel:"EngineModel",layout:"Layout",volumeAxisPosition:{name:"Enum",arguments:["Layout.Position"]},backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]},oddLinesColor:"ChartColor",oddLinesColorGradientParams:{name:"Array",arguments:[null]},evenLinesColor:"ChartColor",evenLinesColorGradientParams:{name:"Array",arguments:[null]},gridColor:"ChartColor",gridColorGradientParams:{name:"Array",arguments:[null]},yesterdayLineColor:"ChartColor",yesterdayLineColorGradientParams:{name:"Array",arguments:[null]},tickTextColor:"ChartColor",tickTextColorGradientParams:{name:"Array",arguments:[null]},tickColor:"ChartColor",tickColorGradientParams:{name:"Array",arguments:[null]},borderColor:"ChartColor",borderColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},textColor:"ChartColor",titleColor:"ChartColor",yAxisTicksColor:"ChartColor",xAxisTicksColor:"ChartColor",labelHighlightColor:"ChartColor",xAxisFormatter:"Formatter",y1AxisFormatter:"Formatter",y2AxisFormatter:"Formatter",stocks:{name:"Array",arguments:["Stock"]},urls:{name:"Array",arguments:[null]},data:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},copyrightPosition:{name:"Array",arguments:[null]},legendPosition:{name:"Array",arguments:[null]},legendAreaPostion:{name:"Enum",arguments:["Layout.Position"]},zoomType:{name:"Map",arguments:[null,null]},rangeSelector:{name:"Map",arguments:[null,"Object"]},startScale:{name:"Array",arguments:[null]},columnsRelativeWidth:{name:"Array",arguments:[null]},_styleModel:"StyleModel",_engineModel:"EngineModel",defaultHistoColor:"ChartColor"},{});
var Chart=function(parentElement,optionParams){this.id=new Date().getTime()+"_chart_"+Math.round((Math.random()*100000));this.renderCallbacks={};this.init(parentElement,optionParams);if(Chart.charts==null){Chart.charts={};}
Chart.charts[this.id]=this;};Chart=stjs.extend(Chart,null,[Observer],function(constructor,prototype){constructor.ChartType=stjs.enumeration("POINT","LINE","AREA","BAR","HLOC","HL_AREA","CANDLESTICK","BID_ASK","NONE","PIE");constructor.charts=null;prototype.relatedCharts=null;prototype.renderCallbacks=null;prototype.parentElement=null;prototype.id=null;prototype.title=null;prototype.chartType=null;prototype.engineModel=null;prototype.data=null;prototype.chartView=null;prototype.interactionModel=null;prototype.options=null;prototype.init=function(parentElement,optionParams){this.options=this.getExtendedOption(optionParams);this.parentElement=parentElement;this.title=this.options.getTitle();this.chartType=Chart.ChartType.valueOf(this.options.getType());if(this.chartType==null){this.chartType=Chart.ChartType.LINE;}
this.relatedCharts={};};prototype.getExtendedOption=function(optionParams){return ChartOption.extend(optionParams);};prototype.render=function(xRange){};prototype.reRender=function(){};prototype.onResize=function(triggerRender){};prototype.resize=function(width,height){};prototype.refresh=function(){};prototype.reset=function(){};prototype.pause=function(){};prototype.unpause=function(){};prototype.openPopOver=function(){};prototype.setChartType=function(chartTypeString){};prototype.reattachTo=function(newParenDiv){};prototype.addRelatedChart=function(chart,reflexive){if(chart==null){return;}
var key=chart.getId();if(this.relatedCharts[key]==null){this.relatedCharts[key]=chart;}
if(reflexive){chart.addRelatedChart(this,false);}};prototype.removeChart=function(){if(Chart.charts[this.id]!=null){AbstractInteractionModel.unregisterModelOn(this.interactionModel,this.parentElement);delete Chart.charts[this.id];}};prototype.removeRelatedChart=function(chart,reflexive){if(chart==null){return;}
var key=chart.getId();delete this.relatedCharts[key];if(reflexive){chart.removeRelatedChart(this,false);}};prototype.isChartRendered=function(){};prototype.isPanning=function(){};prototype.startPan=function(offsetX,offsetY){};prototype.movePan=function(offsetX,offsetY){};prototype.endPan=function(offsetX,offsetY){};prototype.setZoomLevel=function(zoomLevel){};prototype.setZoomHistory=function(zoomHistory){};prototype.isZooming=function(){};prototype.isZoomStarted=function(){};prototype.startZoom=function(offsetX,offsetY){};prototype.moveZoom=function(offsetX,offsetY){};prototype.endZoom=function(offsetX,offsetY){};prototype.zoomIn=function(offsetX,offsetY,newPercentSize){};prototype.zoomOut=function(offsetX,offsetY,newPercentSize){};prototype.zoomInWheel=function(offsetX,offsetY,newPercentSize){};prototype.zoomOutWheel=function(offsetX,offsetY,newPercentSize){};prototype.zoomBack=function(){};prototype.mouseAt=function(offsetX,offsetY){};prototype.click=function(offsetX,offsetY){};prototype.getZoomLevel=function(){};prototype.getPanLevel=function(){};prototype.getZoomHistory=function(){};prototype.getId=function(){return this.id;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getChartType=function(){return this.chartType;};prototype.getChartData=function(){return this.data;};prototype.getView=function(){return this.chartView;};prototype.getEngineModel=function(){return this.engineModel;};prototype.setEngineModel=function(engineModel){this.engineModel=engineModel;};prototype.getParentElement=function(){return this.parentElement;};prototype.getChartOption=function(){return this.options;};prototype.getChartView=function(){return this.chartView;};constructor.pauseAll=function(){if(Chart.charts!=null){for(var chartId in Chart.charts){var chart=Chart.charts[chartId];if(chart!=null){chart.pause();}}}};constructor.unpauseAll=function(){if(Chart.charts!=null){for(var chartId in Chart.charts){var chart=Chart.charts[chartId];if(chart!=null){chart.unpause();}}}};prototype.isPanStarted=function(){};prototype.getInteractionModel=function(){return this.interactionModel;};prototype.updateInteractionModel=function(interactionModel,newParentDiv){if(this.interactionModel!=null){AbstractInteractionModel.unregisterModelOn(this.interactionModel,this.parentElement);}
if(interactionModel!=null){this.interactionModel=interactionModel;}else{this.interactionModel=AbstractInteractionModel.getDefaultFromDevice();}
AbstractInteractionModel.registerModelOn(this.interactionModel,newParentDiv,this);};prototype.fireRenderCallbacks=function(){for(var id in this.renderCallbacks){var currentCallback=this.renderCallbacks[id];if(currentCallback!=null){currentCallback(this);}}};prototype.registerRenderCallback=function(callbackId,renderCallback){if(callbackId!=null&&renderCallback!=null){this.renderCallbacks[callbackId]=renderCallback;}};prototype.unregisterRenderCallback=function(callbackId){if(callbackId!=null){delete this.renderCallbacks[callbackId];}};},{charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"ChartView",interactionModel:"AbstractInteractionModel"},{});
var DefaultChart=function(parentDiv,optionsParam){Chart.call(this,parentDiv,optionsParam);};DefaultChart=stjs.extend(DefaultChart,Chart,[],function(constructor,prototype){prototype.paused=false;prototype.zooming=false;prototype.zoomStarted=false;prototype.minimumZoomFactor=null;prototype.zoomHistory=null;prototype.zoomLevel=null;prototype.panLevel=null;prototype.popOverAllowed=false;prototype.currentLoadingId=0;prototype.updated=false;prototype.startUp=false;prototype.interactionStartElement=null;prototype.panning=false;prototype.panStarted=false;prototype.panningStartValue=null;prototype.originalPanSize=null;prototype.missedUpdate=false;prototype.chartRendered=false;prototype.waitUpdate=false;prototype.renderEndCallback=null;prototype.init=function(parentDiv,optionsParam){Chart.prototype.init.call(this,parentDiv,optionsParam);this.popOverAllowed=this.options.isPopOverAllowed();this.currentLoadingId=0;this.zoomHistory=[];this.zoomLevel=null;this.minimumZoomFactor=this.options.getMinimumZoomFactor();if(this.minimumZoomFactor==null){this.minimumZoomFactor=4.0;}
this.missedUpdate=false;this.updated=false;this.startUp=true;this.zooming=false;this.zoomStarted=false;this.panStarted=false;this.panning=false;this.paused=false;this.chartRendered=false;this.waitUpdate=true;this.chartView=ChartView.createView(this.options.getImplementation(),this.options,this.parentElement);this.initSpecifics();this.updateInteractionModel(this.options.getInteractionModel(),this.parentElement);var self=this;this.renderEndCallback=function(){self.chartRendered=true;self.mouseAt(self.interactionModel.getLastMouseXPosition(),self.interactionModel.getLastMouseYPosition());};if(this.options.isDisplayAtStartup()&&this.chartView.isValid()){this.refresh();}};prototype.reattachTo=function(newParenDiv){this.chartView.moveTo(newParenDiv);this.updateInteractionModel(this.options.getInteractionModel(),newParenDiv);this.parentElement=newParenDiv;};prototype.initSpecifics=function(){this.engineModel=this.options.getEngineModel();if(this.engineModel==null){this.engineModel=new DefaultEngineModel();}
this.engineModel.init(this.options);this.data=new ChartData(this,this.options.getDataProvider());this.data.attach(this);};prototype.render=function(xRange){if(!this.updated){return;}
this.chartView.clear();this.engineModel.updateRange(xRange,this.chartView,this.data);this.engineModel.createMainGraphics(this.chartView,this.data);this.chartView.render();this.fireRenderCallbacks();};prototype.reRender=function(){if(this.paused||this.waitUpdate){return;}
this.chartView.clear();this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);this.engineModel.createMainGraphics(this.chartView,this.data);this.chartView.render();this.fireRenderCallbacks();};prototype.resize=function(width,height){this.chartView.clear();this.chartView.resize(width,height);this.render(this.zoomLevel);};prototype.setChartType=function(chartTypeString){this.chartType=Chart.ChartType.valueOf(chartTypeString);this.options.setType(chartTypeString);this.engineModel.updateGraphEngine(this.options);this.refresh();};prototype.refresh=function(){this.chartRendered=false;this.chartView.clear();this.currentLoadingId=this.chartView.showLoadingIndicator();this.data.fetchDataSeries();};prototype.reset=function(){this.zoomHistory=[];this.zoomLevel=null;this.missedUpdate=false;this.startUp=true;this.zooming=false;this.zoomStarted=false;this.panStarted=false;this.panning=false;this.paused=false;this.chartRendered=false;this.engineModel.reset();this.waitUpdate=true;this.refresh();};prototype.update=function(newData){this.waitUpdate=false;if(this.paused){this.missedUpdate=true;return;}
this.data=newData;this.updated=true;this.missedUpdate=false;this.engineModel.updateXType(this.data.getXType());this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);this.chartView.getLayout().updateYAxis();this.chartView.clear();this.chartView.hideLoadingIndicator(this.currentLoadingId);this.engineModel.createMainGraphics(this.chartView,this.data);if(this.options.isAnimateChart()&&this.startUp){this.startUp=false;this.chartView.renderAnimation(this.renderEndCallback);}else{this.chartView.render();this.renderEndCallback();this.fireRenderCallbacks();}};prototype.zoomBack=function(){if(this.paused){return;}
this.zoomStarted=false;this.zooming=false;var previousZoom=this.zoomHistory.pop();if(previousZoom!=null){var startXValue=previousZoom[0];var endXValue=previousZoom[1];if(this.zoomLevel==null||startXValue!=this.zoomLevel[0]||endXValue!=this.zoomLevel[1]){this.setZoomLevel(previousZoom);this.render(previousZoom);}}};prototype.startZoom=function(offsetX,offsetY){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var areaBounds=graph.getAreaBound();var x=offsetX-areaBounds.getContentLeft();this.zoomStarted=true;this.interactionStartElement=this.engineModel.getXSpaceValueAt(this.chartView,x);this.chartView.setZoomAreaStartPos(offsetX,offsetY);}};prototype.endZoom=function(offsetX,offsetY){if(!this.paused&&this.zooming){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)&&this.interactionStartElement!=null){var areaBounds=graph.getAreaBound();var x=offsetX-areaBounds.getContentLeft();var leftXSpace=this.interactionStartElement;var rightXSpace=this.engineModel.getXSpaceValueAt(this.chartView,x);if(leftXSpace>rightXSpace){var tmp=leftXSpace;leftXSpace=rightXSpace;rightXSpace=tmp;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(leftXSpace)/valueScale)*valueScale;var rightXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(rightXSpace)/valueScale)*valueScale;var validRange=this.getValidXValueRange(leftXValue,rightXValue);if(validRange!=null&&!this.isRangeSameAs(this.zoomLevel,validRange)&&(validRange[1]-validRange[0])>=this.minimumZoomFactor){this.saveZoomValue();this.setZoomLevel(validRange);this.render(validRange);}}}
this.zooming=false;this.zoomStarted=false;this.interactionStartElement=null;this.chartView.setZoomAreaStartPos(null,null);this.chartView.setCurrentZoomAreaPos(null,null);};prototype.isZooming=function(){return this.zooming;};prototype.isZoomStarted=function(){return this.zoomStarted;};prototype.moveZoom=function(offsetX,offsetY){if(this.paused){return;}
this.zooming=true;this.chartView.setCurrentZoomAreaPos(offsetX,offsetY);};prototype.isRangeSameAs=function(referenceRange,range){if(range==null&&referenceRange==null){return true;}else if(range==null||referenceRange==null){return false;}else{return range[0]==referenceRange[0]&&range[1]==referenceRange[1];}};prototype.zoomIn=function(offsetX,offsetY,newPercentSize){if(this.paused){return false;}
var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)){return this.applyZoom(offsetX,newPercentSize,true);}
return false;};prototype.zoomOut=function(offsetX,offsetY,newPercentSize){if(this.paused){return false;}
var zoomedOut=false;var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)&&this.zoomLevel!=null){zoomedOut=this.applyZoom(offsetX,newPercentSize,false);if(zoomedOut){this.zoomHistory.pop();if(this.zoomLevel!=null&&this.zoomHistory.length>0){var previousZoom=this.zoomHistory[this.zoomHistory.length-1];if(previousZoom==null){this.zoomHistory.pop();}else{var previousStartValue=previousZoom[0];var previousEndValue=previousZoom[1];var currentStartValue=this.zoomLevel[0];var currentEndValue=this.zoomLevel[1];if(currentStartValue<previousStartValue||currentEndValue>previousEndValue){this.zoomHistory.pop();}}}else{this.zoomHistory=[];}}else{this.zoomBack();}}
return zoomedOut;};prototype.applyZoom=function(x,percentZoom,bounded){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.paused||graph==null){return false;}
var areaBound=graph.getAreaBound();var extremums=this.data.getExtremums();if(extremums==null||extremums[0]==null||extremums[1]==null){return false;}
var center=x-areaBound.getContentLeft();var width=areaBound.getContentWidth();var newWidth=width*percentZoom;var stepSize=this.data.getXStepSize();if(stepSize<=0){stepSize=1;}
var minWidth=this.data.getTotalXSpace()>1?width*(this.minimumZoomFactor/(this.data.getTotalXSpace()-1)):0;if(newWidth<minWidth){newWidth=minWidth;}
var halfWidth=(newWidth/2.0);var newLeft=center-halfWidth;var newRight=center+halfWidth;if(bounded&&newLeft<0){newRight-=newLeft;newLeft=0;}
if(bounded&&newRight>width){var correction=newRight-width;newLeft-=correction;newLeft=newLeft<0?0:newLeft;newRight=width;}
var leftXSpace=this.engineModel.getXSpaceValueAt(this.chartView,newLeft);var rightXSpace=this.engineModel.getXSpaceValueAt(this.chartView,newRight);var totalXSpaceSize=this.data.getTotalXSpace();if(leftXSpace<0){rightXSpace-=leftXSpace;leftXSpace=0;}
if(rightXSpace>=totalXSpaceSize){var correction=rightXSpace-totalXSpaceSize+1;leftXSpace-=correction;leftXSpace=leftXSpace<0?0:leftXSpace;rightXSpace=totalXSpaceSize-1;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(leftXSpace)/valueScale)*valueScale;var rightXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(rightXSpace)/valueScale)*valueScale;var validRange=this.getValidXValueRange(leftXValue,rightXValue);if(validRange!=null&&!this.isRangeSameAs(this.zoomLevel,validRange)&&(validRange[1]-validRange[0])>=this.minimumZoomFactor){this.saveZoomValue();this.setZoomLevel(validRange);this.render(validRange);return true;}
return false;};prototype.zoomInWheel=function(offsetX,offsetY,newPercentSize){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var chartAreaBound=graph.getAreaBound();var minValidX=stjs.trunc(chartAreaBound.getContentLeft());var maxValidX=stjs.trunc((chartAreaBound.getContentLeft()+chartAreaBound.getContentWidth()-1));var x=minValidX<offsetX?offsetX:minValidX;x=offsetX>maxValidX?maxValidX:offsetX;this.zoomIn(x,stjs.trunc(chartAreaBound.getContentTop()),newPercentSize);}};prototype.zoomOutWheel=function(offsetX,offsetY,newPercentSize){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(!this.paused&&this.isValidPositionForInteraction(offsetX,offsetY)){var chartAreaBound=graph.getAreaBound();var centerX=Math.round(chartAreaBound.getContentLeft()+chartAreaBound.getContentWidth()/2.0);this.zoomOut(stjs.trunc(centerX),stjs.trunc(chartAreaBound.getContentTop()),newPercentSize);}};prototype.startPan=function(offsetX,offsetY){if(this.paused){return false;}
this.engineModel.updatePosition(offsetX,offsetY);var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(this.isValidPositionForInteraction(offsetX,offsetY)){this.chartView.clearHighlight();var areaBound=graph.getAreaBound();var localXPosition=offsetX-areaBound.getContentLeft();this.panningStartValue=Math.round(this.engineModel.getXSpaceValueAt(this.chartView,localXPosition));this.panStarted=true;this.panLevel=this.zoomLevel!=null?this.zoomLevel.slice(0):null;return true;}else{return false;}};prototype.startPanXValue=function(xSpaceValue){if(this.paused){return false;}
var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);this.chartView.clearHighlight();var areaBound=graph.getAreaBound();this.panningStartValue=xSpaceValue;this.panStarted=true;this.panLevel=this.zoomLevel!=null?this.zoomLevel.slice(0):null;return true;};prototype.movePan=function(offsetX,offsetY){if(this.paused){return;}
this.panning=true;this.engineModel.updatePosition(offsetX,offsetY);var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(graph!=null&&this.panningStartValue!=null&&this.panLevel!=null&&this.originalPanSize!=null){var areaBound=graph.getAreaBound();var localXPosition=offsetX-areaBound.getContentLeft();var currentXSpaceValue=Math.round(this.engineModel.getXSpaceValueAt(this.chartView,localXPosition));var leftXSpaceValue=this.data.normalizedXValue2XSpace(this.panLevel[0]);var rightXSpaceValue=this.data.normalizedXValue2XSpace(this.panLevel[1]);var extremums=this.data.getExtremums();if(currentXSpaceValue!=null&&leftXSpaceValue!=null&&rightXSpaceValue!=null&&extremums!=null&&extremums[0]!=null&&extremums[1]!=null){var diffValue=currentXSpaceValue-this.panningStartValue;if(diffValue>0){rightXSpaceValue=rightXSpaceValue-diffValue;leftXSpaceValue=rightXSpaceValue-this.originalPanSize;}else if(diffValue<0){leftXSpaceValue=leftXSpaceValue-diffValue;rightXSpaceValue=leftXSpaceValue+this.originalPanSize;}else{return;}
var minValue=0;var maxValue=this.data.getTotalXSpace()-1;if(leftXSpaceValue<minValue){diffValue=leftXSpaceValue-minValue;rightXSpaceValue=rightXSpaceValue-diffValue;leftXSpaceValue=minValue;}
if(rightXSpaceValue>maxValue){diffValue=rightXSpaceValue-maxValue;rightXSpaceValue=maxValue;leftXSpaceValue=leftXSpaceValue-diffValue;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(leftXSpaceValue)/valueScale)*valueScale;var rightXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(rightXSpaceValue)/valueScale)*valueScale;var validRange=this.getValidXValueRange(leftXValue,rightXValue);if(validRange!=null&&!this.isRangeSameAs(this.panLevel,validRange)){if((diffValue>0&&validRange[1]==this.panLevel[1])||(diffValue<0&&validRange[0]==this.panLevel[0])){return;}
this.panningStartValue=currentXSpaceValue;this.panLevel=validRange;this.render(this.panLevel);this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}}}};prototype.movePanXValue=function(xSpaceValue){if(this.paused){return;}
this.panning=true;var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);if(graph!=null&&this.panningStartValue!=null&&this.panLevel!=null&&this.originalPanSize!=null){var areaBound=graph.getAreaBound();var currentXSpaceValue=xSpaceValue;var leftXSpaceValue=this.data.normalizedXValue2XSpace(this.panLevel[0]);var rightXSpaceValue=this.data.normalizedXValue2XSpace(this.panLevel[1]);var extremums=this.data.getExtremums();if(currentXSpaceValue!=null&&leftXSpaceValue!=null&&rightXSpaceValue!=null&&extremums!=null&&extremums[0]!=null&&extremums[1]!=null){var diffValue=currentXSpaceValue-this.panningStartValue;if(diffValue>0){rightXSpaceValue=rightXSpaceValue-diffValue;leftXSpaceValue=rightXSpaceValue-this.originalPanSize;}else if(diffValue<0){leftXSpaceValue=leftXSpaceValue-diffValue;rightXSpaceValue=leftXSpaceValue+this.originalPanSize;}else{return;}
var minValue=0.0;var maxValue=this.data.getTotalXSpace()-1.0;if(leftXSpaceValue<minValue){diffValue=leftXSpaceValue-minValue;rightXSpaceValue=rightXSpaceValue-diffValue;leftXSpaceValue=minValue;}
if(rightXSpaceValue>maxValue){diffValue=rightXSpaceValue-maxValue;rightXSpaceValue=maxValue;leftXSpaceValue=leftXSpaceValue-diffValue;}
var valueScale=this.data.getXSpaceValuesScale();var leftXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(leftXSpaceValue)/valueScale)*valueScale;var rightXValue=this.data.applySerieFloor(this.data.xSpace2NormalizedXValue(rightXSpaceValue)/valueScale)*valueScale;var validRange=this.getValidXValueRange(leftXValue,rightXValue);if(validRange!=null&&!this.isRangeSameAs(this.panLevel,validRange)){if((diffValue>0&&validRange[1]==this.panLevel[1])||(diffValue<0&&validRange[0]==this.panLevel[0])){return;}
this.panningStartValue=currentXSpaceValue;this.panLevel=validRange;this.render(this.panLevel);this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}}}};prototype.endPan=function(offsetX,offsetY){if(!this.paused&&this.panning){this.zoomLevel=this.panLevel;this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;this.engineModel.updatePosition(offsetX,offsetY);this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}else{this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;}};prototype.endPanXValue=function(xSpaceValue){if(!this.paused&&this.panning){this.zoomLevel=this.panLevel;this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;this.engineModel.updateRange(this.zoomLevel,this.chartView,this.data);}else{this.panStarted=false;this.panning=false;this.panningStartValue=null;this.panLevel=null;}};prototype.isPanning=function(){return this.panning;};prototype.saveZoomValue=function(){if(this.paused){return;}
var currentZoom=null;if(this.zoomLevel!=null){currentZoom=this.zoomLevel.slice(0);}
this.zoomHistory.push(currentZoom);};prototype.getValidXValueRange=function(startElement,endElement){if(startElement!=null&&endElement!=null){return[startElement,endElement];}else{return null;}};prototype.mouseAt=function(offsetX,offsetY){this.engineModel.updatePosition(offsetX,offsetY);if(!this.paused&&this.chartRendered){this.chartView.clearHighlight();this.engineModel.createInteractiveGraphics(this.chartView,this.data);this.chartView.showHighlight();}};prototype.click=function(offsetX,offsetY){if(!this.paused&&this.popOverAllowed){var currentIcont=this.chartView.findElementById(DefaultTitleEngine.ICON_ID);if(currentIcont!=null&&currentIcont.isInside(offsetX,offsetY)){this.mouseAt(null,null);this.openPopOver();}}};prototype.isChartRendered=function(){return this.chartRendered;};prototype.pause=function(){this.paused=true;};prototype.unpause=function(){this.paused=false;if(this.missedUpdate){this.refresh();}
this.chartView.clearHighlight();this.engineModel.createInteractiveGraphics(this.chartView,this.data);this.chartView.showHighlight();};prototype.openPopOver=function(){if(this.options.isPopOverAllowed()){ChartPopOver.getInstance().open(this);}};prototype.setZoomLevel=function(zoomLevel){this.zoomLevel=zoomLevel;if(zoomLevel!=null){this.originalPanSize=this.data.getCurrentXSpaceSize(zoomLevel);}else{this.originalPanSize=null;}};prototype.setZoomHistory=function(zoomHistory){this.zoomHistory=zoomHistory;};prototype.getZoomLevel=function(){return this.zoomLevel;};prototype.getPanLevel=function(){return this.panLevel;};prototype.getZoomHistory=function(){return this.zoomHistory;};prototype.isValidPositionForInteraction=function(offsetX,offsetY){var graph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);return graph!=null&&graph.isInside(offsetX,offsetY);};prototype.onResize=function(triggerRender){this.chartView.onResize();if(!this.waitUpdate&&triggerRender){this.render(this.zoomLevel);}};prototype.isPanStarted=function(){return this.panStarted;};prototype.isWaitUpdate=function(){return this.waitUpdate;};prototype.setWaitUpdate=function(waitUpdate){this.waitUpdate=waitUpdate;};},{zoomHistory:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},zoomLevel:{name:"Array",arguments:[null]},panLevel:{name:"Array",arguments:[null]},renderEndCallback:"Callback0",charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"ChartView",interactionModel:"AbstractInteractionModel"},{});
var ChartConstant=function(){};ChartConstant=stjs.extend(ChartConstant,null,[],function(constructor,prototype){constructor.ID="id";constructor.COLOR="color";constructor.WIDTH="width";constructor.HEIGHT="height";constructor.HIGHLIGHTED="highlighted";constructor.HIGHLIGHT_COLOR="highlightColor";constructor.HIGHLIGHT_WIDTH="highlightWidth";constructor.GROUPED="grouped";constructor.GROUP_COLOR="groupColor";constructor.GROUP_WIDTH="groupWidth";},{},{});
var PopOver=function(){};PopOver=stjs.extend(PopOver,null,[],function(constructor,prototype){prototype.open=function(trigger){};prototype.close=function(){};},{},{});
var ChartPopOver=function(){this.chartsParent=[];this.charts=[];this.overlay=$(window.document.createElement("div"));this.overlay.addClass(ChartPopOver.POPOVER_OVERLAY_CSS_CLASS);this.overlay.on("click",this.getOnCloseEventHandler());this.closeBox=$(window.document.createElement("div"));this.closeBox.addClass(ChartPopOver.POPOVER_CLOSE_BOX_CSS_CLASS);this.closeBox.on("click",this.getOnCloseEventHandler());this.chartwindow=$(window.document.createElement("div"));this.chartwindow.addClass(ChartPopOver.POPOVER_WINDOW_CSS_CLASS);this.wrapperElement=$(window.document.createElement("div"));this.wrapperElement.addClass(ChartPopOver.POPOVER_WRAPPER_CSS_CLASS);this.wrapperElement.append(this.overlay);this.wrapperElement.append(this.chartwindow);this.wrapperElement.append(this.closeBox);this.wrapperElement.css("visibility","hidden");$(window.document.body).append(this.wrapperElement);var width=this.chartwindow.width();var height=this.chartwindow.height();var marginLeftCorrection=Math.round(width/-2.0);var marginTopCorrection=Math.round(height/-2.0);this.chartwindow.css("margin-left",marginLeftCorrection);this.chartwindow.css("margin-top",marginTopCorrection);this.addChart(ChartPopOver.POPOVER_CHART_PARENT_CSS_CLASS);};ChartPopOver=stjs.extend(ChartPopOver,null,[PopOver],function(constructor,prototype){constructor.POPOVER_OVERLAY_CSS_CLASS="chart-popover-overlay";constructor.POPOVER_WINDOW_CSS_CLASS="chart-popover-window";constructor.POPOVER_CHART_PARENT_CSS_CLASS="chart-popover-parent";constructor.POPOVER_WRAPPER_CSS_CLASS="chart-popover-wrapper";constructor.POPOVER_CLOSE_BOX_CSS_CLASS="chart-popover-close-box";prototype.wrapperElement=null;prototype.overlay=null;prototype.chartwindow=null;prototype.closeBox=null;prototype.chartsParent=null;prototype.charts=null;constructor.instance=null;prototype.addChart=function(chartParentClass){var chartParent=$(window.document.createElement("div"));chartParent.addClass(chartParentClass);this.chartsParent.push(chartParent);this.chartwindow.append(chartParent);var optionsParam=SQW.$.extend(true,{},ChartOption.getDefault());optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);this.charts.push(new DefaultChart(chartParent,optionsParam));};prototype.removeChart=function(chartId){var chartParent=this.chartsParent.pop();chartParent.remove();};prototype.init=function(trigger){var initialSetting=trigger.getChartOption();var optionsParam=SQW.$.extend(true,{},initialSetting);optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setAnimateChart(false);optionsParam.setStyleModel(new DefaultStyleModel());optionsParam.setEngineModel(new DefaultEngineModel());optionsParam.setLayout(new DefaultLayout());var provider=DataProviderFactory.getInstance().getProvider(initialSetting);var newProvider=provider.clone();var providerClass="popOverProvider";DataProviderFactory.getInstance().registerProvider(providerClass,newProvider);optionsParam.setProviderClass(providerClass);var currentChart=this.charts[0];var chartParent=this.chartsParent[0];chartParent.empty();currentChart.init(chartParent,optionsParam);currentChart.setZoomLevel(trigger.getZoomLevel());};constructor.getInstance=function(){if(ChartPopOver.instance==null){ChartPopOver.instance=new ChartPopOver();}
return ChartPopOver.instance;};prototype.open=function(trigger){Chart.pauseAll();this.init(trigger);this.show();this.unpauseCharts();this.refreshCharts();};prototype.close=function(){this.hide();Chart.unpauseAll();this.pauseCharts();};prototype.show=function(){this.wrapperElement.css("visibility","visible");};prototype.hide=function(){this.wrapperElement.css("visibility","hidden");};prototype.getOnCloseEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){self.close();return false;},1);return eh;};prototype.pauseCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.pause();}}};prototype.unpauseCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.unpause();}}};prototype.refreshCharts=function(){var chartsCount=this.charts==null?0:this.charts.length;for(var i=0;i<chartsCount;i++){var chart=this.charts[i];if(chart!=null){chart.refresh();}}};},{wrapperElement:"SqwJQuery",overlay:"SqwJQuery",chartwindow:"SqwJQuery",closeBox:"SqwJQuery",chartsParent:{name:"Array",arguments:["SqwJQuery"]},charts:{name:"Array",arguments:["Chart"]},instance:"ChartPopOver"},{});
var ServerRequest=function(serieData){this.serieData=serieData;this.url=this.createURL(serieData);this.requestType="GET";this.params=null;};ServerRequest=stjs.extend(ServerRequest,null,[],function(constructor,prototype){constructor.WEB_SERVICE_PREFIX_URL_DEFAULT="/sqi_ws/";constructor.WEB_SERVICE_PREFIX_URL=ServerRequest.WEB_SERVICE_PREFIX_URL_DEFAULT;constructor.REQUEST_SUFFIX_CHAR_URL="?";constructor.REQUEST_AND_CHAR_URL="&";constructor.REQUEST_EQUALS_CHAR_URL="=";prototype.requestType=null;prototype.url=null;prototype.params=null;prototype.serieData=null;prototype.makeRequest=function(callback){var self=this;var xhr=new XMLHttpRequest();xhr.open(this.requestType,self.url,true);if('responseType'in xhr){xhr.responseType='arraybuffer';};var c1=(xhr)["overrideMimeType"];if((typeof c1)!="undefined"){xhr.overrideMimeType('text/plain; charset=x-user-defined');}else{xhr.setRequestHeader("Accept-Charset","x-user-defined");}
if(this.requestType=="POST"){xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");}
xhr.setRequestHeader("SQ_REQUEST_SOURCE","application");var callbackSuccess=self.getSuccessCallback(callback);var callbackError=function(p1,p2,p3){callback(null,null);};xhr.onreadystatechange=function(){if(xhr.readyState!=4){return;}
if(xhr.status!=200){callbackError(null,null,null);}else{var responseType=(xhr)["responseType"];if((typeof responseType)!="undefined"&&responseType=="arraybuffer"){var content=(xhr)["response"];if((typeof content)=="undefined"){content=new VBArray(this.responseBody).toArray();}
callbackSuccess(self.arrayBuffer2BinaryString(content),xhr.statusText,xhr);}else if(typeof(ie_version)!=='undefined'&&ie_version==8){callbackSuccess(BinaryToString(xhr.responseBody),xhr.statusText,xhr);}else{callbackSuccess(xhr.responseText,xhr.statusText,xhr);}}};xhr.send(this.params);};prototype.arrayBuffer2BinaryString=function(arrayBuffer){if(arrayBuffer!=null){var binaryString="";var typedBytesArray=new Uint8Array(arrayBuffer);var length=typedBytesArray.length;for(var i=0;i<length;i++){binaryString+=String.fromCharCode(typedBytesArray[i]);}
return binaryString;}else{return null;}};constructor.getBaseURL=function(){return window.location.protocol+"//"+window.location.host;};prototype.getSuccessCallback=function(callback){};prototype.createURL=function(serieData){};prototype.addUrlParam=function(paramName,paramValue){if(this.url!=null&&paramName!=null&&paramValue!=null){this.url+="&"+paramName+"="+paramValue;}};prototype.addPostParam=function(paramName,paramValue){if(paramName!=null&&paramValue!=null){if(this.params==null){this.params=paramName+"="+paramValue;}else{this.params+="&"+paramName+"="+paramValue;}}};constructor.setServicePrefix=function(prefix){ServerRequest.WEB_SERVICE_PREFIX_URL=prefix;};},{},{});
var PriceServletRequest=function(serie){ServerRequest.call(this,serie);};PriceServletRequest=stjs.extend(PriceServletRequest,ServerRequest,[],function(constructor,prototype){constructor.HEADER_FIELD_KEY_PREFIX="key_";constructor.SERVLET_URL="PriceServlet?";prototype.createURL=function(serie){var urlPrefix=ServerRequest.WEB_SERVICE_PREFIX_URL;if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+PriceServletRequest.SERVLET_URL;var serieStock=serie.getStock();if(serieStock!=null){currentURL+="format=full&isin="+serieStock.getIsin()+"&currency="+serieStock.getCurrency()+"&exchangeId="+serieStock.getStockExchangeId()+"&start="+serie.getValidLength();}
currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var dataString=data;if(data!=null){var index=data.indexOf("\n");dataString=data.substring(index+1);}
callback(dataString,null);};};},{},{});
var MultiIntradayServletRequest=function(series){ServerRequest.call(this,series);};MultiIntradayServletRequest=stjs.extend(MultiIntradayServletRequest,ServerRequest,[],function(constructor,prototype){constructor.MAX_INTRADAY=6;constructor.HEADER_FIELD_KEY_PREFIX="key_";constructor.SERVLET_URL="MultipleIntradayServlet?";prototype.createURL=function(series){var urlPrefix=this.getWebServicePrefixUrl();if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+MultiIntradayServletRequest.SERVLET_URL;var keyCount=series.length;var keysString=series[0].getKey();for(var i=1;i<keyCount;i++){keysString=keysString+","+series[i].getKey();}
var mainSerie=series!=null?series[0]:null;if(mainSerie!=null&&mainSerie.getPeriod()!=null){var dayVal=mainSerie.getPeriod().getValue();if(dayVal<=0||isNaN(dayVal)){dayVal=1;}else if(dayVal>MultiIntradayServletRequest.MAX_INTRADAY){dayVal=MultiIntradayServletRequest.MAX_INTRADAY;}
currentURL+="days="+dayVal;currentURL+="&freq="+this.getFrequencyValue(mainSerie.getPeriod().getFrequency());}
currentURL+="&format=pipe&keys="+keysString+"&version=10.0";currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getWebServicePrefixUrl=function(){return ServerRequest.WEB_SERVICE_PREFIX_URL;};prototype.getFrequencyValue=function(frequency){if(frequency==null||frequency.isLive()){return"";}else if(frequency.getType()==Frequency.Type.SECOND){return String.valueOf(Math.ceil(frequency.getValue()/60.0));}else if(frequency.getType()==Frequency.Type.MINUTE){return String.valueOf(frequency.getValue());}else if(frequency.getType()==Frequency.Type.HOUR){return String.valueOf(frequency.getValue()*60);}else{return"";}};prototype.getSuccessCallback=function(callback){var self=this;return function(data,textStatus,jqXHR){var responseText=data;var metadata=[];var serieCount=self.serieData.length;for(var i=0;i<serieCount;i++){var currentKeyId=MultiIntradayServletRequest.HEADER_FIELD_KEY_PREFIX+self.serieData[i].getKey();var t=jqXHR.getResponseHeader(currentKeyId);metadata[currentKeyId]=t;}
callback(responseText,metadata);};};},{},{});
var HistoServletRequest=function(serie){ServerRequest.call(this,serie);};HistoServletRequest=stjs.extend(HistoServletRequest,ServerRequest,[],function(constructor,prototype){constructor.HEADER_FIELD_VOLUME_MULTIPLIER="volumeMultiplier";constructor.HEADER_FIELD_OPEN_PERIOD="open_period";constructor.SERVLET_URL="HistoFromServlet?";constructor.HISTO_MINUTES_OFFSET_REFERENCE=720;prototype.createURL=function(serie){var period=serie.getPeriod();var lastPoint=serie.getLastPoint();var key=serie.getKey();var urlPrefix=ServerRequest.WEB_SERVICE_PREFIX_URL;if(!urlPrefix.toLowerCase().startsWith("http")){urlPrefix=ServerRequest.getBaseURL()+urlPrefix;}
var currentURL=urlPrefix+HistoServletRequest.SERVLET_URL;var freq=period.getFrequency();currentURL+="format=pipe&key="+key;currentURL+="&ftype="+Frequency.typeToString(freq.getType());currentURL+="&fvalue="+freq.getValue();currentURL+="&ptype="+Period.typeToRequestParameterString(period.getType());currentURL+="&pvalue="+period.getValue();var lastValue=null;var lastTime=null;if(lastPoint!=null){lastValue=lastPoint[Serie.Y];lastTime=lastPoint[Serie.X];}
if(lastValue!=null&&!isNaN(lastValue)&&lastTime!=null&&!isNaN(lastTime)){currentURL+="&lastDate="+HistoServletRequest.localTime2ServerTimeSeconds(lastTime);currentURL+="&lastClose="+(lastValue).toFixed(2);}
currentURL+="&_="+new Date().getTime();return currentURL;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var responseText=data;var openPeriodsString=jqXHR.getResponseHeader(HistoServletRequest.HEADER_FIELD_OPEN_PERIOD);var volumeMultiplierString=jqXHR.getResponseHeader(HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER);var metadata=[];metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD]=openPeriodsString;metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]=volumeMultiplierString;callback(responseText,metadata);};};constructor.getLocaleCorrectionTimeOffset=function(){return stjs.trunc(((HistoServletRequest.HISTO_MINUTES_OFFSET_REFERENCE+new Date().getTimezoneOffset())*DateUtil.MS_MINUTE));};constructor.localTime2ServerTimeSeconds=function(localeTime){localeTime=localeTime-HistoServletRequest.getLocaleCorrectionTimeOffset();return Math.round(localeTime/DateUtil.MS_SECOND);};},{},{});
var LocalFileAjaxRequest=function(relativePath,serieData){ServerRequest.call(this,serieData);this.url=this.url+relativePath;};LocalFileAjaxRequest=stjs.extend(LocalFileAjaxRequest,ServerRequest,[],function(constructor,prototype){prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var responseText=data;callback(responseText,null);};};prototype.createURL=function(serie){return ServerRequest.getBaseURL();};},{},{});
var PipeDelimitedDataProcessor=function(){};PipeDelimitedDataProcessor=stjs.extend(PipeDelimitedDataProcessor,null,[],function(constructor,prototype){constructor.NEW_LINE="\n";constructor.DELIMITER="|";prototype.process=function(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs){var points=[];if(PipeDelimitedDataProcessor.isNumberInvalid(totaTimeOffsetMs)){totaTimeOffsetMs=0;}
var pointLines=(pipeDelimitedString).split(PipeDelimitedDataProcessor.NEW_LINE);if(elementNumber==null){elementNumber=pointLines.length-lineOffset;}
for(var i=0;i<elementNumber;i++){var pointIndex=i+lineOffset;var pointLine=pointLines[pointIndex];var point={};var pointLineSplitted=(pointLine).split(PipeDelimitedDataProcessor.DELIMITER);if(pointLineSplitted.length!=6){break;}
var fieldIndex=0;var timeFromServlet=pointLineSplitted[fieldIndex++];var timeFromServletMs=this.convertDateFromServletToMilliseconds(timeFromServlet,stockTimeZone);var timeFromServletWithOffsetMs=timeFromServletMs+totaTimeOffsetMs;point[Serie.X]=timeFromServletWithOffsetMs;var high=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.HIGH]=high>0?high:null;var low=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.LOW]=low>0?low:null;var open=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.OPEN]=open>0?open:null;var close=Double.parseDouble(pointLineSplitted[fieldIndex++]);point[FinancialSerie.CLOSE]=close>0?close:null;var volume=Integer.parseInt(pointLineSplitted[fieldIndex++]);point[FinancialSerie.VOLUME]=PipeDelimitedDataProcessor.isNumberInvalid(volume)?0:volume;points[i]=point;}
return points;};prototype.convertDateFromServletToMilliseconds=function(dateFromServlet,timeZone){var year=dateFromServlet.substring(0,4);var month=dateFromServlet.substring(4,6);var day=dateFromServlet.substring(6,8);var isoDate=year+"-"+month+"-"+day;if(dateFromServlet.length==14){var hour=dateFromServlet.substring(8,10);var minute=dateFromServlet.substring(10,12);var second=dateFromServlet.substring(12,14);var timeZoneString=this.getTimeZoneString(timeZone);isoDate+="T"+hour+":"+minute+":"+second+timeZoneString;}
return stjs.trunc(new Date(isoDate).getTime());};prototype.getTimeZoneString=function(timeZone){var timeZoneAbs=stjs.trunc(Math.abs(timeZone));var timeZoneString=timeZone<0?"-":"+";timeZoneString+=timeZoneAbs<10?"0"+timeZoneAbs:timeZoneAbs;timeZoneString+=":";timeZoneString+=timeZone==Math.floor(timeZone)?"00":"30";return timeZoneString;};constructor.isNumberInvalid=function(number){if(number==null||isNaN(number)){return true;}
return false;};},{},{});
var DataProvider=function(){this.id=new Date().getTime()+"_provider_"+Math.round((Math.random()*100000));this.cache=Cache.getInstance();};DataProvider=stjs.extend(DataProvider,null,[],function(constructor,prototype){prototype.id=null;prototype.cache=null;prototype.config=null;prototype.chartData=null;prototype.getData=function(chartData){};prototype.updateConfig=function(config){};prototype.getChartData=function(){return this.chartData;};prototype.setChartData=function(chartData){this.chartData=chartData;};prototype.getConfig=function(){return this.config;};prototype.setConfig=function(config){this.config=config;};prototype.getCache=function(){return this.cache;};prototype.setCache=function(cache){this.cache=cache;};prototype.clone=function(){};prototype.getId=function(){return this.id;};},{cache:"Cache",config:"ChartOption"},{});
var MobileServiceDataProvider=function(config){DataProvider.call(this);this.requestId=0;this.retryCount=0;this.currentReturnedRequestNumber=0;this.currentValiditySecond=MobileServiceDataProvider.DEFAULT_INTRADAY_DATA_VALIDITY_SECONDS;this.retrySetDataCallback=null;this.paused=false;this.newDataFlag=false;this.localTimeZoneOffsetMs=stjs.trunc((new Date().getTimezoneOffset()*DateUtil.MS_MINUTE));this.dataProcessor=new PipeDelimitedDataProcessor();var self=this;this.autorefreshFunction=function(){if(self.lastData!=null&&self.lastData.getProvider()!=null&&self.lastData.getProvider().getId()==self.id){self.getData(self.lastData);}};this.onRequestCompleteCallback=function(requestType,requestId,data,series){if(data!=null){if(requestType!=MobileServiceDataProvider.LIVE_REQUEST_ID){data.setSeries(series);}else{var mainSerie=series!=null?series[0]:null;if(mainSerie!=null){data.setSeries([mainSerie.getAggregatedSerie()]);}else{data.setSeries(series);}}}};this.updateConfig(config);this.startAutorefreshTimer();};MobileServiceDataProvider=stjs.extend(MobileServiceDataProvider,DataProvider,[],function(constructor,prototype){constructor.INTRADAY_REQUEST_ID="intraday";constructor.LIVE_REQUEST_ID="live";constructor.HISTO_REQUEST_ID="histo";constructor.HEADER_FIELDS_SEPARATOR="|";constructor.MAX_RETRY_COUNT=5;constructor.RETRY_INTERVAL_MS=2000;constructor.DEFAULT_INTRADAY_DATA_VALIDITY_SECONDS=60;constructor.HISTO_DATA_VALIDITY_HOURS=2;constructor.BID_ASK_VALIDITY_MINUTES=5;prototype.refreshTimer=null;prototype.autorefreshInterval=null;prototype.paused=false;prototype.requestId=0;prototype.retryCount=0;prototype.currentReturnedRequestNumber=0;prototype.retrySetDataCallback=null;prototype.autorefreshFunction=null;prototype.lastData=null;prototype.currentValiditySecond=0;prototype.onRequestCompleteCallback=null;prototype.newDataFlag=false;prototype.stocks=null;prototype.localTimeZoneOffsetMs=0;prototype.dataProcessor=null;prototype.getData=function(data){if(data==null){return;}
clearTimeout(this.refreshTimer);this.lastData=data;this.requestId++;this.retryCount=0;this.currentReturnedRequestNumber=0;var series=this.getNewSeries(data);var invalidSeries=[];var lineOffset=1;var serieCount=series!=null?series.length:0;var nowTime=new Date().getTime();var mainSerie=series!=null?series[0]:null;for(var i=0;i<serieCount;i++){var currentSerie=series[i];var validity=currentSerie.getValidity();if(validity==null||validity.getTime()<nowTime){var mainData=this.cache.get(currentSerie.getDataId(this.config.getWidthParam()));var metadataString=this.cache.get(currentSerie.getMetadataId(this.config.getWidthParam()));if(mainData!=null&&metadataString!=null){if(this.isBidAskSerie(currentSerie)){var validityFromCacheTime=parseInt(metadataString);if(!isNaN(validityFromCacheTime)&&validityFromCacheTime>=nowTime){var points=this.getBidAskPoints(mainData);currentSerie.setData(points,new Date(validityFromCacheTime),null);}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}else{var validityEndIndex=mainData.indexOf(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);var validityFromCache=mainData.substring(0,validityEndIndex);var validityFromCacheTime=parseInt(validityFromCache);var metadata=(metadataString).split(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);if(validityFromCacheTime>=nowTime){var elementNumber=null;var totaTimeOffsetMs=0;var stockTimeZone=parseFloat(metadata[3]);if(currentSerie.getPeriod().isIntraday()){var stockTimeZoneOffsetMs=stjs.trunc(Math.round(stockTimeZone*DateUtil.MS_HOUR));if(isNaN(stockTimeZoneOffsetMs)){stockTimeZoneOffsetMs=0;}
if(i==0&&currentSerie.getId()==mainSerie.getId()){totaTimeOffsetMs=stockTimeZoneOffsetMs+this.localTimeZoneOffsetMs;data.setMainSerieTimeOffsetMs(totaTimeOffsetMs);}else{totaTimeOffsetMs=data.getMainSerieTimeOffsetMs();}
metadata.push(String.valueOf(totaTimeOffsetMs));elementNumber=parseInt(metadata[1]);}else{var openPeriodString=metadata[0];var volumeMultiplierString=metadata[1];totaTimeOffsetMs=HistoServletRequest.getLocaleCorrectionTimeOffset();metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD]=openPeriodString;metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]=volumeMultiplierString;}
var pipeDelimitedString=mainData.substring(validityEndIndex+1);var points=this.dataProcessor.process(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs);lineOffset+=elementNumber;currentSerie.setData(points,new Date(validityFromCacheTime),metadata);}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}}else{this.cache.remove(currentSerie.getDataId(this.config.getWidthParam()));this.cache.remove(currentSerie.getMetadataId(this.config.getWidthParam()));invalidSeries.push(currentSerie);}}}
this.doCurrentRequest(data,invalidSeries,series);this.startAutorefreshTimer();};prototype.doCurrentRequest=function(data,invalidSeries,series){var mainSerie=series!=null?series[0]:null;if(mainSerie!=null&&this.isBidAskSerie(mainSerie)){this.doAllBidAskRequest(data,invalidSeries,series);}else if(mainSerie!=null&&mainSerie.getPeriod().isIntraday()){this.doAllMultiIntradayServletRequest(data,invalidSeries,series);}else{this.doAllHistoServletRequests(data,series);}};prototype.isBidAskSerie=function(serie){return serie!=null&&serie.getType()==Chart.ChartType.BID_ASK;};prototype.startAutorefreshTimer=function(){if(this.autorefreshInterval!=null&&!this.paused){clearTimeout(this.refreshTimer);this.refreshTimer=setTimeout(this.autorefreshFunction,this.autorefreshInterval);}};prototype.pauseAutorefreshTimer=function(){clearTimeout(this.refreshTimer);this.paused=true;};prototype.unpauseAutorefreshTimer=function(){this.paused=false;this.startAutorefreshTimer();};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.stocks=config.getStocks();this.autorefreshInterval=config.getAutorefreshIntervalSeconds();if(this.autorefreshInterval!=null){this.autorefreshInterval=this.autorefreshInterval*1000;}};prototype.getNewSeries=function(data){if(data==null){return null;}
var keysCount=this.stocks!=null?this.stocks.length:0;var colorStrategy=this.config.getColorStrategy();var addYesterday=this.config.isAddYesterday();var series=data.getSeries();var newSeries=[];for(var i=0;i<keysCount;i++){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var currentStock=this.stocks[i];var currentDataSerie=(series!=null)?series[i]:null;if(currentStock!=null&&currentDataSerie==null||currentDataSerie.getDataId(this.config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,this.config.getWidthParam())){if(period.isIntraday()){if((period.isLive()&&Chart.ChartType.valueOf(this.config.getType())==Chart.ChartType.POINT)||(currentStock.isSwissDotsMarket())){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(this.config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newBidAskSerie;}else{var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(this.config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newIntradaySerie;}}else{var newHistoSerie=new HistoSerie(period,null,currentStock);newHistoSerie.setColor(this.config.getDefaultHistoColor());currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
newSeries[i]=currentDataSerie;}
return newSeries;};prototype.doAllMultiIntradayServletRequest=function(data,invalidSeries,series){this.requestId++;var currentRequestId=this.requestId;this.newDataFlag=true;if(invalidSeries.length>0){this.doMultiIntradayServletRequest(data,invalidSeries,series,currentRequestId);}else{this.onRequestCompleteCallback(MobileServiceDataProvider.INTRADAY_REQUEST_ID,currentRequestId,data,series);}};prototype.doMultiIntradayServletRequest=function(data,invalidSeries,series,currentRequestId){this.retryCount=0;var self=this;var request=this.createServletRequest(invalidSeries);var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(binaryString,metadataArray){if(self.requestId==currentRequestId){if(binaryString==null&&metadataArray==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.setIntradaySeriesData(binaryString,series,invalidSeries,metadataArray,data,self.currentValiditySecond);self.onRequestCompleteCallback(MobileServiceDataProvider.INTRADAY_REQUEST_ID,currentRequestId,data,series);}}};this.retrySetDataCallback=setDataCallback;request.addUrlParam("px",this.config.getWidthParam());request.makeRequest(setDataCallback);};prototype.createServletRequest=function(series){return new MultiIntradayServletRequest(series);};prototype.doAllHistoServletRequests=function(data,series){this.requestId++;this.retryCount=0;this.currentReturnedRequestNumber=0;this.newDataFlag=false;var currentRequestId=this.requestId;var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];this.doHistoServletRequest(data,currentSerie,currentRequestId,serieCount,series);}};prototype.doHistoServletRequest=function(data,serie,currentRequestId,totalRequestNumber,series){var self=this;var request=new HistoServletRequest(serie);var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(binaryString,metadata){if(self.requestId==currentRequestId){if(binaryString==null&&metadata==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.currentReturnedRequestNumber++;self.updateHistoSerieData(binaryString,serie,metadata,MobileServiceDataProvider.HISTO_DATA_VALIDITY_HOURS);if(self.currentReturnedRequestNumber>=totalRequestNumber){self.onRequestCompleteCallback(MobileServiceDataProvider.HISTO_REQUEST_ID,currentRequestId,data,series);}}}};this.retrySetDataCallback=setDataCallback;request.makeRequest(setDataCallback);};prototype.doAllBidAskRequest=function(data,invalidSeries,series){this.requestId++;this.newDataFlag=false;var currentRequestId=this.requestId;var mainSerie=series!=null?series[0]:null;var bidAskSerie=mainSerie!=null?(mainSerie).getMainSerie():null;this.doBidAskRequest(data,bidAskSerie,currentRequestId);};prototype.doBidAskRequest=function(data,bidAskSerie,currentRequestId){var self=this;var request=new PriceServletRequest(bidAskSerie);this.retryCount=0;var retryCallback=function(){if(self.requestId==currentRequestId){request.makeRequest(self.retrySetDataCallback);}};var setDataCallback=function(linesString,metadataNull){if(self.requestId==currentRequestId){if(linesString==null&&self.retryCount<MobileServiceDataProvider.MAX_RETRY_COUNT){self.retryCount++;setTimeout(retryCallback,MobileServiceDataProvider.RETRY_INTERVAL_MS);}else{self.updateBidAskSerieData(linesString,bidAskSerie,MobileServiceDataProvider.BID_ASK_VALIDITY_MINUTES);self.onRequestCompleteCallback(MobileServiceDataProvider.LIVE_REQUEST_ID,currentRequestId,data,[bidAskSerie]);}}};this.retrySetDataCallback=setDataCallback;request.makeRequest(setDataCallback);};prototype.setIntradaySeriesData=function(pipeDelimitedString,allSeries,fetchedSeries,metadataArray,data,validitySeconds){if(pipeDelimitedString!=null&&fetchedSeries!=null&&metadataArray!=null){var serieCount=fetchedSeries.length;var validity=DateUtil.getDateAfter(new Date(),validitySeconds,DateUtil.MS_SECOND);var validityTime=validity.getTime();var mainSerie=allSeries!=null?allSeries[0]:null;var lineOffset=1;for(var i=0;i<serieCount;i++){var currentSerie=fetchedSeries[i];if(currentSerie!=null&&currentSerie.getKey()!=null){var id=MultiIntradayServletRequest.HEADER_FIELD_KEY_PREFIX+currentSerie.getKey();var currentSerieMetadata=metadataArray[id];if(currentSerieMetadata!=null){var metadata=(currentSerieMetadata).split(MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR);var elementNumber=parseInt(metadata[1]);var stockTimeZone=parseFloat(metadata[3]);var stockTimeZoneOffsetMs=stjs.trunc(Math.round(stockTimeZone*DateUtil.MS_HOUR));var totaTimeOffsetMs=0;if(i==0&&currentSerie.getId()==mainSerie.getId()){totaTimeOffsetMs=stockTimeZoneOffsetMs+this.localTimeZoneOffsetMs;data.setMainSerieTimeOffsetMs(totaTimeOffsetMs);}else{totaTimeOffsetMs=data.getMainSerieTimeOffsetMs();}
metadata.push(String.valueOf(totaTimeOffsetMs));if(!isNaN(elementNumber)){var points=this.dataProcessor.process(pipeDelimitedString,lineOffset,elementNumber,stockTimeZone,totaTimeOffsetMs);currentSerie.setData(points,validity,metadata);var validityPrefix=validityTime+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR;var dataString=validityPrefix+pipeDelimitedString;this.cache.set(currentSerie.getDataId(this.config.getWidthParam()),dataString);this.cache.set(currentSerie.getMetadataId(this.config.getWidthParam()),currentSerieMetadata);lineOffset+=elementNumber;}}}}}};prototype.updateHistoSerieData=function(pipeDelimitedString,serie,metadata,validityHours){if(pipeDelimitedString!=null&&pipeDelimitedString!=""&&serie!=null&&serie.getKey()!=null&&metadata!=null){var validity=DateUtil.getDateAfter(new Date(),validityHours,DateUtil.MS_HOUR);var stockTimeOffsetMs=HistoServletRequest.getLocaleCorrectionTimeOffset();var points=this.dataProcessor.process(pipeDelimitedString,1,null,0.0,stockTimeOffsetMs);var openPeriodString=metadata[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD];var volumeMultiplierString=metadata[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER];var metadataString=openPeriodString+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR+volumeMultiplierString;var isAppended=false;if(serie.isEmpty()){serie.setData(points,validity,metadata);}else{if(serie.getValidity()!=null){validity=serie.getValidity();}
isAppended=serie.appendData(points,serie.getValidity(),metadata);}
var validityTime=validity.getTime();if(isAppended){this.cache.append(serie.getDataId(this.config.getWidthParam()),pipeDelimitedString);}else{var validityPrefix=validityTime+MobileServiceDataProvider.HEADER_FIELDS_SEPARATOR;var dataString=validityPrefix+pipeDelimitedString;this.cache.set(serie.getDataId(this.config.getWidthParam()),dataString);}
this.cache.set(serie.getMetadataId(this.config.getWidthParam()),metadataString);this.newDataFlag=true;}};prototype.updateBidAskSerieData=function(linesString,serie,validityTimeMinutes){if(linesString!=null&&linesString!=""&&serie!=null&&serie.getKey()!=null){var points=this.getBidAskPoints(linesString);if(points.length>0){var validity=DateUtil.getDateAfter(new Date(),validityTimeMinutes,DateUtil.MS_MINUTE);var validityTime=validity.getTime();var validityMetadata=String.valueOf(validityTime);if(serie.isEmpty()){serie.setData(points,validity,null);}else{serie.appendData(points,validity,null);}}
this.newDataFlag=true;}};prototype.getBidAskPoints=function(linesString){var lines=(linesString).split("\n");var points=[];for(var index in lines){if(!(lines).hasOwnProperty(index))
continue;var line=lines[index];if(line!=null){var elements=(line).split("|");if(elements!=null&&elements.length>=5){var point={};point[BidAskSerie.ASK]=parseFloat(elements[0]);point[BidAskSerie.BID]=parseFloat(elements[1]);point[BidAskSerie.LAST_VOLUME]=parseFloat(elements[2]);point[BidAskSerie.LAST]=parseFloat(elements[3]);point[BidAskSerie.LAST_TIME]=elements[4];points.push(point);}}}
return points;};prototype.clone=function(){return new MobileServiceDataProvider(this.config);};},{refreshTimer:"TimeoutHandler",retrySetDataCallback:{name:"Callback2",arguments:[null,{name:"Array",arguments:[null]}]},autorefreshFunction:"Callback0",onRequestCompleteCallback:{name:"Callback4",arguments:[null,null,"D",{name:"Array",arguments:["S"]}]},stocks:{name:"Array",arguments:["Stock"]},dataProcessor:"PipeDelimitedDataProcessor",cache:"Cache",config:"ChartOption"},{});
var LocalFileDataProvider=function(config){DataProvider.call(this);this.updateConfig(config);};LocalFileDataProvider=stjs.extend(LocalFileDataProvider,DataProvider,[],function(constructor,prototype){prototype.requestId=0;prototype.currentReturnedRequestNumber=0;prototype.urls=null;prototype.getData=function(data){if(data==null){return;}
var series=this.getNewSeries(data);this.doAllRequests(data,series);};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.urls=config.getUrls();if(this.urls==null&&config.getUrl()!=null){this.urls=[config.getUrl()];}};prototype.getNewSeries=function(data){this.updateConfig(this.config);var urlsCount=this.urls!=null?this.urls.length:0;var colorStrategy=null;var newSeries=[];for(var i=0;i<urlsCount;i++){var currentDataSerie=new IndexedSerie(colorStrategy,1);newSeries[i]=currentDataSerie;}
return newSeries;};prototype.doAllRequests=function(data,series){this.requestId++;this.currentReturnedRequestNumber=0;var currentRequestId=this.requestId;var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];this.doRequest(data,currentSerie,currentRequestId,serieCount,i,series);}};prototype.doRequest=function(data,serie,requestId,totalRequestNumber,urlIndex,series){var self=this;var setDataCallback=function(binaryString,metadata){if(self.requestId==requestId){self.currentReturnedRequestNumber++;self.setSerieData(binaryString,serie,metadata);if(self.currentReturnedRequestNumber>=totalRequestNumber){data.setSeries(series);}}};var request=new LocalFileAjaxRequest(this.urls[urlIndex],serie);request.makeRequest(setDataCallback);};prototype.setSerieData=function(returnedString,serie,metadata){if(returnedString!=null&&serie!=null){var points=null;points=$.parseJSON(returnedString);serie.setData(points,null,metadata);}};prototype.clone=function(){return new LocalFileDataProvider(this.config);};},{urls:{name:"Array",arguments:[null]},cache:"Cache",config:"ChartOption"},{});
var RawDataProvider=function(config){DataProvider.call(this);this.updateConfig(config);};RawDataProvider=stjs.extend(RawDataProvider,DataProvider,[],function(constructor,prototype){prototype.seriesPoints=null;prototype.serieType=null;prototype.getData=function(chartData){var seriesCount=this.seriesPoints!=null?this.seriesPoints.length:0;var colorStrategy=this.config.getColorStrategy();var series=[];var currentDataSerie=null;var stocks=[];if(this.config.getStocks()!=null){stocks=this.config.getStocks();}
for(var i=0;i<seriesCount;i++){if(this.serieType=="time"){currentDataSerie=new TimeSerie(colorStrategy,1);}else if(this.serieType=="histo"){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var histoSerie=new HistoSerie(period,null,stocks[i]);histoSerie.setStepSize(1);currentDataSerie=histoSerie;}else if(this.serieType=="intraday"){var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());var intradaySerie=new IntradaySerie(period,colorStrategy,stocks[i],this.config.isAddYesterday());intradaySerie.setXSpaceScale(1);currentDataSerie=intradaySerie;}else{currentDataSerie=new IndexedSerie(colorStrategy,1);}
currentDataSerie.setData(this.seriesPoints[i],null,null);series[i]=currentDataSerie;}
chartData.setSeries(series);};prototype.updateConfig=function(config){this.config=config;if(config==null){return;}
this.seriesPoints=config.getData();this.serieType=config.getRawDataType();};prototype.clone=function(){return new RawDataProvider(this.config);};},{seriesPoints:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},cache:"Cache",config:"ChartOption"},{});
var DataProviderFactory=function(){this.providers={};};DataProviderFactory=stjs.extend(DataProviderFactory,null,[],function(constructor,prototype){constructor.instance=null;prototype.providers=null;constructor.getInstance=function(){if(DataProviderFactory.instance==null){DataProviderFactory.instance=new DataProviderFactory();}
return DataProviderFactory.instance;};prototype.registerProvider=function(key,dp){if(key!=null&&dp!=null){var trimmedKey=key.trim();this.providers[trimmedKey]=dp;}};prototype.getProvider=function(config){var key=config.getProviderName().trim();var dp=this.providers[key];if(dp!=null){dp.setConfig(config);dp.updateConfig(config);}
return dp;};prototype.removeProvider=function(config){var key=config.getProviderName().trim();if(key!=null){delete this.providers[key];}};prototype.retriveProvider=function(key){var dp=this.providers[key];return dp;};},{instance:"DataProviderFactory",providers:{name:"Map",arguments:[null,"DataProvider"]}},{});
var Serie=function(colorStrategy,xSpaceScale,stepSize,indexed){this.colorStrategy=colorStrategy;this.id=Serie.SERIE_ID_PREFIX+new Date().getTime()+String.valueOf(Math.round((Math.random()*100000)));this.enabled=true;this.xSpaceScale=xSpaceScale;this.stepSize=stepSize;this.indexed=indexed;this.dashed=false;this.interactionAllowed=true;this.mainField=Serie.Y;this.aggregationStrategy=AggregationStrategy.MIN_MAX;this.type=null;this.logScale=false;this.mainFields=[this.mainField];};Serie=stjs.extend(Serie,null,[],function(constructor,prototype){constructor.SERIE_ID_PREFIX="serie_";constructor.X="x";constructor.Y="y";constructor.CHANGE="change";constructor.CHANGE_PERCENT="changePercent";prototype.id=null;prototype.name=null;prototype.points=null;prototype.enabled=false;prototype.logScale=false;prototype.interactionAllowed=false;prototype.validity=null;prototype.colorStrategy=null;prototype.xSpaceScale=0;prototype.stepSize=0;prototype.indexed=false;prototype.mainField=null;prototype.aggregationStrategy=null;prototype.color=null;prototype.dashed=false;prototype.type=null;prototype.mainFields=null;prototype.setData=function(points,validity,metadataArray){this.points=points;this.validity=validity;};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null){this.setData(newPoints,newValidity,metadataArray);return false;}else{this.points=this.points.concat(newPoints);this.validity=newValidity;return true;}};prototype.computeChangeValues=function(which){if(which==null){if(this.mainField!=null){which=this.mainField;}else{which=Serie.Y;}}
var referenceValue=this.getReferenceValue();if(referenceValue==null){return;}else if(referenceValue==0){referenceValue=1.0;}
var serieCount=this.getLength();for(var i=0;i<serieCount;i++){var currentPoint=this.points[i];var change=currentPoint!=null?currentPoint[which]:null;if(change!=null&&!isNaN(change)){change-=referenceValue;var changePercent=(100*change/Math.abs(referenceValue));currentPoint[Serie.CHANGE]=change;currentPoint[Serie.CHANGE_PERCENT]=changePercent;}else if(currentPoint!=null){currentPoint[Serie.CHANGE]=null;currentPoint[Serie.CHANGE_PERCENT]=null;}}};prototype.getValue=function(i,which){if(this.points!=null&&this.points.length>0&&i!=null&&i>=0&&i<this.points.length){var point=this.points[i];if(point!=null){return point[which];}}
return null;};prototype.getValueAsDouble=function(i,which){return this.getValue(i,which);};prototype.getValueAsInteger=function(i,which){return this.getValue(i,which);};prototype.getLastPoint=function(){if(this.points!=null&&this.points.length>0){return this.points[this.points.length-1];}
return null;};prototype.getLastPointValue=function(which){if(this.points!=null&&this.points.length>0){return this.points[this.points.length-1][which];}
return null;};prototype.getPoint=function(i){if(this.points!=null&&this.points.length>0&&i>=0&&i<this.points.length){return this.points[i];}
return null;};prototype.removeAllPoints=function(){this.points=[];};prototype.addPoint=function(i,point){if(i==null){return;}
if(this.points==null){this.points=[];}
this.points.splice(i,0,point);};prototype.addValue=function(i,value){if(i==null){return;}
if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points.splice(i,0,point);};prototype.setValue=function(i,value){if(i==null){return;}
if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points[i]=point;};prototype.pushPoint=function(point){if(this.points==null){this.points=[];}
this.points.push(point);};prototype.pushValue=function(value){if(this.points==null){this.points=[];}
var point={};point[Serie.Y]=value;this.points.push(point);};prototype.getStepSize=function(){return this.stepSize;};prototype.getXSpaceScale=function(){return this.xSpaceScale;};prototype.isIndexed=function(){return this.indexed;};prototype.getAggregateValuesFromRange=function(strat,first,last,whichSerieValue){switch(strat){case AggregationStrategy.FIRST:return[this.getValueAsDouble(first,whichSerieValue)];case AggregationStrategy.LAST:return[this.getValueAsDouble(last,whichSerieValue)];case AggregationStrategy.FIRST_LAST:var firstValue=this.getValueAsDouble(first,whichSerieValue);var lastValue=this.getValueAsDouble(last,whichSerieValue);return[firstValue,lastValue];case AggregationStrategy.MEDIAN:var middle=Math.round((first+last)/2.0);return[this.getValueAsDouble(middle,whichSerieValue)];case AggregationStrategy.AVERAGE:var aggregatedValue=0.0;var aggregateCount=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){aggregatedValue+=currentValue;aggregateCount++;}}
if(aggregateCount>0){return[(aggregatedValue/aggregateCount)];}else{return null;}
case AggregationStrategy.MIN:var currentMin=Double.POSITIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;}}
if(currentMin!=Double.POSITIVE_INFINITY){return[currentMin];}else{return null;}
case AggregationStrategy.MAX:var currentMax=Double.NEGATIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;}}
if(currentMax!=Double.NEGATIVE_INFINITY){return[currentMax];}else{return null;}
case AggregationStrategy.SUM:var sum=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){sum+=currentValue;}}
return[sum];case AggregationStrategy.MIN_MAX:currentMin=Double.POSITIVE_INFINITY;currentMax=Double.NEGATIVE_INFINITY;var iMin=0;var iMax=0;for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;iMin=i;}
if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;iMax=i;}}
if(currentMin!=Double.POSITIVE_INFINITY&&currentMax!=Double.NEGATIVE_INFINITY){if(iMin<iMax){return[currentMin,currentMax];}else{return[currentMax,currentMin];}}else{return null;}
case AggregationStrategy.NONE:default:var values=[];for(var i=first;i<=last;i++){var currentValue=this.getValueAsDouble(i,whichSerieValue);if(currentValue!=null){values.push(currentValue);}}
return values.length>0?values:null;}};constructor.points2Value=function(points,index,mainField){if(points==null){return null;}else if(points[index]!=null){return points[index][mainField];}else{return null;}};constructor.getAggregateValuesFromPoints=function(strat,points,whichSerieValue){if(points==null||points.length<=0){return null;}else if(points.length==1){return[Serie.points2Value(points,0,whichSerieValue)];}else{}
var first=0;var last=points.length-1;switch(strat){case AggregationStrategy.FIRST:return[Serie.points2Value(points,first,whichSerieValue)];case AggregationStrategy.LAST:return[Serie.points2Value(points,last,whichSerieValue)];case AggregationStrategy.FIRST_LAST:var firstValue=Serie.points2Value(points,first,whichSerieValue);var lastValue=Serie.points2Value(points,last,whichSerieValue);return[firstValue,lastValue];case AggregationStrategy.MEDIAN:var middle=Math.round((first+last)/2.0);return[Serie.points2Value(points,middle,whichSerieValue)];case AggregationStrategy.AVERAGE:var aggregatedValue=0.0;var aggregateCount=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){aggregatedValue+=currentValue;aggregateCount++;}}
if(aggregateCount>0){return[(aggregatedValue/aggregateCount)];}else{return null;}
case AggregationStrategy.MIN:var currentMin=Double.POSITIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;}}
if(currentMin!=Double.POSITIVE_INFINITY){return[currentMin];}else{return null;}
case AggregationStrategy.MAX:var currentMax=Double.NEGATIVE_INFINITY;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;}}
if(currentMax!=Double.NEGATIVE_INFINITY){return[currentMax];}else{return null;}
case AggregationStrategy.SUM:var sum=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){sum+=currentValue;}}
return[sum];case AggregationStrategy.MIN_MAX:currentMin=Double.POSITIVE_INFINITY;currentMax=Double.NEGATIVE_INFINITY;var iMin=0;var iMax=0;for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null&&currentValue<currentMin){currentMin=currentValue;iMin=i;}
if(currentValue!=null&&currentValue>currentMax){currentMax=currentValue;iMax=i;}}
if(currentMin!=Double.POSITIVE_INFINITY&&currentMax!=Double.NEGATIVE_INFINITY){if(iMin<iMax){return[currentMin,currentMax];}else{return[currentMax,currentMin];}}else{return null;}
case AggregationStrategy.NONE:default:var values=[];for(var i=first;i<=last;i++){var currentValue=Serie.points2Value(points,i,whichSerieValue);if(currentValue!=null){values.push(currentValue);}}
return values.length>0?values:null;}};prototype.getXValue=function(i){};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){var indices=this.getCorrespondingIndices(context,currentPos,width,exactPosition);if(indices==null||indices.length<=0){return null;}else if(indices.length==1){return[this.getValueAsDouble(indices[0],whichSerieValue)];}else{var first=indices[0];var last=indices[1];return this.getAggregateValuesFromRange(aggregationStrategy,first,last,whichSerieValue);}};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){};prototype.getIndexAtOrAfterXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexAtOrAfterXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexAtOrAfterXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexAtOrBeforeXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexAtOrBeforeXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexAtOrBeforeXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexClosestToXValue=function(xValue,xScale,startIndex,endIndex){};prototype.findIndexClosestToXValue=function(xValue){var maxIndex=this.getLength()-1;if(maxIndex>=0){return this.getIndexClosestToXValue(xValue,this.xSpaceScale,0,maxIndex);}else{return null;}};prototype.getIndexAroundXValue=function(xValue,xScale,startIndex,endIndex){};prototype.getIndexAtXValue=function(xValue,xScale,startIndex,endIndex){};prototype.getFirstValidIndexWithSameXValue=function(index,xScale){};prototype.isEmpty=function(){return(this.points==null||this.points.length==0);};prototype.getColor=function(){if(this.color!=null){return this.color;}else{return(this.colorStrategy!=null)?this.colorStrategy.getColor():null;}};prototype.setColor=function(color){this.color=color;};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getReferenceValue=function(){return this.getFirstValidValue(0,Serie.Y);};prototype.getColorStrategy=function(){return this.colorStrategy;};prototype.setColorStrategy=function(colorStrategy){this.colorStrategy=colorStrategy;};prototype.getLength=function(){return(this.points==null)?0:this.points.length;};prototype.getId=function(){return this.id;};prototype.isEnabled=function(){return this.enabled;};prototype.setEnabled=function(enabled){this.enabled=enabled;};prototype.isInteractionAllowed=function(){return this.interactionAllowed;};prototype.setInteractionAllowed=function(interactionAllowed){this.interactionAllowed=interactionAllowed;};prototype.getValidity=function(){return this.validity;};prototype.getStartXValue=function(){return this.getXValue(0);};prototype.getAbsoluteStartXValue=function(){return this.getStartXValue();};prototype.getFirstXValue=function(){return this.getXValue(0);};prototype.getEndXValue=function(){return this.getLastXValue();};prototype.getAbsoluteEndXValue=function(){return this.getEndXValue();};prototype.getLastXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(index>=0){return this.getXValue(index);}
return null;};prototype.setXAxisFormatsAndSteps=function(formats,steps){};prototype.getPointColors=function(){var res=[];for(var i=0;i<this.points.length;i++){var p=this.points[i];var color=p["color"];if(color!=null){var c=new Color(color).getColor();if(res.indexOf(c)==-1){res.push(c);}}}
return res;};prototype.getPoints=function(){return this.points;};prototype.setPoints=function(points){this.points=points;};prototype.setStepSize=function(stepSize){this.stepSize=stepSize;};prototype.setXSpaceScale=function(xSpaceScale){this.xSpaceScale=xSpaceScale;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getXType=function(){var pointsCount=this.getLength();for(var i=0;i<pointsCount;i++){var value=this.getValue(i,Serie.X);if(value!=null){return Formatter.getObjectXType(value);}}
return null;};prototype.getMainField=function(){return this.mainField;};prototype.getMainFields=function(){return this.mainFields;};prototype.setMainField=function(mainField){this.mainField=mainField;};prototype.setMainFields=function(mainFields){this.mainFields=mainFields;};prototype.getAggregationStrategy=function(){return this.aggregationStrategy;};prototype.setAggregationStrategy=function(aggregationStrategy){this.aggregationStrategy=aggregationStrategy;};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.isLogScale=function(){return this.logScale;};prototype.setLogScale=function(logScale){this.logScale=logScale;};prototype.getFirstValidValue=function(startIndex,which){if(startIndex==null||isNaN(startIndex)){startIndex=0;}
var possibleValue=this.getValueAsDouble(startIndex,which);var firstValidIndex=startIndex+1;var length=this.getLength();while(firstValidIndex<length&&(possibleValue==null||isNaN(possibleValue))){possibleValue=this.getValueAsDouble(firstValidIndex,which);firstValidIndex++;}
return possibleValue;};prototype.getLastValidValue=function(startIndex,which){if(startIndex==null||isNaN(startIndex)){startIndex=0;}
var possibleValue=this.getValueAsDouble(startIndex,which);var firstValidIndex=startIndex-1;while(firstValidIndex>=0&&(possibleValue==null||isNaN(possibleValue))){possibleValue=this.getValueAsDouble(firstValidIndex,which);firstValidIndex--;}
return possibleValue;};prototype.getXValueFloor=function(value){return Math.floor(value);};prototype.getXValueRound=function(value){return Math.round(value);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});;
var FinancialSerie=function(){};FinancialSerie=stjs.extend(FinancialSerie,null,[],function(constructor,prototype){constructor.CLOSE="y";constructor.HIGH="high";constructor.LOW="low";constructor.OPEN="open";constructor.VOLUME="volume";constructor.DATA_ID_PREFIX="serie_";constructor.METADATA_ID_PREFIX="meta_";prototype.setMetadata=function(metadataArray){};prototype.getPeriod=function(){};prototype.setStock=function(stock){};prototype.getStock=function(){};prototype.getKey=function(){};prototype.getDataId=function(pixelCount){};prototype.getMetadataId=function(pixelCount){};prototype.createDataId=function(key,period,pixelCount){};prototype.createMetadataId=function(key,period,pixelCount){};prototype.isIntraday=function(){};prototype.setForcedInterval=function(first,last){};},{},{});
var IndexedSerie=function(colorStrategy,stepSize){Serie.call(this,colorStrategy,1,stepSize==null?1:stepSize,true);};IndexedSerie=stjs.extend(IndexedSerie,Serie,[],function(constructor,prototype){prototype.getXValue=function(i){return i;};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){var serieStartIndex=context.getMinIndex(this.id,Serie.X);serieStartIndex=(serieStartIndex==null)?0:serieStartIndex;var serieEndIndex=context.getMaxIndex(this.id,Serie.X);serieEndIndex=(serieEndIndex==null)?(this.getLength()-1):serieEndIndex;var pointsPerPixel=((serieEndIndex-serieStartIndex+1.0)/width);if(!exactPosition&&currentPos<0){currentPos=0;}
if(!exactPosition&&currentPos>=width){currentPos=width-1;}
if(pointsPerPixel>1){var first=Math.round(serieStartIndex+(pointsPerPixel*currentPos));var last=Math.round(serieStartIndex-1+(pointsPerPixel*(currentPos+1)));if(last>serieEndIndex){last=serieEndIndex;}
if(!exactPosition&&first>serieEndIndex){return[serieEndIndex];}
if(first<serieStartIndex){first=serieStartIndex;}
if(!exactPosition&&last<serieStartIndex){return[serieStartIndex];}
if(last<first){return null;}
return[first,last];}else if(pointsPerPixel<1){if(currentPos<=0){return[serieStartIndex];}
pointsPerPixel=((serieEndIndex-serieStartIndex)/(width-1.0));var previousIndex=serieStartIndex+(pointsPerPixel*(currentPos-1));var currentIndex=serieStartIndex+(pointsPerPixel*currentPos);var nextIndex=serieStartIndex+(pointsPerPixel*(currentPos+1));var previousIndexRounded=Math.round(previousIndex);var currentIndexRounded=Math.round(currentIndex);var indexRounded=currentIndexRounded;if(currentIndexRounded==previousIndexRounded&&Math.abs(indexRounded-previousIndex)<Math.abs(indexRounded-currentIndex)){indexRounded++;}
if(indexRounded>serieEndIndex){indexRounded=serieEndIndex;}
if(Math.abs(indexRounded-currentIndex)<Math.abs(indexRounded-nextIndex)){return[indexRounded];}else if(!exactPosition){return[currentIndexRounded];}else{return null;}}else{var currentIndex=serieStartIndex+currentPos;return[currentIndex];}};prototype.getIndexAtOrAfterXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getIndexAtOrBeforeXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getIndexClosestToXValue=function(xValue,xScale,startIndex,endIndex){return this.getIndexAroundXValue(xValue,xScale,startIndex,endIndex);};prototype.getIndexAroundXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getIndexAtXValue=function(xValue,xScale,startIndex,endIndex){return xValue;};prototype.getFirstValidIndexWithSameXValue=function(index,xScale){return index;};prototype.setXAxisFormatsAndSteps=function(formats,steps){formats.push(["2"]);steps.push([this.xSpaceScale]);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var TimeSerie=function(colorStrategy,xSpaceStep){Serie.call(this,colorStrategy,xSpaceStep,1,false);};TimeSerie=stjs.extend(TimeSerie,Serie,[],function(constructor,prototype){constructor.DATE_VALUE="x";prototype.getXValue=function(i){return this.getValueAsDouble(i,Serie.X);};prototype.getCorrespondingIndices=function(context,currentPos,width,exactPosition){var serieStartIndex=context.getMinIndex(this.id,Serie.X);var serieEndIndex=context.getMaxIndex(this.id,Serie.X);serieStartIndex=(serieStartIndex==null)?0:serieStartIndex;if(serieEndIndex==null||serieEndIndex>=this.getLength()){serieEndIndex=this.getLength()-1;}
if(!exactPosition&&currentPos<0){currentPos=0;}
if(!exactPosition&&currentPos>=width){currentPos=width-1;}
var xSpaceValue=context.getXSpaceValueAtPosition(currentPos,width);var nextXSpaceValue=context.getXSpaceValueAtPosition(currentPos+1,width);var currentXValue=this.getXValueFloor(context.getData().xSpace2NormalizedXValue(xSpaceValue)/this.xSpaceScale)*this.xSpaceScale;var nextXValue=this.getXValueFloor(context.getData().xSpace2NormalizedXValue(nextXSpaceValue)/this.xSpaceScale)*this.xSpaceScale;var startIndex=this.getIndexAtOrAfterXValue(currentXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);var endIndex=this.getIndexAtOrBeforeXValue(nextXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);if(startIndex==null||endIndex==null||endIndex<startIndex){if(exactPosition){return null;}else{startIndex=this.getIndexClosestToXValue(currentXValue,this.xSpaceScale,serieStartIndex,serieEndIndex);if(startIndex!=null){return[startIndex];}else{return null;}}}else if(startIndex==endIndex){return[startIndex];}else{return[startIndex,endIndex];}};prototype.getIndexAtOrAfterXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=Double.NEGATIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=startIndex){timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtPreviousStartIndex>=searchedIndexTime){return previousStartIndex;}else if(timeAtIndex>=searchedIndexTime){return startSearchIndex;}else{return(nextStartIndex!=null&&nextStartIndex<=endIndex)?nextStartIndex:null;}};prototype.getIndexAtOrBeforeXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtNextStartIndex=Double.POSITIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(nextStartIndex!=null&&nextStartIndex<=endIndex){timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtNextStartIndex<=searchedIndexTime){return nextStartIndex;}else if(timeAtIndex<=searchedIndexTime){return startSearchIndex;}else{return(previousStartIndex!=null&&previousStartIndex>=startIndex)?previousStartIndex:null;}};prototype.getIndexClosestToXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtStartIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=0;var timeAtNextStartIndex=0;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex<startIndex){previousStartIndex=startIndex;}
if(nextStartIndex>endIndex){nextStartIndex=endIndex;}
timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);var currentDiff=Math.abs(searchedIndexTime-timeAtStartIndex);var previousDiff=Math.abs(searchedIndexTime-timeAtPreviousStartIndex);var nextDiff=Math.abs(searchedIndexTime-timeAtNextStartIndex);if(previousDiff<=currentDiff&&previousDiff<=nextDiff){return this.getFirstValidIndexWithSameXValue(previousStartIndex,timeScale);}else if(currentDiff<=nextDiff){return startSearchIndex;}else{return nextStartIndex;}};prototype.getIndexAroundXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var index=-1;var startSearchIndex=startIndex;var endSearchIndex=endIndex;if(timeMilliseconds==null||startSearchIndex==null||endSearchIndex==null||startSearchIndex>endSearchIndex||timeScale==0){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);while(startSearchIndex<endSearchIndex){index=Math.floor((startSearchIndex+endSearchIndex)/2.0);var timeAtIndex=this.getXValueRound(this.getValueAsDouble(index,TimeSerie.DATE_VALUE)/timeScale);if(timeAtIndex==searchedIndexTime){return index;}else if(searchedIndexTime-timeAtIndex>0){startSearchIndex=index+1;}else{endSearchIndex=index-1;}}
return startSearchIndex;};prototype.getFirstValidIndexWithSameXValue=function(index,timeScale){if(index==0){return index;}
var timeAtPreviousIndex=-1;var searchedTime=-2;var dateValue=this.getValueAsDouble(index,TimeSerie.DATE_VALUE);var previousElementIndex=index-1;var previousDateValue=this.getValueAsDouble(previousElementIndex,TimeSerie.DATE_VALUE);if(dateValue!=null&&previousDateValue!=null&&timeScale!=0){searchedTime=this.getXValueRound(dateValue/timeScale);timeAtPreviousIndex=this.getXValueRound(previousDateValue/timeScale);}else{return dateValue!=null?index:null;}
while(timeAtPreviousIndex==searchedTime&&index>0){index--;previousElementIndex=index-1;if(previousElementIndex>=0){previousDateValue=this.getValueAsDouble(previousElementIndex,TimeSerie.DATE_VALUE);timeAtPreviousIndex=this.getXValueRound(previousDateValue/timeScale);}}
return index;};prototype.getIndexAtXValue=function(timeMilliseconds,timeScale,startIndex,endIndex){var startSearchIndex=this.getIndexAroundXValue(timeMilliseconds,timeScale,startIndex,endIndex);if(startSearchIndex==null){return null;}
var searchedIndexTime=this.getXValueRound(timeMilliseconds/timeScale);var timeAtStartIndex=this.getXValueRound(this.getValueAsDouble(startSearchIndex,TimeSerie.DATE_VALUE)/timeScale);var timeAtPreviousStartIndex=-1;var timeAtNextStartIndex=-1;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=startIndex){timeAtPreviousStartIndex=this.getXValueRound(this.getValueAsDouble(previousStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(nextStartIndex!=null&&nextStartIndex<=endIndex){timeAtNextStartIndex=this.getXValueRound(this.getValueAsDouble(nextStartIndex,TimeSerie.DATE_VALUE)/timeScale);}
if(timeAtPreviousStartIndex==searchedIndexTime){return this.getFirstValidIndexWithSameXValue(previousStartIndex,timeScale);}else if(timeAtStartIndex==searchedIndexTime){return startSearchIndex;}else if(timeAtNextStartIndex==searchedIndexTime){return nextStartIndex;}else{return null;}};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndStepsFromStepValue(this.xSpaceScale,formats,steps);};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var HistoSerie=function(period,colorStrategy,stock){IndexedSerie.call(this,colorStrategy,DateUtil.MS_DAY_24H);this.key=stock!=null?stock.getKey():"";this.name=stock!=null?stock.getSymbol():"";this.stock=stock;this.period=period;if(period!=null&&period.getFrequency()!=null){this.stepSize=period.getFrequency().getTimeValue();}
this.volumeMultiplier=null;this.forcedFirstIndex=null;this.forcedLastIndex=null;};HistoSerie=stjs.extend(HistoSerie,IndexedSerie,[FinancialSerie],function(constructor,prototype){prototype.key=null;prototype.stock=null;prototype.period=null;prototype.volumeMultiplier=null;prototype.referenceValue=null;prototype.forcedFirstIndex=null;prototype.forcedLastIndex=null;prototype.setData=function(points,validity,metadataArray){Serie.prototype.setData.call(this,points,validity,metadataArray);this.setMetadata(metadataArray);this.updateVolumeByMultiplier(points,this.volumeMultiplier);this.dropPointsOutsidePeriod();if(this.forcedFirstIndex==null||this.forcedLastIndex==null){this.referenceValue=this.getFirstValidValue(0,Serie.Y);this.forcedFirstIndex=null;this.forcedLastIndex=null;}};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null||!this.isDateFlowCorrect(this.points,newPoints)){this.setData(newPoints,newValidity,metadataArray);return false;}else{var superResult=Serie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);this.setMetadata(metadataArray);this.dropPointsOutsidePeriod();this.updateVolumeByMultiplier(newPoints,this.volumeMultiplier);return superResult;}};prototype.dropPointsOutsidePeriod=function(){if(this.points==null||this.period==null||this.period.getFrom()==null||this.period.getTo()==null){return;}
var minXValFromPeriod=this.period.getFrom().getTime();var maxXValFromPeriod=this.period.getTo().getTime();var startValidIndex=0;var endValidIndex=this.getLength()>0?this.getLength()-1:0;var length=this.getLength();for(var i=0;i<length;i++){var xVal=this.getValue(i,Serie.X);if(xVal!=null&&xVal<minXValFromPeriod){startValidIndex=i+1;}
if(xVal!=null&&xVal<=maxXValFromPeriod){endValidIndex=i;}}
this.points=this.points.slice(startValidIndex,endValidIndex+1);};prototype.isDateFlowCorrect=function(oldPoints,newPoints){if(oldPoints==null||newPoints==null){return false;}else if(oldPoints.length==0||newPoints.length==0){return true;}else{var oldPointsLastPoint=oldPoints[oldPoints.length-1];var newPointsFirstPoint=newPoints[0];if(oldPointsLastPoint==null||newPointsFirstPoint==null){return false;}else{var oldPointsLastDateValue=oldPointsLastPoint[Serie.X];var newPointsFirstDateValue=newPointsFirstPoint[Serie.X];return oldPointsLastDateValue!=null&&newPointsFirstDateValue!=null&&newPointsFirstDateValue>oldPointsLastDateValue;}}};prototype.updateVolumeByMultiplier=function(points,multiplier){if(multiplier!=null&&!isNaN(multiplier)){var pointCount=points.length;for(var i=0;i<pointCount;i++){var point=points[i];if(point!=null&&point[FinancialSerie.VOLUME]!=null){var initialVolume=point[FinancialSerie.VOLUME];initialVolume=initialVolume*multiplier;point[FinancialSerie.VOLUME]=initialVolume;}}}};prototype.setMetadata=function(metadataArray){if(metadataArray!=null){this.volumeMultiplier=parseInt(metadataArray[HistoServletRequest.HEADER_FIELD_VOLUME_MULTIPLIER]);if(isNaN(this.volumeMultiplier)){this.volumeMultiplier=1;}
var openPeriod=metadataArray[HistoServletRequest.HEADER_FIELD_OPEN_PERIOD];this.period.setOpenPeriods(openPeriod);}};prototype.getColor=function(){if(this.color!=null){return this.color;}
if(this.points==null||this.points.length==0){return this.colorStrategy.getColor();}
var isPositive=this.points[this.points.length-1][Serie.Y]>=this.getReferenceValue();if(isPositive){return this.colorStrategy.getPositiveColor();}else{return this.colorStrategy.getNegativeColor();}};prototype.getReferenceValue=function(){return this.referenceValue;};prototype.getPeriod=function(){return this.period;};prototype.getKey=function(){return this.key;};prototype.getDataId=function(pixelCount){return this.createDataId(this.key,this.period,"");};prototype.getMetadataId=function(pixelCount){return this.createMetadataId(this.key,this.period,"");};prototype.createDataId=function(key,period,pixelCount){return FinancialSerie.DATA_ID_PREFIX+key+"_"+period.getId();};prototype.createMetadataId=function(key,period,pixelCount){return FinancialSerie.METADATA_ID_PREFIX+key+"_"+period.getId();};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndSteps(this.period,formats,steps);};prototype.isIntraday=function(){return false;};prototype.getVolumeMultiplier=function(){return this.volumeMultiplier;};prototype.getStock=function(){return this.stock;};prototype.setStock=function(stock){this.stock=stock;};prototype.getStartXValue=function(){if(this.forcedFirstIndex!=null){return this.getXValue(this.forcedFirstIndex);}else{return this.getXValue(0);}};prototype.getAbsoluteStartXValue=function(){return this.getXValue(0);};prototype.getEndXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(this.forcedLastIndex!=null){return this.getXValue(this.forcedLastIndex);}else if(index>=0){return this.getXValue(index);}else{return null;}};prototype.getAbsoluteEndXValue=function(){var index=(this.points!=null)?this.points.length-1:-1;if(index>=0){return this.getXValue(index);}else{return null;}};prototype.setForcedInterval=function(first,last){this.forcedFirstIndex=stjs.trunc(Math.round(first));if(this.forcedFirstIndex!=null){this.referenceValue=this.getFirstValidValue(this.forcedFirstIndex,Serie.Y);}
this.forcedLastIndex=stjs.trunc(Math.round(last));};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IntradaySerie=function(period,colorStrategy,stock,addYesterday){TimeSerie.call(this,colorStrategy,DateUtil.MS_SECOND);this.key=stock!=null?stock.getKey():"";this.name=stock!=null?stock.getSymbol():this.key;this.stock=stock;this.period=period;this.addYesterday=addYesterday;this.stretchLeftSide=false;this.stretchRightSide=false;this.yesterdayPointAdded=false;};IntradaySerie=stjs.extend(IntradaySerie,TimeSerie,[FinancialSerie],function(constructor,prototype){prototype.key=null;prototype.stock=null;prototype.period=null;prototype.timeOffset=null;prototype.referencePrice=null;prototype.addYesterday=false;prototype.yesterdayPointAdded=false;prototype.stretchLeftSide=false;prototype.stretchRightSide=false;prototype.forcedStart=null;prototype.forcedEnd=null;prototype.setData=function(points,validity,metadataArray){Serie.prototype.setData.call(this,points,validity,metadataArray);this.setMetadata(metadataArray);if(this.addYesterday&&points!=null&&points.length>0&&this.period!=null&&!this.period.spanSeveralDays()&&this.referencePrice!=null&&!isNaN(this.referencePrice)&&this.period.getFrom()!=null&&this.period.getTo()!=null){this.addPoint(0,IntradaySerie.createReferencePricePoint(this.period.getFrom().getTime(),this.referencePrice));this.yesterdayPointAdded=true;}};prototype.appendData=function(newPoints,newValidity,metadataArray){if(this.points==null){this.setData(newPoints,newValidity,metadataArray);return false;}else{var superResult=Serie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);this.setMetadata(metadataArray);return superResult;}};prototype.getReferenceValue=function(){return(this.referencePrice==null||isNaN(this.referencePrice))?Serie.prototype.getReferenceValue.call(this):this.referencePrice;};prototype.setMetadata=function(metadataArray){if(metadataArray==null){return;}
this.referencePrice=parseFloat(metadataArray[2]);var openPeriodsString=metadataArray[5];this.timeOffset=stjs.trunc(parseInt(metadataArray[metadataArray.length-1]));if(this.period!=null){this.period.setTimeOffset(this.timeOffset);this.period.setOpenPeriods(openPeriodsString);}};constructor.createReferencePricePoint=function(xValue,price){var referencePoint={};referencePoint[TimeSerie.DATE_VALUE]=xValue;referencePoint[Serie.Y]=price;referencePoint[FinancialSerie.HIGH]=price;referencePoint[FinancialSerie.LOW]=price;referencePoint[FinancialSerie.OPEN]=price;referencePoint[FinancialSerie.VOLUME]=0;return referencePoint;};prototype.getPeriod=function(){return this.period;};prototype.getStartXValue=function(){if(this.forcedStart!=null){return this.forcedStart;}else if((!this.stretchLeftSide||isNaN(this.getFirstXValue()))&&this.period!=null&&this.period.getFrom()!=null){return this.period.getFrom().getTime();}else{return this.getFirstXValue();}};prototype.getAbsoluteStartXValue=function(){if((!this.stretchLeftSide||isNaN(this.getFirstXValue()))&&this.period!=null&&this.period.getFrom()!=null){return this.period.getFrom().getTime();}
return this.getFirstXValue();};prototype.getEndXValue=function(){if(this.forcedEnd!=null){return this.forcedEnd;}else if((!this.stretchRightSide||this.getLastXValue()==null||isNaN(this.getLastXValue()))&&this.period!=null&&this.period.getTo()!=null){return this.period.getTo().getTime();}else{return this.getLastXValue();}};prototype.getAbsoluteEndXValue=function(){if((!this.stretchRightSide||this.getLastXValue()==null||isNaN(this.getLastXValue()))&&this.period!=null&&this.period.getTo()!=null){return this.period.getTo().getTime();}
return this.getLastXValue();};prototype.getKey=function(){return this.key;};prototype.getDataId=function(pixelCount){return this.createDataId(this.key,this.period,pixelCount);};prototype.getMetadataId=function(pixelCount){return this.createMetadataId(this.key,this.period,pixelCount);};prototype.createDataId=function(key,period,pixelCount){return FinancialSerie.DATA_ID_PREFIX+key+"_"+period.getId()+"_"+pixelCount;};prototype.createMetadataId=function(key,period,pixelCount){return FinancialSerie.METADATA_ID_PREFIX+key+"_"+period.getId()+"_"+pixelCount;};prototype.setXAxisFormatsAndSteps=function(formats,steps){DateUtil.setXAxisFormatsAndSteps(this.period,formats,steps);};prototype.isIntraday=function(){return true;};prototype.isStretchLeftSide=function(){return this.stretchLeftSide;};prototype.setStretchLeftSide=function(stretchLeftSide){this.stretchLeftSide=stretchLeftSide;};prototype.isStretchRightSide=function(){return this.stretchRightSide;};prototype.setStretchRightSide=function(stretchRightSide){this.stretchRightSide=stretchRightSide;};prototype.getTimeOffset=function(){return this.timeOffset;};prototype.getStock=function(){return this.stock;};prototype.setStock=function(stock){this.stock=stock;};prototype.setForcedInterval=function(first,last){this.forcedStart=first;this.forcedEnd=last;};constructor.toRegularFrequency=function(mainSerie){var mainPeriod=mainSerie!=null?mainSerie.getPeriod():null;if(mainPeriod==null||!(mainPeriod.isLive()||(mainPeriod.isIntraday()&&mainPeriod.getValue()>MultiIntradayServletRequest.MAX_INTRADAY))||mainPeriod.getFrom()==null||mainPeriod.getTo()==null){return mainSerie;}
var mainSerieI=mainSerie;var regularSerie=new IntradaySerie(mainSerieI.period,mainSerieI.colorStrategy,mainSerieI.stock,false);regularSerie.referencePrice=mainSerieI.referencePrice;regularSerie.timeOffset=mainSerieI.timeOffset;regularSerie.stretchLeftSide=mainSerieI.stretchLeftSide;regularSerie.stretchRightSide=mainSerieI.stretchRightSide;regularSerie.forcedStart=mainSerieI.forcedStart;regularSerie.forcedEnd=mainSerieI.forcedEnd;regularSerie.color=mainSerieI.color;regularSerie.mainField=mainSerieI.mainField;regularSerie.mainFields=mainSerieI.mainFields!=null?mainSerieI.mainFields.slice(0):null;var regularPoints=null;if(mainSerieI.getMainField()==BidAskSerie.LAST){regularPoints=IntradaySerie.getAggregatedPointsBidAsk(mainSerieI,mainPeriod);}else{regularPoints=IntradaySerie.getAggregatedPointsIntraday(mainSerieI,mainPeriod);}
regularSerie.setData(regularPoints,DateUtil.cloneDate(mainSerieI.validity),null);return regularSerie;};constructor.getAggregatedPointsBidAsk=function(mainSerieI,mainPeriod){var currentHigh=mainSerieI.referencePrice;if(mainPeriod.spanSeveralDays()&&mainSerieI.getStock()!=null&&!mainSerieI.getStock().isSwissDotsMarket()){currentHigh=mainSerieI.getFirstValidValue(0,BidAskSerie.LAST);}
var currentLow=currentHigh;var currentOpen=currentHigh;var currentClose=currentHigh;var currentVolume=0;var accuHigh=currentHigh;var accuLow=currentHigh;var accuOpen=currentHigh;var accuClose=currentHigh;var accuVolume=0;var accuCount=0;var startIndex=0;if(mainSerieI.yesterdayPointAdded){startIndex=1;}
var length=mainSerieI.getLength();var regularPoints=[];var accuX=mainPeriod.getFrom().getTime();var maxTime=mainPeriod.getTo().getTime();if(maxTime<accuX){var tmp=accuX;accuX=maxTime;maxTime=tmp;}
var point=null;var currentXValue=null;var lastArray=null;var index=startIndex;var xStep=DateUtil.MS_MINUTE;if(mainPeriod.getFrequency()!=null&&mainPeriod.getFrequency().getTimeValue()>0){xStep=mainPeriod.getFrequency().getTimeValue();}
var middlePointCorrection=Math.round(xStep/2.0);while(accuX<=maxTime&&index<length){var nextAccuX=mainPeriod.getNextValueInPeriod(accuX,xStep);accuHigh=Double.NEGATIVE_INFINITY;accuLow=Double.POSITIVE_INFINITY;accuVolume=0;accuCount=0;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;lastArray=point!=null?point[BidAskSerie.LAST_ARRAY]:null;accuOpen=lastArray!=null?lastArray[0]:null;while((currentXValue==null||currentXValue<nextAccuX)&&index<length){if(currentXValue!=null&&lastArray!=null&&lastArray.length>0){for(var i in lastArray){if(!(lastArray).hasOwnProperty(i))
continue;accuClose=lastArray[i];if(accuClose!=null&&!isNaN(accuClose)){if(accuClose>accuHigh){accuHigh=accuClose;}
if(accuClose<accuLow){accuLow=accuClose;}
accuCount++;}}
accuVolume+=point[FinancialSerie.VOLUME];}
index++;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;lastArray=point!=null?point[BidAskSerie.LAST_ARRAY]:null;}
if(accuCount>0){currentHigh=accuHigh;currentLow=accuLow;currentOpen=accuOpen;currentClose=accuClose;currentVolume=accuVolume;}
var accuPoint={};accuPoint[Serie.X]=accuX+middlePointCorrection;accuPoint[FinancialSerie.HIGH]=currentHigh;accuPoint[FinancialSerie.LOW]=currentLow;accuPoint[FinancialSerie.OPEN]=currentOpen;accuPoint[FinancialSerie.CLOSE]=currentClose;accuPoint[FinancialSerie.VOLUME]=currentVolume;regularPoints.push(accuPoint);accuX=nextAccuX;}
return regularPoints;};constructor.getAggregatedPointsIntraday=function(mainSerieI,mainPeriod){var currentHigh=mainSerieI.referencePrice;if(mainPeriod.spanSeveralDays()){currentHigh=mainSerieI.getFirstValidValue(0,FinancialSerie.CLOSE);}
var currentLow=currentHigh;var currentOpen=currentHigh;var currentClose=currentHigh;var currentVolume=0;var accuHigh=currentHigh;var accuLow=currentHigh;var accuOpen=currentHigh;var accuClose=currentHigh;var accuVolume=0;var accuCount=0;var startIndex=0;if(mainSerieI.yesterdayPointAdded){startIndex=1;}
var length=mainSerieI.getLength();var regularPoints=[];var accuX=mainPeriod.getFrom().getTime();var maxTime=mainPeriod.getTo().getTime();if(maxTime<accuX){var tmp=accuX;accuX=maxTime;maxTime=tmp;}
var point=null;var currentXValue=null;var index=startIndex;var xStep=DateUtil.MS_MINUTE;if(mainPeriod.getFrequency()!=null&&mainPeriod.getFrequency().getTimeValue()>0){xStep=mainPeriod.getFrequency().getTimeValue();}
var middlePointCorrection=Math.round(xStep/2.0);while(accuX<=maxTime&&index<length){var nextAccuX=mainPeriod.getNextValueInPeriod(accuX,xStep);accuHigh=Double.NEGATIVE_INFINITY;accuLow=Double.POSITIVE_INFINITY;accuVolume=0;accuCount=0;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;accuOpen=point[FinancialSerie.OPEN];while((currentXValue==null||currentXValue<nextAccuX)&&index<length){if(currentXValue!=null){accuClose=point[FinancialSerie.CLOSE];var high=point[FinancialSerie.HIGH];if(high!=null&&!isNaN(high)&&high>accuHigh){accuHigh=high;}
var low=point[FinancialSerie.LOW];if(low!=null&&!isNaN(low)&&low<accuLow){accuLow=low;}
accuVolume+=point[FinancialSerie.VOLUME];accuCount++;}
index++;point=mainSerieI.getPoint(index);currentXValue=point!=null?point[Serie.X]:null;}
if(accuCount>0){currentHigh=accuHigh;currentLow=accuLow;currentOpen=accuOpen;currentClose=accuClose;currentVolume=accuVolume;}
var accuPoint={};accuPoint[Serie.X]=accuX+middlePointCorrection;accuPoint[FinancialSerie.HIGH]=currentHigh;accuPoint[FinancialSerie.LOW]=currentLow;accuPoint[FinancialSerie.OPEN]=currentOpen;accuPoint[FinancialSerie.CLOSE]=currentClose;accuPoint[FinancialSerie.VOLUME]=currentVolume;regularPoints.push(accuPoint);accuX=nextAccuX;}
return regularPoints;};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var BidAskSerie=function(period,colorStrategy,stock){IntradaySerie.call(this,period,colorStrategy,stock,false);this.type=Chart.ChartType.BID_ASK;this.updateReferenceDate();};BidAskSerie=stjs.extend(BidAskSerie,IntradaySerie,[],function(constructor,prototype){constructor.ASK="ask";constructor.BID="bid";constructor.LAST_ARRAY="lastArray";constructor.VOLUME_POSITIVE="volumePositive";constructor.LAST_VOLUME="lastVolume";constructor.LAST="last";constructor.LAST_TIME="lastTime";prototype.aggregatedPoints=null;prototype.referenceDate=null;constructor.sortFunction=function(a,b){if(a!=null&&b!=null){if(a[Serie.X]<b[Serie.X]){return-1;}
if(a[Serie.X]>b[Serie.X]){return 1;}
return 0;}else{return 0;}};prototype.getReferenceDate=function(){return this.referenceDate;};prototype.setReferenceDate=function(referenceDate){this.referenceDate=referenceDate;};prototype.updateReferenceDate=function(){this.referenceDate=DateUtil.createDate(DateUtil.getDateValueInScale(new Date().getTime(),DateUtil.MS_DAY_24H));};prototype.getMainSerie=function(){return this;};prototype.appendData=function(newPoints,newValidity,metadataArray){var length=this.getLength();if(length>0&&!this.isValidLivePoint(this.getLastPoint())){this.points.splice(length-1,1);}
return IntradaySerie.prototype.appendData.call(this,newPoints,newValidity,metadataArray);};prototype.getValidLength=function(){var length=this.getLength();if(length>0&&!this.isValidLivePoint(this.getLastPoint())){return length-1;}else{return length;}};prototype.isValidLivePoint=function(point){if(point!=null){if(this.stock!=null&&this.stock.isSwissDotsMarket()){return BidAskSerie.isValidFinancialValue(point[BidAskSerie.ASK])&&BidAskSerie.isValidFinancialValue(point[BidAskSerie.BID]);}else{return BidAskSerie.isValidFinancialValue(point[BidAskSerie.LAST]);}}
return false;};constructor.isValidFinancialValue=function(value){return value!=null&&!isNaN(value)&&value>0;};prototype.getAggregatedSerie=function(){var aggregatedSerie=new BidAskAggregatedSerie(this,BidAskSerie.LAST,AggregationStrategy.MIN);this.aggregatedPoints=this.getAggregatedPoints();if(this.aggregatedPoints!=null){this.aggregatedPoints.sort(BidAskSerie.sortFunction);}
aggregatedSerie.setData(this.aggregatedPoints,DateUtil.cloneDate(this.validity),null);aggregatedSerie.referencePrice=this.referencePrice;aggregatedSerie.timeOffset=this.timeOffset;aggregatedSerie.stretchLeftSide=this.stretchLeftSide;aggregatedSerie.stretchRightSide=this.stretchRightSide;aggregatedSerie.forcedStart=this.forcedStart;aggregatedSerie.forcedEnd=this.forcedEnd;aggregatedSerie.color=this.color;aggregatedSerie.mainFields=[BidAskSerie.BID,BidAskSerie.ASK,BidAskSerie.LAST];aggregatedSerie.dropPointsAfterPeriodEnd();return aggregatedSerie;};prototype.setPointsXValues=function(){var points=this.points;for(var index in points){if(!(points).hasOwnProperty(index))
continue;var point=points[index];if(point!=null){point[Serie.X]=this.liveTimeToDateValue(this.referenceDate,point[BidAskSerie.LAST_TIME]);}}};prototype.getAggregatedPoints=function(){var aggregatedPoints=[];if(this.points==null||this.points.length==0){return aggregatedPoints;}
this.setPointsXValues();var currentPoint={};var currentLastTime=parseInt(this.getValue(0,BidAskSerie.LAST_TIME));currentPoint[Serie.X]=this.getValue(0,Serie.X);var last=this.getValue(0,BidAskSerie.LAST);var currentVolume=null;var volumePositive=null;var currentLastArray=[];var pointCount=this.points!=null?this.points.length:0;for(var i=1;i<pointCount;i++){var currentTime=parseInt(this.getValue(i,BidAskSerie.LAST_TIME));if(currentTime>currentLastTime){if(currentPoint!=null){currentPoint[FinancialSerie.VOLUME]=currentVolume;currentPoint[BidAskSerie.VOLUME_POSITIVE]=volumePositive;currentPoint[BidAskSerie.LAST_ARRAY]=currentLastArray;currentPoint[BidAskSerie.LAST]=last;aggregatedPoints.push(currentPoint);currentPoint=null;}
currentLastTime=currentTime;}
if(currentTime==currentLastTime){last=this.getValue(i,BidAskSerie.LAST);var vol=this.getValue(i,BidAskSerie.LAST_VOLUME);var bidValue=this.getValue(i,BidAskSerie.BID);if(currentPoint==null){currentPoint={};var askValue=this.getValue(i,BidAskSerie.ASK);currentPoint[BidAskSerie.ASK]=askValue;currentPoint[FinancialSerie.HIGH]=askValue;currentPoint[BidAskSerie.BID]=bidValue;currentPoint[FinancialSerie.LOW]=bidValue;currentPoint[Serie.X]=this.getValue(i,Serie.X);volumePositive=last>bidValue;currentVolume=vol;currentLastArray=[last];}else{if(currentLastArray==null){currentLastArray=[last];}else if(currentLastArray.indexOf(last)==-1){currentLastArray.push(last);}
if(currentVolume==null){currentVolume=vol;volumePositive=last>bidValue;}else if(vol!=null){currentVolume+=vol;volumePositive=last>bidValue;}}}}
if(currentPoint!=null){currentPoint[FinancialSerie.VOLUME]=currentVolume;currentPoint[BidAskSerie.VOLUME_POSITIVE]=volumePositive;currentPoint[BidAskSerie.LAST_ARRAY]=currentLastArray;currentPoint[BidAskSerie.LAST]=last;aggregatedPoints.push(currentPoint);currentPoint=null;}
return aggregatedPoints;};prototype.liveTimeToDateValue=function(today,liveTimeHMMSS){if(liveTimeHMMSS==null){return null;}else{var paddedTime=this.leftPad(liveTimeHMMSS,6);var hours=parseInt(paddedTime.substring(0,2));var minutes=parseInt(paddedTime.substring(2,4));var seconds=parseInt(paddedTime.substring(4,6));today.setHours(hours);today.setMinutes(minutes);today.setSeconds(seconds);return today.getTime();}};prototype.leftPad=function(str,desiredLength){if(str==null){return null;}
while(str.length<desiredLength){str="0"+str;}
return str;};prototype.setMetadata=function(metadataArray){this.referencePrice=this.getValue(0,BidAskSerie.LAST);};prototype.createDataId=function(key,period,pixelCount){return IntradaySerie.prototype.createDataId.call(this,key,period,pixelCount)+"bidask";};prototype.createMetadataId=function(key,period,pixelCount){return IntradaySerie.prototype.createMetadataId.call(this,key,period,pixelCount)+"bidask";};prototype.getBeforeLastPoint=function(){if(this.points!=null&&this.points.length>1){return this.points[this.points.length-2];}
return null;};prototype.setPeriod=function(period){this.period=period;};prototype.setReferenceValue=function(referenceValue){this.referencePrice=referenceValue;};prototype.setTimeOffset=function(timeOffset){this.timeOffset=timeOffset;};},{aggregatedPoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},referenceDate:"Date",sortFunction:{name:"SortFunction",arguments:[{name:"Map",arguments:[null,"Object"]}]},stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var BidAskAggregatedSerie=function(mainSerie,mainField,aggregationStrategy){BidAskSerie.call(this,mainSerie.period,mainSerie.colorStrategy,mainSerie.stock);this.mainSerie=mainSerie;this.mainField=mainField;this.aggregationStrategy=aggregationStrategy;this.type=Chart.ChartType.BID_ASK;};BidAskAggregatedSerie=stjs.extend(BidAskAggregatedSerie,BidAskSerie,[],function(constructor,prototype){prototype.mainSerie=null;prototype.getMainSerie=function(){return this.mainSerie;};prototype.getValue=function(i,which){if(this.points!=null&&this.points.length>0&&i!=null&&i>=0&&i<this.points.length){var point=this.points[i];if(point!=null){if(which==Serie.Y){return point[this.mainField];}else{return point[which];}}}
return null;};prototype.prepend=function(pointsToPrepend,length){if(pointsToPrepend!=null&&length>0){var beforeLiveData=[];for(var i=0;i<length;i++){beforeLiveData.push(this.intraday2BidAskPoint(pointsToPrepend[i]));}
var lenght=this.getLength();for(var i=0;i<lenght;i++){beforeLiveData.push(this.points[i]);}
this.points=beforeLiveData;}};prototype.dropPointsAfterPeriodEnd=function(){if(this.period!=null&&this.period.getTo()!=null){var invalidIndex=this.findIndexAtOrAfterXValue(this.period.getTo().getTime()+this.xSpaceScale);if(invalidIndex!=null&&!isNaN(invalidIndex)&&invalidIndex>0){if(this.points!=null){this.points.splice(invalidIndex,this.points.length-invalidIndex);}}}};prototype.intraday2BidAskPoint=function(intradayPoint){if(intradayPoint==null){return null;}
var point={};var last=intradayPoint[Serie.Y];var high=intradayPoint[FinancialSerie.HIGH];var bid=intradayPoint[FinancialSerie.LOW];var volume=intradayPoint[FinancialSerie.VOLUME];point[BidAskSerie.ASK]=high;point[FinancialSerie.HIGH]=high;point[BidAskSerie.BID]=bid;point[BidAskSerie.LOW]=bid;point[BidAskSerie.LAST_VOLUME]=volume;point[FinancialSerie.VOLUME]=volume;point[BidAskSerie.LAST]=last;point[Serie.X]=intradayPoint[Serie.X];point[BidAskSerie.VOLUME_POSITIVE]=last>bid;point[BidAskSerie.LAST_ARRAY]=[last];return point;};},{mainSerie:"BidAskSerie",aggregatedPoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},referenceDate:"Date",sortFunction:{name:"SortFunction",arguments:[{name:"Map",arguments:[null,"Object"]}]},stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var Stock=function(key){this.key=key;};Stock=stjs.extend(Stock,null,[],function(constructor,prototype){constructor.marketExtensions={"xx":",ANY","ch":"","chi":"","chid":"","so":",SO","vx":",V","us":",U","ff":",FF","be":",BE","du":",DU","ha":",HA","hv":",HV","mu":",MU","st":",ST","de":",X","fr":",E","fu":",F","no":",O","dk":",K","fi":",H","se":",S","ew":",W","eu":",R","cu":",C","ca":",CA","gb":",GB","it":",IT","at":",AT","co":",CO","is":",IS","cm":",CM","una":",UNA"};constructor.CURRENCY_SEPARATOR_CHAR="_";constructor.INDEX_STOCK_TYPE_ID="4";constructor.CURRENCY_STOCK_TYPE_ID="5";constructor.SWISS_DOTS_MARKET_ID="672";constructor.publicIsin1="USDJIA000004";constructor.premiumIsin1="USDJIAR00005";constructor.publicIsin2="DEDAX0000007";constructor.premiumIsin2="DEDAXR000000";prototype.key=null;prototype.name=null;prototype.symbol=null;prototype.currency=null;prototype.isin=null;prototype.stockExchangeId=null;prototype.marketId=null;prototype.marketName=null;prototype.stockTypeId=null;constructor.map2Stock=function(stockMap){var stock=null;if(stockMap!=null){stock=new Stock(stockMap["key"]);stock.setName(stockMap["name"]);stock.setSymbol(stockMap["symbol"]);stock.setCurrency(stockMap["currency"]);stock.setIsin(stockMap["isin"]);stock.setStockExchangeId(stockMap["stockExchangeId"]);stock.setMarketId(stockMap["marketId"]);stock.setMarketName(stockMap["marketName"]);stock.setStockTypeId(stockMap["stockTypeId"]);}
return stock;};constructor.stock2Map=function(stock){if(stock!=null){var stockMap={};stockMap["key"]=stock.key;stockMap["name"]=stock.name;stockMap["symbol"]=stock.symbol;stockMap["currency"]=stock.currency;stockMap["isin"]=stock.isin;stockMap["stockExchangeId"]=stock.stockExchangeId;stockMap["marketId"]=stock.marketId;stockMap["marketName"]=stock.marketName;stockMap["stockTypeId"]=stock.stockTypeId;return stockMap;}else{return null;}};constructor.stockSearchResult2Stock=function(key,result){var stock=null;if(key!=null){stock=new Stock(key);if(result!=null){stock.setName(result.getName());stock.setSymbol(result.getSymbol());stock.setCurrency(result.getCurrency());stock.setIsin(result.getIsin());stock.setStockExchangeId(result.getStockExchangeId());stock.setMarketId(result.getMarketId());stock.setMarketName(result.getMarketName());stock.setStockTypeId(result.getStockTypeId());}}
return stock;};prototype.getKey=function(){return this.key;};prototype.setKey=function(key){this.key=key;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getSymbol=function(){return this.symbol;};prototype.setSymbol=function(symbol){this.symbol=symbol;};prototype.getCurrency=function(){return this.currency;};prototype.setCurrency=function(currency){this.currency=currency;};prototype.getIsin=function(){return this.isin;};prototype.setIsin=function(isin){this.isin=isin;};prototype.getStockExchangeId=function(){return this.stockExchangeId;};prototype.setStockExchangeId=function(stockExchangeId){this.stockExchangeId=stockExchangeId;};prototype.getMarketId=function(){return this.marketId;};prototype.setMarketId=function(marketId){this.marketId=marketId;};prototype.getMarketName=function(){return this.marketName;};prototype.setMarketName=function(marketName){this.marketName=marketName;};prototype.getStockTypeId=function(){return this.stockTypeId;};prototype.setStockTypeId=function(stockTypeId){this.stockTypeId=stockTypeId;};prototype.isSwissDotsMarket=function(){return this.stockExchangeId==Stock.SWISS_DOTS_MARKET_ID;};prototype.isCurrency=function(){return this.stockTypeId==Stock.CURRENCY_STOCK_TYPE_ID;};prototype.isIndex=function(){return this.stockTypeId==Stock.INDEX_STOCK_TYPE_ID;};prototype.getInverseCurrency=function(){if(this.isCurrency()&&Stock.getValidCurrencyPair(this.name)!=null){var inverse=new Stock(this.key);var currPair=Stock.getValidCurrencyPair(this.name);inverse.name=currPair[1]+Stock.CURRENCY_SEPARATOR_CHAR+currPair[0];inverse.symbol=currPair[1]+Stock.CURRENCY_SEPARATOR_CHAR+currPair[0];inverse.currency=currPair[0];inverse.isin="CCX"+currPair[1]+"X"+currPair[0]+"XX";inverse.stockExchangeId=this.stockExchangeId;inverse.marketId=this.marketId;inverse.marketName=this.marketName;inverse.stockTypeId=this.stockTypeId;inverse.key=Stock.createKey(inverse.isin,inverse.stockExchangeId,inverse.currency);return inverse;}else{return null;}};constructor.getValidCurrencyPair=function(name){if(name!=null){var currSplit=(name).split(Stock.CURRENCY_SEPARATOR_CHAR);if(currSplit!=null&&currSplit.length==2&&currSplit[0]!=currSplit[1]){return currSplit;}else{return null;}}else{return null;}};constructor.createKey=function(isin,exchangeId,currency){var exchangeValue=parseInt(exchangeId);if(isin==null||exchangeId==null||currency==null||exchangeValue==null||isNaN(exchangeValue)){return null;}
var exchangeIdString=exchangeId;if(exchangeValue<0){exchangeIdString="M"+String.valueOf(-exchangeValue);}
return isin+"_"+exchangeIdString+"_"+currency;};prototype.getMarketExtension=function(){if(this.marketId!=null&&Stock.marketExtensions[this.marketId]!=null){return Stock.marketExtensions[this.marketId];}else{return"";}};prototype.filterPublicPremiumIsin=function(isPublic){if(isPublic){if(this.isin==Stock.premiumIsin1){this.isin=Stock.publicIsin1;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}else if(this.isin==Stock.premiumIsin2){this.isin=Stock.publicIsin2;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}}else{if(this.isin==Stock.publicIsin1){this.isin=Stock.premiumIsin1;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}else if(this.isin==Stock.publicIsin2){this.isin=Stock.premiumIsin2;this.key=Stock.createKey(this.isin,this.stockExchangeId,this.currency);}}};},{marketExtensions:{name:"Map",arguments:[null,null]}},{});
var Cache=function(){this.storage=(window)["sessionStorage"];this.sessionStorageAvailable=((typeof this.storage)!="undefined");};Cache=stjs.extend(Cache,null,[],function(constructor,prototype){constructor.LAST_CLEAR_ID="cacheLastClearTime";constructor.CACHE_VALIDITY_TIME=3600000;constructor.instance=null;prototype.storage=null;prototype.sessionStorageAvailable=false;constructor.getInstance=function(){if(Cache.instance==null){Cache.instance=new Cache();}
Cache.instance.validate();return Cache.instance;};prototype.get=function(key){var currentValue=null;if(key!=null&&this.sessionStorageAvailable){currentValue=this.storage.getItem(key);}
return currentValue;};prototype.set=function(key,value){if(key!=null&&this.sessionStorageAvailable){try{this.storage.setItem(key,value);}catch(e){this.clear();}}};prototype.remove=function(key){if(key!=null&&this.sessionStorageAvailable){this.storage.removeItem(key);}};prototype.append=function(key,value){if(key!=null&&this.sessionStorageAvailable){var currentValue=this.storage[key];if(currentValue==null){currentValue="";}
if(value==null){value="";}
currentValue=currentValue+value;try{this.storage[key]=currentValue;}catch(e){}}};prototype.clear=function(){if(this.sessionStorageAvailable){this.storage.clear();}};prototype.validate=function(){var lastClearTimeString=this.get(Cache.LAST_CLEAR_ID);var now=new Date();var nowTime=now.getTime();if(lastClearTimeString==null||isNaN(lastClearTimeString)){this.clear();this.set(Cache.LAST_CLEAR_ID,nowTime+"");}else{var lastClearTime=parseInt(lastClearTimeString);if(isNaN(lastClearTime)||((lastClearTime+Cache.CACHE_VALIDITY_TIME)<nowTime)){this.clear();this.set(Cache.LAST_CLEAR_ID,nowTime+"");}}};},{instance:"Cache",storage:"Storage"},{});
var ChartData=function(chart,provider){Observable.call(this);this.provider=provider;this.cache=Cache.getInstance();this.series=[];this.totalXSpace=0;this.stepSize=1;this.availableFormats=[];this.possibleXSteps=[];this.xValuesPeriods=null;this.logScale=false;this.mainSerieTimeOffsetMs=0;};ChartData=stjs.extend(ChartData,Observable,[],function(constructor,prototype){prototype.provider=null;prototype.cache=null;prototype.series=null;prototype.extremums=null;prototype.totalXSpace=0.0;prototype.xSpaceValuesScale=0.0;prototype.logScale=false;prototype.indexedXSpace=false;prototype.indexedXValues=null;prototype.availableFormats=null;prototype.possibleXSteps=null;prototype.xValuesPeriods=null;prototype.stepSize=0.0;prototype.mainSerieTimeOffsetMs=0;prototype.fetchDataSeries=function(){this.provider.getData(this);};prototype.setSeries=function(series){this.series=series;this.updateSeriesLogScale();this.validateData();this.notifyObservers(this);};prototype.validateData=function(){var serieCount=(this.series!=null)?this.series.length:0;var mainSerie=this.getMainSerie();if(serieCount<=0||mainSerie==null){this.xValuesPeriods=null;this.extremums=null;this.totalXSpace=0;return;}
this.xSpaceValuesScale=mainSerie.getXSpaceScale();this.indexedXSpace=mainSerie.isIndexed();this.stepSize=mainSerie.getStepSize();if(this.indexedXSpace){this.indexedXValues=this.createGlobalIndexedXValues();}
var minNormalizedXValue=Double.POSITIVE_INFINITY;var maxNormalizedXValue=Double.NEGATIVE_INFINITY;var seriesPeriods=[];var flattenedPeriodSpace=0.0;for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.isEnabled()){var serieStartValue=serie.getAbsoluteStartXValue();var serieEndValue=serie.getAbsoluteEndXValue();flattenedPeriodSpace=this.updatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue);if(!isNaN(serieStartValue)&&serieStartValue<minNormalizedXValue){minNormalizedXValue=serieStartValue;}
if(!isNaN(serieEndValue)&&serieEndValue>maxNormalizedXValue){maxNormalizedXValue=serieEndValue;}}}
this.xValuesPeriods=seriesPeriods;this.totalXSpace=flattenedPeriodSpace;if(minNormalizedXValue==Double.POSITIVE_INFINITY||maxNormalizedXValue==Double.NEGATIVE_INFINITY){this.extremums=null;}else{this.extremums=[];this.extremums[0]=minNormalizedXValue;this.extremums[1]=maxNormalizedXValue;}
this.availableFormats=[];this.possibleXSteps=[];mainSerie.setXAxisFormatsAndSteps(this.availableFormats,this.possibleXSteps);};prototype.createGlobalIndexedXValues=function(){var seriesCount=this.getSerieCount();var currentMaxLength=-1;var maxSerie=null;for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()&&currentSerie.getLength()>currentMaxLength){currentMaxLength=currentSerie.getLength();maxSerie=currentSerie;}}
if(maxSerie!=null){var indexedXValues=[];for(var i=0;i<currentMaxLength;i++){indexedXValues.push(maxSerie.getValueAsDouble(i,Serie.X));}
return indexedXValues;}
return null;};prototype.updatePeriods=function(orderedXValuesPeriods,initialSize,serieStartValueToAdd,serieEndValueToAdd){if(orderedXValuesPeriods==null||serieStartValueToAdd==null||serieEndValueToAdd==null||isNaN(serieStartValueToAdd)||isNaN(serieEndValueToAdd)||serieEndValueToAdd<=serieStartValueToAdd){return initialSize;}
var serieStartValueToAddNormalized=serieStartValueToAdd;var serieEndValueToAddNormalized=serieEndValueToAdd;var currentSize=initialSize!=null?initialSize:0;var currentPeriodsCount=orderedXValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=orderedXValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];if(serieEndValueToAddNormalized<currentPeriodStart){orderedXValuesPeriods.splice(i,0,[serieStartValueToAddNormalized,serieEndValueToAddNormalized]);return currentSize+(serieEndValueToAddNormalized-serieStartValueToAddNormalized+1);}else if(serieStartValueToAddNormalized<currentPeriodStart&&serieEndValueToAddNormalized<=currentPeriodEnd){currentPeriod[0]=serieStartValueToAddNormalized;orderedXValuesPeriods[i]=currentPeriod;return currentSize+(currentPeriodStart-serieStartValueToAddNormalized);}else if(serieStartValueToAddNormalized>=currentPeriodStart&&serieEndValueToAddNormalized<=currentPeriodEnd){return currentSize;}else if(serieStartValueToAddNormalized>currentPeriodEnd){}else{if(serieStartValueToAddNormalized<currentPeriodStart){orderedXValuesPeriods.splice(i,1);currentSize-=(currentPeriodEnd-currentPeriodStart+1);i--;currentPeriodsCount--;}else{orderedXValuesPeriods.splice(i,1);currentSize-=(currentPeriodEnd-currentPeriodStart+1);serieStartValueToAddNormalized=currentPeriodStart;i--;currentPeriodsCount--;}}}
orderedXValuesPeriods.push([serieStartValueToAddNormalized,serieEndValueToAddNormalized]);return currentSize+(serieEndValueToAddNormalized-serieStartValueToAddNormalized+1);};prototype.getSeries=function(){return this.series;};prototype.getSerie=function(index){if(this.series!=null&&index>=0&&index<this.series.length){return this.series[index];}
return null;};prototype.getSerieCount=function(){return(this.series==null)?0:this.series.length;};prototype.getMainSerie=function(){return(this.series==null)?null:this.series[0];};prototype.getMainSerieLength=function(){var main=this.getMainSerie();return(main==null)?0:main.getLength();};prototype.getTotalXSpace=function(){return this.totalXSpace;};prototype.getCurrentXSpaceSize=function(range){if(range!=null&&range[0]!=null&&range[1]!=null){return this.computeXSpaceSizeFromPeriods(this.xValuesPeriods,range[0],range[1]);}
return this.totalXSpace;};prototype.computeXSpaceSizeFromPeriods=function(periods,start,end){if(start==null||end==null||isNaN(start)||isNaN(end)||end<=start){return 0.0;}
if(periods==null||periods.length<=0){return end-start+1.0;}
var currentSize=0.0;var currentPeriodsCount=periods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=periods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var startValue=currentPeriodStart;var endValue=currentPeriodEnd;if(end<=currentPeriodEnd){endValue=end;}
if(start>=currentPeriodStart){startValue=start;}
if(end<currentPeriodStart){return currentSize;}else if(start<=currentPeriodEnd){currentSize=currentSize+(endValue-startValue+1.0);}else{}}
return currentSize;};prototype.getXSpaceValuesScale=function(){return this.xSpaceValuesScale;};prototype.getExtremums=function(){return this.extremums!=null?this.extremums.slice(0):null;};prototype.isIndexed=function(){return this.indexedXSpace;};prototype.isEmpty=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&!serie.isEmpty()){return false;}}
return true;};prototype.getAvailableFormats=function(){return this.availableFormats;};prototype.setAvailableFormats=function(availableFormats){this.availableFormats=availableFormats;};prototype.getPossibleXSteps=function(){return this.possibleXSteps;};prototype.setPossibleXSteps=function(possibleXSteps){this.possibleXSteps=possibleXSteps;};prototype.getXStepSize=function(){return this.stepSize;};prototype.clear=function(){this.extremums=null;var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=this.series[i];if(currentSerie!=null){currentSerie.removeAllPoints();}}};prototype.xSpace2ClosestXValue=function(xSpacePosition){return this.normalizedXValue2XValue(this.xSpace2NormalizedXValue(xSpacePosition));};prototype.xSpace2CurrentOrPreviousXValue=function(xSpacePosition){return this.normalizedXValue2XValue(this.applySerieFloor(this.xSpace2NormalizedXValue(xSpacePosition)));};prototype.normalizedXValue2XValue=function(normalizedXValue){if(this.isIndexed()){if(this.indexedXValues!=null){return this.indexedXValues[stjs.trunc(Math.round(normalizedXValue))];}
return null;}
return normalizedXValue;};prototype.xValue2normalizedXValue=function(xValue){if(this.isIndexed()){return Math.round(this.findIndexAroundValue(xValue,this.indexedXValues,this.stepSize));}
return xValue;};prototype.xValue2XSpace=function(xValue){return this.normalizedXValue2XSpace(this.xValue2normalizedXValue(xValue));};prototype.xSpace2NormalizedXValue=function(xSpacePosition){if(xSpacePosition==null){return null;}
if(xSpacePosition<=0){return this.extremums!=null?this.extremums[0]:null;}
if(xSpacePosition>=this.getTotalXSpace()-1){return this.extremums!=null?this.extremums[1]:null;}
var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(xSpacePosition<periodSize){return(currentPeriodStart+xSpacePosition);}
xSpacePosition-=periodSize;}
return null;};prototype.xSpace2NormalizedXValueNegative=function(xSpacePosition){if(xSpacePosition==null){return null;}
var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(xSpacePosition<=periodSize){return(currentPeriodStart+xSpacePosition);}
xSpacePosition-=periodSize;}
return null;};prototype.normalizedXValue2XSpace=function(normalizedXValue){if(normalizedXValue==null){return null;}
if(this.extremums!=null){if(normalizedXValue<=this.extremums[0]){return 0.0;}else if(normalizedXValue>=this.extremums[1]){return this.getTotalXSpace()-1;}}
var currentXSpaceValue=0.0;var currentPeriodsCount=this.xValuesPeriods.length;for(var i=0;i<currentPeriodsCount;i++){var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];var periodSize=currentPeriodEnd-currentPeriodStart+1;if(normalizedXValue<currentPeriodEnd){return currentXSpaceValue+normalizedXValue-currentPeriodStart;}
currentXSpaceValue+=periodSize;}
return currentXSpaceValue;};prototype.getSerieById=function(id){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.getId()==id){return serie;}}
return null;};prototype.getDataSerieCount=function(){var serieCount=this.getSerieCount();var validSerieCount=0;for(var i=0;i<serieCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&currentSerie.isInteractionAllowed()){validSerieCount++;}}
return validSerieCount;};prototype.setMainSerieTimeOffsetMs=function(mainSerieTimeOffsetMs){this.mainSerieTimeOffsetMs=mainSerieTimeOffsetMs;};prototype.getMainSerieTimeOffsetMs=function(){return this.mainSerieTimeOffsetMs;};prototype.getNextNormalizedXValue=function(normalizedXValue,xValueStep){if(this.stepSize>0){return normalizedXValue+(xValueStep/this.stepSize);}
return normalizedXValue+xValueStep;};prototype.getXType=function(){var seriesCount=this.getSerieCount();for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var xType=currentSerie.getXType();if(xType!=null){return xType;}}}
return null;};prototype.findIndexAroundValue=function(searchedValue,orderedSearchArray,searchScale){if(searchedValue==null||orderedSearchArray==null||orderedSearchArray.length<=0||searchScale==null||searchScale==0){return null;}
var index=-1;var startSearchIndex=0;var endSearchIndex=orderedSearchArray.length;var scaledSearchValue=this.applySerieRound(searchedValue/searchScale);while(startSearchIndex<endSearchIndex){index=Math.floor((startSearchIndex+endSearchIndex)/2.0);var valueAtIndex=this.applySerieRound(orderedSearchArray[index]/searchScale);if(valueAtIndex==scaledSearchValue){return index;}else if(scaledSearchValue-valueAtIndex>0){startSearchIndex=index+1;}else{endSearchIndex=index-1;}}
return startSearchIndex;};prototype.findIndexAtOrAfterValue=function(searchedValue,orderedSearchArray,searchScale){var startSearchIndex=this.findIndexAroundValue(searchedValue,orderedSearchArray,searchScale);if(startSearchIndex==null){return null;}
var scaledSearchValue=this.applySerieRound(searchedValue/searchScale);var valueAtIndex=this.applySerieRound(orderedSearchArray[startSearchIndex]/searchScale);var timeAtPreviousStartIndex=Double.NEGATIVE_INFINITY;var previousStartIndex=startSearchIndex-1;var nextStartIndex=startSearchIndex+1;if(previousStartIndex!=null&&previousStartIndex>=0){timeAtPreviousStartIndex=this.applySerieRound(orderedSearchArray[previousStartIndex]/searchScale);}
if(timeAtPreviousStartIndex>=scaledSearchValue){return previousStartIndex;}else if(valueAtIndex>=scaledSearchValue){return startSearchIndex;}else{return(nextStartIndex!=null&&nextStartIndex<orderedSearchArray.length)?nextStartIndex:null;}};prototype.getMinXValue=function(){if(this.isIndexed()){if(this.indexedXValues!=null&&this.extremums!=null){return this.indexedXValues[stjs.trunc(Math.round(this.extremums[0]))];}
return null;}
return this.getMinNormalizedXValue();};prototype.getMinNormalizedXValue=function(){if(this.extremums!=null){return this.extremums[0];}
return null;};prototype.getMaxXValue=function(){if(this.isIndexed()){if(this.indexedXValues!=null&&this.extremums!=null){return this.indexedXValues[stjs.trunc(Math.round(this.extremums[1]))];}
return null;}
return this.getMaxNormalizedXValue();};prototype.getMaxNormalizedXValue=function(){if(this.extremums!=null){return this.extremums[1];}
return null;};prototype.getProvider=function(){return this.provider;};prototype.isLogScale=function(){return this.logScale;};prototype.setLogScale=function(logScale){this.logScale=logScale;this.updateSeriesLogScale();};prototype.updateSeriesLogScale=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null){currentSerie.setLogScale(this.logScale);}}};prototype.applySerieFloor=function(value){var serie=this.getMainSerie();return serie!=null?serie.getXValueFloor(value):value;};prototype.applySerieRound=function(value){var serie=this.getMainSerie();return serie!=null?serie.getXValueRound(value):value;};prototype.normalizeXSpaceNight=function(xSpace){if(xSpace==null){return null;}
if(this.xValuesPeriods==null||this.xValuesPeriods.length==0){return 0.0;}
var start=this.xValuesPeriods[0][0];var end=this.xValuesPeriods[0][1];if(start==0||end==0||xSpace<end&&xSpace>start||xSpace<start){return 0.0;}
var inPeriod=false;var diff=0.0;var currentPeriodsCount=this.xValuesPeriods.length;for(var i=1;i<currentPeriodsCount;i++){var previousPeriod=this.xValuesPeriods[i-1];var previousPeriodEnd=previousPeriod[1];var currentPeriod=this.xValuesPeriods[i];var currentPeriodStart=currentPeriod[0];var currentPeriodEnd=currentPeriod[1];if(xSpace<currentPeriodEnd&&xSpace>=currentPeriodStart){inPeriod=true;diff+=(currentPeriodStart-previousPeriodEnd+this.normalizeXSpaceNight(xSpace-Frequency.DAY.getTimeValue()));}}
if(!inPeriod){diff+=this.normalizeXSpaceNight(xSpace-Frequency.DAY.getTimeValue());}
return diff;};},{provider:{name:"DataProvider",arguments:[{name:"ChartData",arguments:["S"]}]},cache:"Cache",series:{name:"Array",arguments:["S"]},extremums:{name:"Array",arguments:[null]},indexedXValues:{name:"Array",arguments:[null]},availableFormats:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},possibleXSteps:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},xValuesPeriods:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},observers:{name:"Map",arguments:[null,"Observer"]}},{});
var ChartContext=function(){this.seriesMinValues={};this.seriesMaxValues={};this.seriesMinIndices={};this.seriesMaxIndices={};this.labelsPosition={};this.ranges={};this.formats={};this.precision=ChartContext.GENERAL_Y_PRECISION;this.logScale=false;};ChartContext=stjs.extend(ChartContext,null,[],function(constructor,prototype){constructor.SERIE_GLOBAL="global";constructor.PRECISION_THRESHOLD=0.04;constructor.GENERAL_Y_PRECISION=3;constructor.PRECISE_Y_PRECISION=6;prototype.data=null;prototype.aggregationStrategy=null;prototype.currentPosition=null;prototype.zoomIconId=null;prototype.precision=0;prototype.ranges=null;prototype.labelsPosition=null;prototype.formats=null;prototype.seriesMinValues=null;prototype.seriesMaxValues=null;prototype.seriesMinIndices=null;prototype.seriesMaxIndices=null;prototype.globalMinRefValue=0;prototype.globalMaxRefValue=0;prototype.adjustRefValue=0;prototype.logScale=false;prototype.getValue=function(values,serieId,which){if(values==null||serieId==null||which==null){return null;}
var serieValues=values[serieId];if(serieValues!=null){return serieValues[which];}
return null;};prototype.setValue=function(values,serieId,which,min){if(values==null||serieId==null||which==null){return;}
var serieValues=values[serieId];if(serieValues==null){serieValues={};values[serieId]=serieValues;}
serieValues[which]=min;};prototype.getMin=function(serieId,which){return this.getValue(this.seriesMinValues,serieId,which);};prototype.setMin=function(serieId,which,min){this.setValue(this.seriesMinValues,serieId,which,min);};prototype.getMax=function(serieId,which){return this.getValue(this.seriesMaxValues,serieId,which);};prototype.setMax=function(serieId,which,max){this.setValue(this.seriesMaxValues,serieId,which,max);};prototype.getMinIndex=function(serieId,which){return this.getValue(this.seriesMinIndices,serieId,which);};prototype.getMaxIndex=function(serieId,which){return this.getValue(this.seriesMaxIndices,serieId,which);};prototype.setMinIndex=function(serieId,minIndex,which){this.setValue(this.seriesMinIndices,serieId,which,minIndex);};prototype.setMaxIndex=function(serieId,maxIndex,which){this.setValue(this.seriesMaxIndices,serieId,which,maxIndex);};prototype.getMainMin=function(which){var serieId=this.getMainSerieId();return this.getMin(serieId,which);};prototype.getMainMax=function(which){var serieId=this.getMainSerieId();return this.getMax(serieId,which);};prototype.getMainMinIndex=function(which){var serieId=this.getMainSerieId();return this.getMinIndex(serieId,which);};prototype.getMainMaxIndex=function(which){var serieId=this.getMainSerieId();return this.getMaxIndex(serieId,which);};prototype.update=function(data,aggregationStrategy){this.data=data;this.aggregationStrategy=aggregationStrategy;if(data==null||data.getSerieCount()==0){return;}
this.updateSeriesContext(data.getSeries());};prototype.updateSeriesContext=function(series){if(series==null||series.length==0){return;}
var absolutePercentChanges=this.setSeriesMinMaxInRange(this.getRange(DefaultLayout.X_AXIS_AREA),series);var globalMinPercentChange=0.0;var globalMaxPercentChange=0.0;if(absolutePercentChanges!=null&&absolutePercentChanges[0]!=null&&absolutePercentChanges[1]!=null){globalMinPercentChange=absolutePercentChanges[0];globalMaxPercentChange=absolutePercentChanges[1];}
if(globalMinPercentChange==globalMaxPercentChange){globalMinPercentChange--;globalMaxPercentChange++;}
var mainSerie=this.data.getMainSerie();this.logScale=mainSerie.isLogScale();var mainSerieId=mainSerie.getId();var currentRefValue=mainSerie.getReferenceValue();var currentMinPercentChange=this.getMin(mainSerieId,Serie.CHANGE_PERCENT);var currentMaxPercentChange=this.getMax(mainSerieId,Serie.CHANGE_PERCENT);var minRatio=this.computeRatio(globalMinPercentChange,this.globalMinRefValue,currentMinPercentChange,currentRefValue);var maxRatio=this.computeRatio(globalMaxPercentChange,this.globalMaxRefValue,currentMaxPercentChange,currentRefValue);var mainSerieMin=this.getMin(mainSerieId,ChartContext.SERIE_GLOBAL);var mainSerieMax=this.getMax(mainSerieId,ChartContext.SERIE_GLOBAL);var serieNewMin=null;var serieNewMax=null;if(mainSerieMin!=null&&mainSerieMin!=Double.POSITIVE_INFINITY){serieNewMin=mainSerieMin*minRatio;}
if(mainSerieMax!=null&&mainSerieMax!=Double.NEGATIVE_INFINITY){serieNewMax=mainSerieMax*maxRatio;}
this.setMin(mainSerieId,ChartContext.SERIE_GLOBAL,serieNewMin);this.setMax(mainSerieId,ChartContext.SERIE_GLOBAL,serieNewMax);this.setRange(DefaultLayout.Y1_AXIS_AREA,[serieNewMin,serieNewMax]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[globalMinPercentChange,globalMaxPercentChange]);if(serieNewMin==null||serieNewMax==null||(serieNewMax-serieNewMin)<ChartContext.PRECISION_THRESHOLD){this.precision=ChartContext.PRECISE_Y_PRECISION;}else{this.precision=ChartContext.GENERAL_Y_PRECISION;}};prototype.setSeriesMinMaxInRange=function(range,series){var serieCount=series.length;var extremums=this.data.getExtremums();if(extremums==null){return null;}
var startXValue=extremums[0];var endXValue=extremums[1];if(range!=null){var rangeStartXValue=range[0];var rangeEndXValue=range[1];if(!isNaN(rangeStartXValue)&&rangeStartXValue>=startXValue&&rangeStartXValue<=endXValue){startXValue=rangeStartXValue;}
if(!isNaN(rangeEndXValue)&&rangeEndXValue>=startXValue&&rangeEndXValue<=endXValue){endXValue=rangeEndXValue;}
if(rangeStartXValue>rangeEndXValue){startXValue=endXValue;}}
var globalMinPercentChange=Double.POSITIVE_INFINITY;var globalMaxPercentChange=Double.NEGATIVE_INFINITY;var globalMinXValue=startXValue;var globalMaxXValue=endXValue;for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentSerieMinIndex=currentSerie.findIndexClosestToXValue(startXValue);var currentSerieMaxIndex=currentSerie.findIndexClosestToXValue(endXValue);this.setMinIndex(serieId,currentSerieMinIndex,Serie.X);this.setMaxIndex(serieId,currentSerieMaxIndex,Serie.X);var currentSerieMinXValue=currentSerie.getValue(currentSerieMinIndex,Serie.X);var currentSerieMaxXValue=currentSerie.getValue(currentSerieMaxIndex,Serie.X);this.setMin(serieId,Serie.X,currentSerieMinXValue);this.setMax(serieId,Serie.X,currentSerieMaxXValue);this.setMin(serieId,Serie.CHANGE,Double.POSITIVE_INFINITY);this.setMax(serieId,Serie.CHANGE,Double.NEGATIVE_INFINITY);this.setMin(serieId,Serie.CHANGE_PERCENT,Double.POSITIVE_INFINITY);this.setMax(serieId,Serie.CHANGE_PERCENT,Double.NEGATIVE_INFINITY);this.setMin(serieId,ChartContext.SERIE_GLOBAL,Double.POSITIVE_INFINITY);this.setMax(serieId,ChartContext.SERIE_GLOBAL,Double.NEGATIVE_INFINITY);var mainFields=currentSerie.getMainFields();for(var index in mainFields){if(!(mainFields).hasOwnProperty(index))
continue;var currentField=mainFields[index];currentSerie.computeChangeValues(currentField);var currentMinPercentChange=Double.POSITIVE_INFINITY;var currentMaxPercentChange=Double.NEGATIVE_INFINITY;var currentFieldMinIndex=-1;var currentFieldMaxIndex=-1;for(var j=currentSerieMinIndex;j<=currentSerieMaxIndex;j++){var currentChangePercentValue=currentSerie.getValueAsDouble(j,Serie.CHANGE_PERCENT);if(currentChangePercentValue!=null&&!isNaN(currentChangePercentValue)&&currentChangePercentValue<currentMinPercentChange){currentMinPercentChange=currentChangePercentValue;currentFieldMinIndex=j;}
if(currentChangePercentValue!=null&&!isNaN(currentChangePercentValue)&&currentChangePercentValue>currentMaxPercentChange){currentMaxPercentChange=currentChangePercentValue;currentFieldMaxIndex=j;}}
var currentFieldMinValue=currentSerie.getValueAsDouble(currentFieldMinIndex,currentField);var currentFieldMaxValue=currentSerie.getValueAsDouble(currentFieldMaxIndex,currentField);var currentFieldMinChange=currentSerie.getValueAsDouble(currentFieldMinIndex,Serie.CHANGE);var currentFieldMaxChange=currentSerie.getValueAsDouble(currentFieldMaxIndex,Serie.CHANGE);var currentFieldMinPercent=currentSerie.getValueAsDouble(currentFieldMinIndex,Serie.CHANGE_PERCENT);var currentFieldMaxPercent=currentSerie.getValueAsDouble(currentFieldMaxIndex,Serie.CHANGE_PERCENT);var serieMinChange=this.getMin(serieId,Serie.CHANGE);var serieMaxChange=this.getMax(serieId,Serie.CHANGE);var serieMin=this.getMin(serieId,ChartContext.SERIE_GLOBAL);var serieMax=this.getMax(serieId,ChartContext.SERIE_GLOBAL);this.setMin(serieId,currentField,currentFieldMinValue);this.setMinIndex(serieId,currentFieldMinIndex,currentField);this.setMax(serieId,currentField,currentFieldMaxValue);this.setMaxIndex(serieId,currentFieldMaxIndex,currentField);this.setMin(serieId,Serie.CHANGE+currentField,currentFieldMinChange);this.setMin(serieId,Serie.CHANGE_PERCENT+currentField,currentFieldMinPercent);this.setMax(serieId,Serie.CHANGE+currentField,currentFieldMaxChange);this.setMax(serieId,Serie.CHANGE_PERCENT+currentField,currentFieldMaxPercent);if(currentFieldMinChange!=null&&currentFieldMinChange<serieMinChange){this.setMin(serieId,Serie.CHANGE,currentFieldMinChange);this.setMin(serieId,Serie.CHANGE_PERCENT,currentFieldMinPercent);}
if(currentFieldMaxChange!=null&&currentFieldMaxChange>serieMaxChange){this.setMax(serieId,Serie.CHANGE,currentFieldMaxChange);this.setMax(serieId,Serie.CHANGE_PERCENT,currentFieldMaxPercent);}
if(currentFieldMinValue!=null&&currentFieldMinValue<serieMin){this.setMin(serieId,ChartContext.SERIE_GLOBAL,currentFieldMinValue);}
if(currentFieldMaxValue!=null&&currentFieldMaxValue>serieMax){this.setMax(serieId,ChartContext.SERIE_GLOBAL,currentFieldMaxValue);}
if(currentMinPercentChange<globalMinPercentChange){globalMinPercentChange=currentMinPercentChange;this.globalMinRefValue=currentSerie.getReferenceValue();}
if(currentMaxPercentChange>globalMaxPercentChange){globalMaxPercentChange=currentMaxPercentChange;this.globalMaxRefValue=currentSerie.getReferenceValue();}
if(currentSerieMinXValue!=null&&currentSerieMinXValue<globalMinXValue){globalMinXValue=currentSerieMinXValue;}
if(currentSerieMaxXValue!=null&&currentSerieMaxXValue>globalMaxXValue){globalMaxXValue=currentSerieMaxXValue;}}}}
if(globalMinPercentChange==Double.POSITIVE_INFINITY||globalMaxPercentChange==Double.NEGATIVE_INFINITY){return null;}
this.setRange(Serie.X,[startXValue,endXValue]);return[globalMinPercentChange,globalMaxPercentChange];};prototype.adjustSeriesMinMax=function(series){var adjustedPercentRange=this.getRange(DefaultLayout.Y2_AXIS_AREA);if(adjustedPercentRange==null||adjustedPercentRange[0]==null||adjustedPercentRange[1]==null){return;}
var adjustedMinPercentChange=adjustedPercentRange[0];var adjustedMaxPercentChange=adjustedPercentRange[1];var serieCount=series.length;for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentRefValue=currentSerie.getReferenceValue();this.setMin(serieId,Serie.CHANGE_PERCENT,adjustedMinPercentChange);this.setMax(serieId,Serie.CHANGE_PERCENT,adjustedMaxPercentChange);var contextFields=currentSerie.getMainFields();for(var index in contextFields){if(!(contextFields).hasOwnProperty(index))
continue;var currentField=contextFields[index];var currentMinPercentChange=this.getMin(serieId,Serie.CHANGE_PERCENT+currentField);var currentMaxPercentChange=this.getMax(serieId,Serie.CHANGE_PERCENT+currentField);var minRatio=this.computeRatio(adjustedMinPercentChange,this.adjustRefValue,currentMinPercentChange,currentRefValue);var maxRatio=this.computeRatio(adjustedMaxPercentChange,this.adjustRefValue,currentMaxPercentChange,currentRefValue);var serieNewMin=this.getMin(serieId,currentField);var serieNewMax=this.getMax(serieId,currentField);serieNewMin*=minRatio;serieNewMax*=maxRatio;this.setMin(serieId,currentField,serieNewMin);this.setMax(serieId,currentField,serieNewMax);}}}};prototype.adjustY1Range=function(newY1Range){var newY1Min=newY1Range!=null?newY1Range[0]:null;var newY1Max=newY1Range!=null?newY1Range[1]:null;if(newY1Min!=null&&newY1Max!=null){var referenceValue=this.data.getMainSerie().getReferenceValue();this.adjustRefValue=referenceValue!=0.0?referenceValue:1.0;var adjustedMinPercent=100.0*(newY1Min-this.adjustRefValue)/Math.abs(this.adjustRefValue);var adjustedMaxPercent=100.0*(newY1Max-this.adjustRefValue)/Math.abs(this.adjustRefValue);this.setRange(DefaultLayout.Y1_AXIS_AREA,[newY1Min,newY1Max]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[adjustedMinPercent,adjustedMaxPercent]);}
this.adjustSeriesMinMax(this.data.getSeries());};prototype.adjustY2Range=function(newY2Range){if(newY2Range!=null){this.setRange(DefaultLayout.Y2_AXIS_AREA,[newY2Range[0],newY2Range[1]]);}
this.adjustSeriesMinMax(this.data.getSeries());};prototype.computeRatio=function(numeratorPercent,numeratorRef,denominatorPercent,denominatorRef){var numeratorRefValue=numeratorRef!=0?numeratorRef:1.0;var denominatorRefValue=denominatorRef!=0?denominatorRef:1.0;var numerator=numeratorRefValue>0?numeratorPercent+100:numeratorPercent-100;var denominator=denominatorRefValue>0?denominatorPercent+100:denominatorPercent-100;if(denominator==0){return 1.0;}
return Math.abs(numerator/denominator);};prototype.getXSpaceValueAtPosition=function(xPixel,chartWidthPixels){if(this.data!=null){var rangeStartXSpace=0;var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange!=null){rangeStartXSpace=this.data.normalizedXValue2XSpace(xRange[0]);}
var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);var interpolatedXSpaceValue=rangeStartXSpace;if(chartWidthPixels!=0){interpolatedXSpaceValue+=(xPixel/(chartWidthPixels-1.0))*(currentXSpaceSize-1);}
return interpolatedXSpaceValue;}
return null;};prototype.getNormalisedXValueAtPosition=function(x,width){return this.data.xSpace2NormalizedXValue(this.getXSpaceValueAtPosition(x,width));};prototype.getPositionFromXSpaceValue=function(xSpaceValue,width){var rangeStartXSpace=0.0;var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange!=null){rangeStartXSpace=this.data.normalizedXValue2XSpace(xRange[0]);}
var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);var position=xSpaceValue-rangeStartXSpace;if(currentXSpaceSize>1){position*=width/currentXSpaceSize;}
return position;};prototype.getPositionFromYValue=function(yValue,height,yRangeId,logScaleAllowed){var yRange=this.getRange(yRangeId);if(yRange==null||yRange[0]==null||yRange[1]==null){return null;}
var lowestValue=yRange[0];var highestValue=yRange[1];var ratio=1.0;if(this.logScale&&logScaleAllowed){var minLog=Math.log(lowestValue);ratio=(Math.log(yValue)-minLog)/(Math.log(highestValue)-minLog);}else{ratio=(yValue-lowestValue)/(highestValue-lowestValue);}
return(1-ratio)*height;};prototype.getYValueFromYPosition=function(pos,height,yRangeId,logScaleAllowed){var yRange=this.getRange(yRangeId);if(yRange==null||yRange[0]==null||yRange[1]==null||height<=0){return null;}
var lowestValue=yRange[0];var highestValue=yRange[1];var ratio=1.0-(pos/height);var yValue=0.0;if(this.logScale&&logScaleAllowed){var minLog=Math.log(lowestValue);yValue=Math.exp(ratio*(Math.log(highestValue)-minLog)+minLog);}else{yValue=ratio*(highestValue-lowestValue)+lowestValue;}
return yValue;};prototype.getClosestValues=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getValuesAtPosition(currentPositionOnGraph,chartWidth,false);};prototype.getClosestPointsFromCurrentPosition=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getDataPointsAtPosition(currentPositionOnGraph,chartWidth,false);};prototype.getPointsAtCurrentPosition=function(left,chartWidth){if(this.currentPosition==null){return null;}
if(left==null){left=0.0;}
var currentPositionOnGraph=stjs.trunc(Math.round(this.currentPosition.getX()-left));return this.getDataPointsAtPosition(currentPositionOnGraph,chartWidth,true);};prototype.getValuesAtPosition=function(xPosition,chartWidth,exactPosition){if(this.data==null){return null;}
var chartData=this.data;var serieCount=chartData.getSerieCount();var seriesValuesAtPosition={};for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var values=this.getSerieValuesAtPosition(currentSerie,xPosition,chartWidth,this.aggregationStrategy,currentSerie.getMainField(),exactPosition);seriesValuesAtPosition[serieId]=values;}}
return seriesValuesAtPosition;};prototype.getDataPointsAtPosition=function(xPosition,chartWidth,exactPosition){if(this.data==null){return null;}
var chartData=this.data;var empty=true;var serieCount=chartData.getSerieCount();var seriesDataPointsAtPosition={};for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var points=this.getSeriePointsAtPosition(currentSerie,xPosition,chartWidth,exactPosition);if(points!=null){seriesDataPointsAtPosition[serieId]=points;empty=false;}}}
if(empty){return null;}
return seriesDataPointsAtPosition;};prototype.getSerieValuesAtPosition=function(serie,xPosition,chartWidth,aggregationStrategy,mainField,exactPosition){if(serie==null){return null;}
return serie.getAggregatedValues(aggregationStrategy,this,xPosition,chartWidth,mainField,exactPosition);};prototype.getSeriePointsAtPosition=function(serie,xPosition,chartWidth,exactPosition){if(serie==null){return null;}
var indices=serie.getCorrespondingIndices(this,xPosition,chartWidth,exactPosition);if(indices!=null&&indices.length>0){var points=[];var pointsCount=indices.length;for(var i=0;i<pointsCount;i++){points.push(serie.getPoint(indices[i]));}
return points;}
return null;};prototype.getClosestDataPointPosition=function(serie,xPosition,areaBound,aggregationStrategy,mainField,which,maxStepDistance){if(serie==null){return null;}
if(which==null){which=mainField;}
var serieId=serie.getId();var chartWidth=stjs.trunc(areaBound.getContentWidth());var indices=serie.getCorrespondingIndices(this,xPosition,chartWidth,false);var valuesAtPosition=serie.getAggregatedValues(aggregationStrategy,this,xPosition,chartWidth,which,false);var valuesCountAtPosition=valuesAtPosition!=null?valuesAtPosition.length:0;var currentValue=Double.NEGATIVE_INFINITY;for(var i=0;i<valuesCountAtPosition;i++){var currentValueAtPosition=valuesAtPosition[i];if(currentValueAtPosition!=null&&currentValueAtPosition>currentValue){currentValue=valuesAtPosition[i];}}
if(indices==null||currentValue==Double.NEGATIVE_INFINITY){return null;}
var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);var closestXValue=serie.getXValue(indices[0]);var currentXSpaceSize=this.data.getCurrentXSpaceSize(xRange);if(xRange==null){xRange=this.data.getExtremums();}
if(currentXSpaceSize<=1){return null;}
var chartLeftPos=stjs.trunc(areaBound.getContentLeft());var chartTopPos=stjs.trunc(areaBound.getContentTop());var chartHeight=stjs.trunc(areaBound.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;var yMin=this.getMin(serieId,mainField);var yMax=this.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}
var heightRatio=chartHeight/(yMax-yMin);var xSpacePosition=this.data.normalizedXValue2XSpace(closestXValue);var startXSpacePosition=this.data.normalizedXValue2XSpace(xRange[0]);var currentXSpaceValue=this.getXSpaceValueAtPosition(xPosition,chartWidth);if(maxStepDistance!=null&&Math.abs(xSpacePosition-currentXSpaceValue)>maxStepDistance){return null;}
var ratio=(xSpacePosition-startXSpacePosition)/(currentXSpaceSize-1);var xCoordinate=stjs.trunc(Math.round(ratio*chartWidth+chartLeftPos));var yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));return new Point2D(xCoordinate,yCoordinate);};prototype.getData=function(){return this.data;};prototype.getCurrentPosition=function(){return this.currentPosition;};prototype.setCurrentPosition=function(currentPosition){this.currentPosition=currentPosition;};prototype.getPrecision=function(){return this.precision;};prototype.getMainSerieId=function(){if(this.data==null||this.data.getMainSerie()==null){return null;}
return this.data.getMainSerie().getId();};prototype.getZoomIconId=function(){return this.zoomIconId;};prototype.setZoomIconId=function(zoomIconId){this.zoomIconId=zoomIconId;};prototype.getRange=function(rangeId){return this.ranges[rangeId];};prototype.setRange=function(rangeId,values){this.ranges[rangeId]=values;};prototype.getLabelsPosition=function(rangeId){return this.labelsPosition[rangeId];};prototype.setLabelsPosition=function(labelsId,values){this.labelsPosition[labelsId]=values;};prototype.getFormat=function(formatId){return this.formats[formatId];};prototype.setFormat=function(formatId,format){this.formats[formatId]=format;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},currentPosition:"Point2D",ranges:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},labelsPosition:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},formats:{name:"Map",arguments:[null,null]},seriesMinValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMaxValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMinIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},seriesMaxIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]}},{});
var EngineModel=function(){this.context=new ChartContext();this.engines={};};EngineModel=stjs.extend(EngineModel,null,[],function(constructor,prototype){prototype.context=null;prototype.engines=null;prototype.drawEngine=null;prototype.tooltipEngine=null;prototype.titleEngine=null;prototype.xAxisEngine=null;prototype.y1AxisEngine=null;prototype.y2AxisEngine=null;prototype.legendEngine=null;prototype.graphEngine=null;prototype.init=function(options){};prototype.reset=function(){};prototype.updateRange=function(xRange,chartView,chartData){};prototype.updateGraphEngine=function(options){};prototype.updatePosition=function(x,y){};prototype.createMainGraphics=function(chartView,chartData){};prototype.createInteractiveGraphics=function(chartView,chartData){};prototype.setCustomMainAxisMinMax=function(customMainAxisMinMax){};prototype.setSettings=function(string,newPeriod){};prototype.getContext=function(){return this.context;};prototype.setContext=function(context){this.context=context;};prototype.getEngine=function(engineId){if(engineId!=null){return this.engines[engineId];}else{return null;}};prototype.getXSpaceValueAt=function(chartView,xPos){};prototype.updateXType=function(xType){};prototype.getEngines=function(){return this.engines;};},{context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var DefaultEngineModel=function(){EngineModel.call(this);};DefaultEngineModel=stjs.extend(DefaultEngineModel,EngineModel,[],function(constructor,prototype){prototype.aggregationStrategy=null;prototype.mainField=null;prototype.dynamicXAxisData=false;prototype.customMainAxisMinMax=null;prototype.reset=function(){};prototype.init=function(options){this.mainField=Serie.Y;if(options!=null&&options.getMainSerieField()!=null){this.mainField=options.getMainSerieField();}
this.aggregationStrategy=options.getAggregationStrategy();if(this.aggregationStrategy==null){this.aggregationStrategy=AggregationStrategy.AVERAGE;}
this.dynamicXAxisData=options.isDynamicXAxisData();this.customMainAxisMinMax=options.getMainAxisMinMax();this.tooltipEngine=new DefaultToolTipEngine(options);this.titleEngine=new DefaultTitleEngine(options);this.xAxisEngine=new DefaultXAxisEngine(options);this.y1AxisEngine=new DefaultY1AxisEngine(options);this.y2AxisEngine=new DefaultY2AxisEngine(options);this.legendEngine=new DefaultLegendEngine(options);this.graphEngine=new GraphEngine(options);if(options.isAllowOverlayDrawing()){this.drawEngine=new DefaultDrawEngine(options);this.drawEngine.addAllowedArea(DefaultLayout.GRAPH_AREA,DefaultLayout.Y1_AXIS_AREA);}
this.extend(options);this.engines[DefaultLayout.TITLE_AREA]=this.titleEngine;this.engines[DefaultLayout.X_AXIS_AREA]=this.xAxisEngine;this.engines[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisEngine;this.engines[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisEngine;this.engines[DefaultLayout.GRAPH_AREA]=this.graphEngine;this.engines[DefaultLayout.LEGEND_AREA]=this.legendEngine;this.engines[DefaultLayout.TOOLTIP_AREA]=this.tooltipEngine;this.engines[DrawEngine.ID]=this.drawEngine;};prototype.extend=function(options){if(options!=null){var customEngineModel=options.getCustomEngineModel();if(customEngineModel!=null){if((customEngineModel)["init"]!=null){options.setCustomeEngineModel(null);customEngineModel.init(options);options.setCustomeEngineModel(customEngineModel);}
var validEngines={};var tmp={};this.extendEngine(customEngineModel,validEngines,"titleEngine");this.extendEngine(customEngineModel,validEngines,"xAxisEngine");this.extendEngine(customEngineModel,validEngines,"y1AxisEngine");this.extendEngine(customEngineModel,validEngines,"y2AxisEngine");this.extendEngine(customEngineModel,validEngines,"graphEngine");this.extendEngine(customEngineModel,validEngines,"legendEngine");this.extendEngine(customEngineModel,validEngines,"tooltipEngine");if(options.isAllowOverlayDrawing()){this.extendEngine(customEngineModel,validEngines,"drawEngine");}
SQW.$.extend(true,tmp,customEngineModel,validEngines);SQW.$.extend(true,this,tmp);}}};prototype.extendEngine=function(customEngineModel,validEngines,engineName){if((customEngineModel)[engineName]!=null){(validEngines)[engineName]=SQW.$.extend((this)[engineName],(customEngineModel)[engineName]);}};prototype.updateRange=function(xRange,chartView,chartData){this.context.setRange(DefaultLayout.X_AXIS_AREA,xRange);this.context.update(chartData,this.aggregationStrategy);this.setCustomMinMaxAxis(chartData.getMainSerie());var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var mainYAxis=this.engines[DefaultLayout.Y1_AXIS_AREA];var step=mainYAxis.computePrettyLabels(graphArea,this.context.getRange(DefaultLayout.Y1_AXIS_AREA),this.context.getPrecision(),chartView.getStyleModel().getY1AxisStyle(),chartData.isLogScale());if(step==1||step>=5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"0");}else if(step==0.1||step>=0.5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"1");}else if(step>=0.01||ArrayUtil.getRangeSpan(mainYAxis.getRange())>=0.01){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"2");}else{this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,"4");}
if(step!=null){this.context.adjustY1Range(mainYAxis.getRange());this.context.setLabelsPosition(DefaultLayout.Y1_AXIS_AREA,mainYAxis.getLabelsPosition());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,mainYAxis.getLabelsPosition());}else{var y2Axis=this.engines[DefaultLayout.Y2_AXIS_AREA];this.context.adjustY2Range(y2Axis.getRange());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,y2Axis.getLabelsPosition());}
for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.update(chartView,chartData,this.context);}}};prototype.setCustomMinMaxAxis=function(mainSerie){if(this.customMainAxisMinMax!=null){var mainSerieId=mainSerie!=null?mainSerie.getId():null;var customMin=this.customMainAxisMinMax[0];var customMax=this.customMainAxisMinMax[1];if((customMin==null||isNaN(customMin))&&mainSerieId!=null){customMin=this.context.getMin(mainSerieId,Serie.Y);}
if((customMax==null||isNaN(customMax))&&mainSerieId!=null){customMax=this.context.getMax(mainSerieId,Serie.Y);}
this.context.setRange(DefaultLayout.Y1_AXIS_AREA,[customMin,customMax]);}};prototype.updatePosition=function(x,y){if(x!=null&&y!=null){this.context.setCurrentPosition(new Point2D(stjs.trunc(Math.round(x)),stjs.trunc(Math.round(y))));}};prototype.createMainGraphics=function(chartView,data){for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.createMainGraphics(chartView,data,this.context);}}};prototype.createInteractiveGraphics=function(chartView,data){for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.createInteractiveGraphics(chartView,data,this.context);}}};prototype.getXSpaceValueAt=function(chartView,xPos){var graph=chartView.getArea(DefaultLayout.GRAPH_AREA);if(graph!=null&&graph.getAreaBound()!=null){var graphBound=graph.getAreaBound();return this.context.getXSpaceValueAtPosition(xPos,graphBound.getContentWidth());}
return null;};prototype.updateXType=function(xType){if(this.dynamicXAxisData){var xAxisEngine=this.engines[DefaultLayout.X_AXIS_AREA];var formatter=xAxisEngine.getLabelsFormatter();if(formatter.getFormatterType()!=null&&formatter.getFormatterType()==xType){return;}else if(xType==Formatter.DataType.DATE){xAxisEngine.setLabelsFormatter(new DateTimeFormatter());}else if(xType==Formatter.DataType.NUMBER){xAxisEngine.setLabelsFormatter(new AbbreviateNumberFormatter());}else if(xType==Formatter.DataType.STRING){xAxisEngine.setLabelsFormatter(new StringFormatter());}}};prototype.updateGraphEngine=function(options){var graphEngine=this.engines[DefaultLayout.GRAPH_AREA];graphEngine.updateDefaultEngine(options);};prototype.getCustomMainAxisMinMax=function(){return this.customMainAxisMinMax;};prototype.setCustomMainAxisMinMax=function(customMainAxisMinMax){this.customMainAxisMinMax=customMainAxisMinMax;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},customMainAxisMinMax:{name:"Array",arguments:[null]},context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var Engine=function(){};Engine=stjs.extend(Engine,null,[],function(constructor,prototype){prototype.correspondingAreaId=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};prototype.createBackground=function(layer,area,style){var backgroundColor=style.getBackgroundColor();var areaBound=area.getAreaBound();if(backgroundColor!=null){var x=stjs.trunc(Math.floor(areaBound.getLeft()));var y=stjs.trunc(Math.floor(areaBound.getTop()));var width=stjs.trunc(Math.ceil(areaBound.getOuterWidth(true)));var height=stjs.trunc(Math.ceil(areaBound.getOuterHeight(true)));var background=ChartElementFactory.createRect(layer,x,y,width,height);background.setFillColor(backgroundColor);background.setFillColorGradientParam(style.getBackgroundColorGradientParams());area.addElement(background);}};prototype.createBorders=function(layer,area,style){var areaBound=area.getAreaBound();var borderLeftPos=stjs.trunc((areaBound.getLeft()+areaBound.getMarginLeft()));var borderLeftSize=stjs.trunc(areaBound.getBorderLeft());var borderTopPos=stjs.trunc((areaBound.getTop()+areaBound.getMarginTop()));var borderTopSize=stjs.trunc(areaBound.getBorderTop());var borderRightPos=stjs.trunc((areaBound.getInnerLeft()+areaBound.getInnerWidth()));var borderRightSize=stjs.trunc(areaBound.getBorderRight());var borderBottomPos=stjs.trunc((areaBound.getInnerTop()+areaBound.getInnerHeight()));var borderBottomSize=stjs.trunc(areaBound.getBorderBottom());var borderLeftColor=ChartColor.black;var borderTopColor=ChartColor.black;var borderRightColor=ChartColor.black;var borderBottomColor=ChartColor.black;if(style!=null){borderLeftColor=style.getBorderLeftColor();borderTopColor=style.getBorderTopColor();borderRightColor=style.getBorderRightColor();borderBottomColor=style.getBorderBottomColor();}
if(borderLeftSize>0){this.createBorder(layer,area,borderLeftPos,borderTopPos,borderLeftPos,borderBottomPos+1,borderLeftSize,borderLeftColor,null);}
if(borderTopSize>0){this.createBorder(layer,area,borderLeftPos,borderTopPos,borderRightPos+1,borderTopPos,borderTopSize,borderTopColor,null);}
if(borderRightSize>0){this.createBorder(layer,area,borderRightPos,borderTopPos,borderRightPos,borderBottomPos+1,borderRightSize,borderRightColor,null);}
if(borderBottomSize>0){this.createBorder(layer,area,borderLeftPos,borderBottomPos,borderRightPos+1,borderBottomPos,borderBottomSize,borderBottomColor,null);}};prototype.createBorder=function(layer,area,startX,startY,endX,endY,size,color,gradientsParam){var border=ChartElementFactory.createLine(layer,startX,startY,endX,endY,size);border.setStrokeColor(color);border.setStrokeColorGradientParam(gradientsParam);area.addElement(border);};prototype.getCorrespondingAreaId=function(){return this.correspondingAreaId;};prototype.setCorrespondingAreaId=function(correspondingAreaId){this.correspondingAreaId=correspondingAreaId;};},{},{});
var AxisEngine=function(options){Engine.call(this);this.options=options;};AxisEngine=stjs.extend(AxisEngine,Engine,[],function(constructor,prototype){prototype.position=null;prototype.labelsFormatter=null;prototype.range=null;prototype.labelsPosition=null;prototype.associatedGraphId=null;prototype.options=null;prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){};prototype.createTicks=function(layer,area,context,style){};prototype.createLabels=function(layer,chartView,chartData,area,context,style){};prototype.getRange=function(){return this.range;};prototype.setRange=function(range){this.range=range;};prototype.getLabelsFormatter=function(){return this.labelsFormatter;};prototype.setLabelsFormatter=function(labelsFormatter){this.labelsFormatter=labelsFormatter;};prototype.getLabelsPosition=function(){return this.labelsPosition;};prototype.setLabelsPosition=function(labelsPosition){this.labelsPosition=labelsPosition;};prototype.setFormat=function(format){if(this.labelsFormatter!=null){this.labelsFormatter.setFormat(format);}};prototype.getPosition=function(){return this.position;};prototype.setPosition=function(position){this.position=position;};},{position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var GraphEngine=function(options){Engine.call(this);this.copyright=StringUtil.getCopyright();this.aggregationStrategy=options.getAggregationStrategy();if(this.aggregationStrategy==null){this.aggregationStrategy=AggregationStrategy.AVERAGE;}
this.showCopyright=options.isShowCopyright()&&options.isPopOverAllowed();this.correspondingAreaId=DefaultLayout.GRAPH_AREA;this.showTooltip=options.isShowToolTip();this.barType=options.getBarType();this.updateDefaultEngine(options);};GraphEngine=stjs.extend(GraphEngine,Engine,[],function(constructor,prototype){constructor.COPYRIGHT_PADDING=5;prototype.aggregationStrategy=null;prototype.chartData=null;prototype.showCopyright=false;prototype.showTooltip=false;prototype.copyright=null;prototype.defaultType=null;prototype.barType=null;prototype.update=function(chartView,chartData,context){this.chartData=chartData;var series=chartData.getSeries();};prototype.createMainGraphics=function(chartView,chartData,context){var groundLayer=chartView.getGroundLayer();var graphArea=chartView.getArea(this.correspondingAreaId);var graphStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(graphArea==null||graphArea.getAreaBound()==null||!graphArea.getAreaBound().isVisible()){return;}
this.createBackground(groundLayer,graphArea,graphStyle);this.createBorders(groundLayer,graphArea,graphStyle);this.createBackgroundGrid(groundLayer,graphArea,graphStyle,context.getLabelsPosition(DefaultLayout.X_AXIS_AREA),context.getLabelsPosition(DefaultLayout.Y1_AXIS_AREA));if(this.showCopyright){this.createCopyrightLabel(groundLayer,chartView,graphArea,graphStyle);}
var mainLayer=chartView.getMainLayer();var serieCount=chartData.getSerieCount();for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null){var graphEngine=this.getGraphEngine(currentSerie.getType());if(graphEngine!=null){graphEngine.createGraphElement(mainLayer,graphArea,currentSerie,context,graphStyle);}}}
for(var i=0;i<serieCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null){var graphEngine=this.getGraphEngine(currentSerie.getType());if(graphEngine!=null){graphEngine.createForegroundElements(groundLayer,graphArea,context,graphStyle);}}}};prototype.getGraphEngine=function(serieType){var type=serieType==null?this.defaultType:serieType;if(type==Chart.ChartType.LINE){return DefaultLineGraphEngine.getInstance();}else if(type==Chart.ChartType.POINT){return DefaultPointGraphEngine.getInstance();}else if(type==Chart.ChartType.AREA){return DefaultAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.BAR){var barGraphEngine=DefaultBarGraphEngine.getInstance();barGraphEngine.setBarType(this.barType);return barGraphEngine;}else if(type==Chart.ChartType.BID_ASK){return BidAskAreaEngine.getInstance();}else if(type==Chart.ChartType.NONE){return null;}else{return DefaultLineGraphEngine.getInstance();}};prototype.createCopyrightLabel=function(layer,chartView,area,style){if(!this.showCopyright||this.copyright==null){return;}
var fontSize=style.getCopyrightFontSize();var isBold=style.isCopyrightBold();var copyrightWidth=chartView.getTextWidth(this.copyright,style.getFont(),fontSize,isBold);var areaBound=area.getAreaBound();var xPos=stjs.trunc(Math.round(areaBound.getInnerLeft()+areaBound.getInnerWidth()-GraphEngine.COPYRIGHT_PADDING));var yPos=stjs.trunc((areaBound.getInnerTop()+GraphEngine.COPYRIGHT_PADDING));var copyrightLabel=ChartElementFactory.createLabel(layer,0.0,this.copyright,xPos,yPos,copyrightWidth,stjs.trunc(areaBound.getContentHeight()));copyrightLabel.setAlign(Label.ALIGN_RIGHT);copyrightLabel.setBaseline(Label.BASELINE_TOP);copyrightLabel.setColor(style.getCopyrightColor());copyrightLabel.setFontSize(fontSize);copyrightLabel.setBold(isBold);area.addElement(copyrightLabel);};prototype.getAggregatedValuesAtPosition=function(serie,context,position,chartWidth,exactPosition){if(serie==null){return null;}
return serie.getAggregatedValues(this.aggregationStrategy,context,position,chartWidth,serie.getMainField(),exactPosition);};prototype.createBackgroundGrid=function(layer,area,style,xLabelsPosition,yLabelsPosition){var gridLinesWidth=style.getBackgroundGridLineWidth();var gridStyle=style.getBackgroundGridStyle();var gridColor=style.getBackgroundGridColor();var gridColorGradientParam=style.getBackgroundGridColorGradientParams();this.createGrid(layer,area,gridLinesWidth,gridStyle,gridColor,gridColorGradientParam,xLabelsPosition,yLabelsPosition);};prototype.createGrid=function(layer,area,gridLinesWidth,gridStyle,gridColor,gridColorGradientParam,xLabelsPosition,yLabelsPosition){var areaBound=area.getAreaBound();var xInnerStart=stjs.trunc(areaBound.getInnerLeft());var yInnerStart=stjs.trunc(areaBound.getInnerTop());var xInnerEnd=stjs.trunc((areaBound.getInnerWidth()+xInnerStart));var yInnerEnd=stjs.trunc((areaBound.getInnerHeight()+yInnerStart));var showHorizontalLines=true;var showVerticalLines=true;var ignoreFirstLine=false;var dashedLines=false;if(gridStyle==null||gridStyle==GraphStyle.NONE_GRID_STYLE){return;}else if(gridStyle==GraphStyle.DASHED_GRID_STYLE){dashedLines=true;}else if(gridStyle==GraphStyle.CLASSIC_GRID_STYLE){ignoreFirstLine=true;}else if(gridStyle==GraphStyle.HORIZONTAL_GRID_STYLE){showVerticalLines=false;}else if(gridStyle==GraphStyle.VERTICAL_GRID_STYLE){showHorizontalLines=false;}
if(gridColor==null){gridColor=ChartColor.grey;}
if(showHorizontalLines){var lineCount=0;if(yLabelsPosition!=null){lineCount=yLabelsPosition.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=1.0-yLabelsPosition[i];if(currentRelativePosition!=null&&currentRelativePosition>=-MathUtil.EPSILON&&currentRelativePosition<=(1+MathUtil.EPSILON)){var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*areaBound.getContentHeight()));var horizontalLine=ChartElementFactory.createLine(layer,xInnerStart,yCenter,xInnerEnd,yCenter,gridLinesWidth);horizontalLine.setStrokeColor(gridColor);horizontalLine.setStrokeColorGradientParam(gridColorGradientParam);horizontalLine.setDashed(dashedLines);area.addElement(horizontalLine);}}}
if(showVerticalLines){var lineCount=0;if(xLabelsPosition!=null){lineCount=xLabelsPosition.length;}
var i=0;if(ignoreFirstLine){i++;}
for(;i<lineCount;i++){var currentRelativePosition=xLabelsPosition[i];if(currentRelativePosition!=null&&currentRelativePosition>=-MathUtil.EPSILON&&currentRelativePosition<=(1+MathUtil.EPSILON)){var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+currentRelativePosition*areaBound.getContentWidth()));var verticalLine=ChartElementFactory.createLine(layer,xCenter,yInnerStart,xCenter,yInnerEnd,gridLinesWidth);verticalLine.setStrokeColor(gridColor);verticalLine.setStrokeColorGradientParam(gridColorGradientParam);verticalLine.setDashed(dashedLines);area.addElement(verticalLine);}}}};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var graphArea=chartView.getArea(this.correspondingAreaId);var graphStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(graphArea.isPointInside(context.getCurrentPosition())&&!chartData.isEmpty()){var type=graphStyle.getHighlightType();if(type==null){return;}
this.createPositionLines(layer,graphArea,context,graphStyle);if(type.indexOf(GraphStyle.CIRCLE_HIGHLIGHT)!=-1){this.createCircleHighlights(layer,chartView,graphArea,context,graphStyle,chartData);}
if(type.indexOf(GraphStyle.COLOR_HIGHLIGHT)!=-1){this.createColorHighlight(layer,chartView,graphArea,context,graphStyle);}}};prototype.createPositionLines=function(layer,area,context,style){var type=style.getHighlightType();var position=context.getCurrentPosition();var x=position.getX();var y=position.getY();var bound=area.getAreaBound();var xInnerStart=stjs.trunc(bound.getInnerLeft());var yInnerStart=stjs.trunc(bound.getInnerTop());var xInnerEnd=stjs.trunc((bound.getInnerWidth()+xInnerStart));var yInnerEnd=stjs.trunc((bound.getInnerHeight()+yInnerStart));if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.VERTICAL_LINE_HIGHLIGHT)!=-1&&(x>=xInnerStart&&x<=xInnerEnd)){var verticalLine=ChartElementFactory.createLine(layer,x,yInnerStart,x,yInnerEnd,style.getHighlightLineWidth());verticalLine.setStrokeColor(style.getHighlightLineColor());verticalLine.setStrokeColorGradientParam(style.getHighlightLineColorGradientParams());area.addElement(verticalLine);}
if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.HORIZONTAL_LINE_HIGHLIGHT)!=-1&&(y>=yInnerStart&&y<=yInnerEnd)){var horizontalLine=ChartElementFactory.createLine(layer,xInnerStart,y,xInnerEnd,y,style.getHighlightLineWidth());horizontalLine.setStrokeColor(style.getHighlightLineColor());horizontalLine.setStrokeColorGradientParam(style.getHighlightLineColorGradientParams());area.addElement(horizontalLine);}};prototype.createCircleHighlights=function(layer,chartView,graphArea,context,style,chartData){var graphBound=graphArea.getAreaBound();var currentPosition=context.getCurrentPosition();if(currentPosition==null){return;}
var currentPositionOnGraph=stjs.trunc(Math.round(currentPosition.getX()-graphBound.getContentLeft()));var seriesCount=chartData.getSerieCount();var styleField=style!=null?style.getHighlightField():null;for(var i=0;i<seriesCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var mainField=currentSerie.getMainField();var which=styleField==null?mainField:styleField;var closestDataPointPosition=context.getClosestDataPointPosition(currentSerie,currentPositionOnGraph,graphBound,this.aggregationStrategy,mainField,which,300*currentSerie.getXSpaceScale());if(closestDataPointPosition!=null&&graphArea.isPointInside(closestDataPointPosition)){this.createCircleHighlight(layer,closestDataPointPosition,graphArea,currentSerie,style);}}}};prototype.createCircleHighlight=function(layer,position,area,serie,style){var circleHighlight=ChartElementFactory.createCircle(layer,position.getX(),position.getY(),style.getCircleHighlightRadius());circleHighlight.setStrokeColor(serie.getColor());circleHighlight.setLineWidth(style.getCircleHighlightLineWidth());area.addElement(circleHighlight);};prototype.createColorHighlight=function(layer,chartView,area,context,style){var position=context.getCurrentPosition();var x=position.getX();var y=position.getY();var closestShape=chartView.getClosestShapesAtPosition(x,y);if(closestShape==null||closestShape.getData()==null){return;}
var hoverShape=closestShape.copyTo(layer);hoverShape.hover();};prototype.updateDefaultEngine=function(options){this.defaultType=Chart.ChartType.valueOf(options.getType());};prototype.getDefaultType=function(){return this.defaultType;};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},defaultType:{name:"Enum",arguments:["Chart.ChartType"]}},{});
var LegendEngine=function(options){Engine.call(this);this.isVisible=options.isShowLegend();};LegendEngine=stjs.extend(LegendEngine,Engine,[],function(constructor,prototype){prototype.isVisible=false;},{},{});
var TitleEngine=function(options){Engine.call(this);};TitleEngine=stjs.extend(TitleEngine,Engine,[],function(constructor,prototype){prototype.associatedGraphId=null;prototype.associatedAxisId=null;prototype.getAssociatedGraphId=function(){return this.associatedGraphId;};prototype.setAssociatedGraphId=function(associatedGraphId){this.associatedGraphId=associatedGraphId;};prototype.getAssociatedAxisId=function(){return this.associatedAxisId;};prototype.setAssociatedAxisId=function(associatedAxisId){this.associatedAxisId=associatedAxisId;};},{},{});
var ToolTipEngine=function(options){Engine.call(this);this.options=options;};ToolTipEngine=stjs.extend(ToolTipEngine,Engine,[],function(constructor,prototype){prototype.options=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};prototype.customPlacement=function(tooltipArea,chartView){};prototype.customEvent=function(chartView,chartData,context){};},{options:"ChartOption"},{});
var DrawEngine=function(options){Engine.call(this);this.allowedDrawAreaIds=[];this.selectCallbacks={};this.drawnCallbacks={};this.associatedAxes={};this.drawElements=[];this.currentDrawType=InteractiveShapeFactory.SEGMENT_TYPE;this.currentMode=DrawEngine.DRAW_MODE;this.showElements=true;};DrawEngine=stjs.extend(DrawEngine,Engine,[],function(constructor,prototype){constructor.ID="drawEngineId";constructor.DRAWING_LAYER_ID="drawingLayer";constructor.DRAWING_LAYER_Z_INDEX=3;prototype.currentGroupId=null;constructor.DRAW_MODE="drawMode";constructor.MOVE_MODE="moveMode";prototype.selectCallbacks=null;prototype.drawnCallbacks=null;prototype.allowedDrawAreaIds=null;prototype.associatedAxes=null;prototype.drawElements=null;prototype.currentMode=null;prototype.currentDrawType=null;prototype.selectedElement=null;prototype.showElements=false;prototype.clearInteractiveShapes=function(){this.drawElements=[];};prototype.addAllowedArea=function(areaId,associatedAxis){this.allowedDrawAreaIds.push(areaId);this.associatedAxes[areaId]=associatedAxis;};prototype.removeAllowedArea=function(areaId){var index=this.allowedDrawAreaIds.indexOf(areaId);if(index!=-1){this.allowedDrawAreaIds.splice(index,1);delete this.associatedAxes[areaId];}};prototype.getAllowedDrawAreaIds=function(){return this.allowedDrawAreaIds;};prototype.setAllowedDrawAreaIds=function(allowedDrawAreaIds){this.allowedDrawAreaIds=allowedDrawAreaIds;};prototype.getAssociatedAxes=function(){return this.associatedAxes;};prototype.setAssociatedAxes=function(associatedAxes){this.associatedAxes=associatedAxes;};prototype.getDrawElements=function(){return this.drawElements;};prototype.setSelectedElements=function(selectedElements){this.selectedElement=null;if(selectedElements!=null){this.drawElements=selectedElements;}else{this.drawElements=[];}};prototype.getSelectedElement=function(){return this.selectedElement;};prototype.setSelectedElement=function(selectedElement){this.elementSelected();this.selectedElement=selectedElement;};prototype.deleteSelectedElement=function(){this.selectedElement=null;};prototype.serializeFigures=function(associatedAreaId,groupId){var serializedFigures=[];for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var figure=this.drawElements[index];if(figure!=null&&(associatedAreaId==null||associatedAreaId==figure.getAssociatedAreaId())&&(groupId==null||groupId==figure.getGroupId())){serializedFigures.push(figure.serialize());}}
return serializedFigures;};prototype.getInteractiveShapeAtPosition=function(view,offsetX,offsetY){if(this.selectedElement!=null&&this.selectedElement.isComplete()&&this.selectedElement.isInsideCurrentShape(view,offsetX,offsetY)){return this.selectedElement;}
for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var currentShape=this.drawElements[index];if(currentShape!=null&&currentShape.isInsideCurrentShape(view,offsetX,offsetY)){return currentShape;}}
return null;};prototype.elementSelected=function(){if(this.selectedElement!=null&&this.selectedElement.isComplete()){if(this.drawElements.indexOf(this.selectedElement)==-1){this.drawElements.push(this.selectedElement);}
this.selectedElement=null;}};prototype.isAllowed=function(areaId){return areaId!=null&&this.allowedDrawAreaIds.indexOf(areaId)!=-1;};prototype.getAxisAssociatedWith=function(areaId){return this.associatedAxes[areaId];};prototype.startDrawAt=function(chart,offsetX,offsetY){};prototype.createShape=function(chart,offsetX,offsetY){};prototype.getCurrentMode=function(){return this.currentMode;};prototype.updateMode=function(newMode){this.elementSelected();this.selectedElement=null;this.currentMode=newMode;};prototype.getCurrentDrawType=function(){return this.currentDrawType;};prototype.updateDrawType=function(newDrawType){this.elementSelected();this.selectedElement=null;this.currentDrawType=newDrawType;};prototype.endDrawAt=function(chart,offsetX,offsetY){};prototype.getDrawingLayer=function(view){var layer=view.getLayer(DrawEngine.DRAWING_LAYER_ID);if(layer==null){layer=view.addAdditionalLayer(DrawEngine.DRAWING_LAYER_ID,DrawEngine.DRAWING_LAYER_Z_INDEX);}
return layer;};prototype.isShowElements=function(){return this.showElements;};prototype.setShowElements=function(showElements){this.elementSelected();this.showElements=showElements;};prototype.isPointInsideShape=function(view,offsetX,offsetY){for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var shape=this.drawElements[index];if(shape!=null&&shape.isInsideCurrentShape(view,offsetX,offsetY)){return true;}}
return false;};prototype.applyStyleToCurrentElement=function(chart){if(this.selectedElement==null){return;}
var currentDrawStyle=chart.getChartView().getStyleModel().getStyle(DrawStyle.ID);var strokeColor=ChartColor.black;var strokeStyle="solid";var fillColor=ChartColor.transparent;var textColor=ChartColor.black;var textSize=12;if(currentDrawStyle!=null){strokeColor=currentDrawStyle.getLineColor();strokeStyle=currentDrawStyle.getLineStyle();fillColor=currentDrawStyle.getBackgroundColor();textColor=currentDrawStyle.getTextColor();textSize=currentDrawStyle.getFontSize();}
if(strokeColor!=null&&strokeColor.getFlatColor()!=null){this.selectedElement.setStrokeColor(strokeColor);}
if(strokeStyle!=""){this.selectedElement.setLineStyle(strokeStyle);}
if(fillColor!=null&&fillColor.getFlatColor()!=null){this.selectedElement.setFillColor(fillColor);}
if(textColor!=null&&textColor.getFlatColor()!=null){this.selectedElement.setTextColor(textColor);}
if(this.selectedElement.getFontSize()!=textSize){this.selectedElement.setFontSize(textSize);chart.reRender();}};prototype.fireOnSelectElementCallbacks=function(selectedShape){for(var index in this.selectCallbacks){var currentCallback=this.selectCallbacks[index];if(currentCallback!=null){currentCallback(selectedShape);}}};prototype.fireOnElementChangedCallbacks=function(drawnShape){for(var index in this.drawnCallbacks){var currentCallback=this.drawnCallbacks[index];if(currentCallback!=null){currentCallback(drawnShape);}}};prototype.endSelectedElementChange=function(){this.fireOnElementChangedCallbacks(this.selectedElement);};prototype.registerOnSelectElementCallback=function(id,onSelectCallback){if(id!=null&&onSelectCallback!=null){this.selectCallbacks[id]=onSelectCallback;}};prototype.unregisterOnSelectElementCallback=function(id){if(id!=null){delete this.selectCallbacks[id];}};prototype.registerOnElementChangedCallback=function(id,onElementDrawnCallback){if(id!=null&&onElementDrawnCallback!=null){this.drawnCallbacks[id]=onElementDrawnCallback;}};prototype.unregisterOnElementChangedCallback=function(id){if(id!=null){delete this.drawnCallbacks[id];}};prototype.getCurrentGroupId=function(){return this.currentGroupId;};prototype.setCurrentGroupId=function(currentGroupId){this.currentGroupId=currentGroupId;};},{selectCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},drawnCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},allowedDrawAreaIds:{name:"Array",arguments:[null]},associatedAxes:{name:"Map",arguments:[null,null]},drawElements:{name:"Array",arguments:["InteractiveShape"]},selectedElement:"InteractiveShape"},{});
var DefaultLegendEngine=function(options){LegendEngine.call(this,options);this.correspondingAreaId=DefaultLayout.LEGEND_AREA;};DefaultLegendEngine=stjs.extend(DefaultLegendEngine,LegendEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){var legendStyle=chartView.getStyleModel().getLegendStyle();if(legendStyle!=null){this.isVisible=legendStyle.isVisible();}else{this.isVisible=false;}};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){};},{},{});
var DefaultTitleEngine=function(options){TitleEngine.call(this,options);this.copyright=StringUtil.getCopyright();this.title=options.getTitle();this.alternateTitle=options.getAlternateTitle();this.showCopyright=options.isShowCopyright();this.showTitle=options.isShowTitle();this.showValue=options.isShowValueInTitle();this.showEnlargeIcon=options.isPopOverAllowed();this.displayedTitle=this.title;this.valueFormatter=new AbbreviateNumberFormatter();this.correspondingAreaId=DefaultLayout.TITLE_AREA;this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.associatedAxisId=DefaultLayout.Y1_AXIS_AREA;this.usedWidth=0;};DefaultTitleEngine=stjs.extend(DefaultTitleEngine,TitleEngine,[],function(constructor,prototype){constructor.MIN_SEPARATION_WIDTH=15;constructor.ICON_ID="enlargeIconId";prototype.displayedTitle=null;prototype.title=null;prototype.alternateTitle=null;prototype.copyright=null;prototype.value=null;prototype.currentIcon=null;prototype.showCopyright=false;prototype.showEnlargeIcon=false;prototype.showTitle=false;prototype.showValue=false;prototype.usedWidth=0;prototype.rightWidth=0;prototype.valueFormatter=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var layer=chartView.getGroundLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();this.usedWidth=0;if(this.showEnlargeIcon){this.rightWidth=this.createTitleIcon(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}else{this.rightWidth=this.createCopyrightLabel(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}
var areaBound=titleArea.getAreaBound();var maxValueWidth=0;if(context.getRange(this.associatedAxisId)!=null&&context.getRange(this.associatedAxisId)[1]!=null){this.valueFormatter.setFormat(context.getFormat(this.associatedAxisId));var valueString=this.valueFormatter.formatValue(context.getRange(this.associatedAxisId)[1]);maxValueWidth=chartView.getTextWidth(valueString,titleStyle.getFont(),titleStyle.getValueFontSize(),titleStyle.isValueBold());}
var availableWidth=stjs.trunc((areaBound.getInnerWidth()-this.usedWidth))-2*DefaultTitleEngine.MIN_SEPARATION_WIDTH-maxValueWidth;this.displayedTitle=this.getTitle(chartView,availableWidth);this.createTitleLabel(layer,this.displayedTitle,chartView,titleStyle.getTitleColor(),titleArea,titleStyle,0);};prototype.createTitleIcon=function(layer,chartView,area,style){if(!this.showTitle||style.getZoomIconSize()<=0){return 0;}
var areaBound=area.getAreaBound();var xPosEnd=stjs.trunc(Math.round(areaBound.getLeft()+areaBound.getOuterWidth(true)));var yPos=stjs.trunc(Math.round(areaBound.getBottom()-style.getZoomIconSize()-DefaultLayout.TITLE_PADDING_BOTTOM));var size=style.getZoomIconSize();var iconType=style.getIconType();if(iconType==null){iconType=ChartIcon.ENLARGE_ICON;}
var icon=ChartElementFactory.createIcon(layer,xPosEnd-size,yPos,size,size,iconType);icon.setId(DefaultTitleEngine.ICON_ID);area.addElement(icon);this.currentIcon=icon;return size;};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();var position=context.getCurrentPosition();if(this.currentIcon!=null&&position!=null&&this.currentIcon.isInside(position.getX(),position.getY())){var copyIcon=this.currentIcon.copyTo(overlayLayer);copyIcon.setBackgroundColor(ChartColor.orange);titleArea.addElement(copyIcon);}};prototype.createTitleLabel=function(layer,title,chartView,color,area,style,previousTitlesWidth){if(!this.showTitle){return null;}
var fontSize=style.getTitleFontSize();var isBold=style.isTitleBold();var areaBound=area.getAreaBound();var titleWidth=chartView.getLabelWidth(title,style.getFont(),fontSize,isBold);var height=stjs.trunc(areaBound.getContentHeight());var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var xPos=stjs.trunc(areaBound.getInnerLeft())+previousTitlesWidth;var titleLabel=ChartElementFactory.createLabel(layer,0.0,title,xPos,yCenter,titleWidth,height);titleLabel.setAlign(Label.ALIGN_LEFT);titleLabel.setColor(color);titleLabel.setFontSize(fontSize);titleLabel.setBold(isBold);area.addElement(titleLabel);return titleLabel;};prototype.createCopyrightLabel=function(layer,chartView,area,style){if(!this.showCopyright||this.copyright==null){return 0;}
var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var areaBound=area.getAreaBound();var fontSize=style.getCopyrightFontSize();var isBold=style.isCopyrightBold();var copyrightWidth=chartView.getTextWidth(this.copyright,style.getFont(),fontSize,isBold);var xRight=stjs.trunc(Math.round(graphAreaBound.getLeft()+graphAreaBound.getOuterWidth(true)));var height=stjs.trunc(areaBound.getContentHeight());var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var copyrightLabel=ChartElementFactory.createLabel(layer,0.0,this.copyright,xRight,yCenter,copyrightWidth,height);copyrightLabel.setAlign(Label.ALIGN_RIGHT);copyrightLabel.setColor(style.getCopyrightColor());copyrightLabel.setFontSize(fontSize);copyrightLabel.setBold(isBold);area.addElement(copyrightLabel);return copyrightWidth;};prototype.getTitle=function(chartView,availableWidth){if(this.title==null){return this.alternateTitle;}
var titleStyle=chartView.getStyleModel().getTitleStyle();var fontSize=titleStyle.getTitleFontSize();var isBold=titleStyle.isTitleBold();var titleWidth=chartView.getLabelWidth(this.title,titleStyle.getFont(),fontSize,isBold);if(titleWidth>availableWidth&&this.alternateTitle!=null){var symbolWidth=chartView.getLabelWidth(this.alternateTitle,titleStyle.getFont(),fontSize,isBold);if(symbolWidth<titleWidth){return this.alternateTitle;}}
return this.title;};},{currentIcon:"ChartIcon",valueFormatter:"Formatter"},{});
var DefaultToolTipEngine=function(options){ToolTipEngine.call(this,options);this.showToolTip=options.isShowToolTip();this.fontFamily=options.getLabelFont();this.fontSize=options.getNormalLabelFontSize();this.tooltip=new CanvasToolTip();};DefaultToolTipEngine=stjs.extend(DefaultToolTipEngine,ToolTipEngine,[],function(constructor,prototype){prototype.showToolTip=false;prototype.tooltip=null;prototype.fontFamily=null;prototype.fontSize=0;prototype.headerFontStyles=null;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showToolTip||chartData.isEmpty()){return;}
var overlayLayer=chartView.getOverlayLayer();var style=chartView.getStyleModel().getTooltipStyle();var tooltipArea=chartView.getArea(DefaultLayout.TOOLTIP_AREA);var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);if(graphArea.isPointInside(context.getCurrentPosition())){this.createToolTip(overlayLayer,chartView,chartData,context,tooltipArea,style);}
this.customEvent(chartView,chartData,context);};prototype.createToolTip=function(layer,chartView,chartData,context,tooltipArea,style){var position=context.getCurrentPosition();var offsetX=position.getX();var offsetY=position.getY();var parent=chartView.getClosestShapesAtPosition(offsetX,offsetY);if(parent==null||parent.getData()==null){return;}
this.tooltip.setParent(parent);this.tooltip.parseData();var data=this.tooltip.getData();if(data==null||data.length==0){return;}
this.tooltip.configStyle(style);var numRow=data.length;var padding=DefaultLayout.DEFAULT_PADDING_PIXELS;var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var bounds=graphArea.getAreaBound();var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;var chartRightPos=chartLeftPos+chartWidth;var xPadding=padding*5;var x=parent.getX()+xPadding;var y=parent.getY();if(stjs.isInstanceOf(parent.constructor,Line)){}else if(stjs.isInstanceOf(parent.constructor,Circle)){}else if(stjs.isInstanceOf(parent.constructor,Rect)){y=parent.getY()+parent.getHeight();}else{}
var longestName="";var longestValue="";var longestNameLength=Double.NEGATIVE_INFINITY;var longestValueLength=Double.NEGATIVE_INFINITY;for(var i=0;i<data.length;i++){var e=data[i];if(longestNameLength<e.name.length){longestNameLength=e.name.length;longestName=e.name;}
if(longestValueLength<e.value.length){longestValueLength=e.value.length;longestValue=e.value;}}
this.tooltip.setLongestName(longestName);this.tooltip.setLongestValue(longestValue);var fontFamily=this.fontFamily;var fontSize=this.fontSize;var fontStyle="";var fontColor=ChartColor.black;var fontStyles=[fontFamily,fontSize,fontStyle,fontColor];this.tooltip.calFontStyle(style.getStyle(),fontStyles);var defaultFontFamily=fontStyles[0];var defaultFontSize=fontStyles[1];var defaultFontStyle=fontStyles[2];var defaultFontColor=fontStyles[3];this.tooltip.calFontStyle(style.getNameStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];var nameWidth=chartView.getTextWidthFull(longestName,fontFamily,fontSize,fontStyle);fontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,fontColor];this.tooltip.calFontStyle(style.getValueStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];var valueWidth=chartView.getTextWidthFull(longestValue,fontFamily,fontSize,fontStyle);var tooltipWidth=nameWidth+padding*5+valueWidth;if(this.tooltip.getHeader()!=null){numRow++;var headerValue=this.tooltip.getHeader().value;var headerStyle=this.tooltip.getHeader().getValueStyle();if(headerStyle!=null){this.headerFontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,fontColor];this.tooltip.calFontStyle(headerStyle,this.headerFontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];fontColor=fontStyles[3];}
var headerWidth=chartView.getTextWidthFull(headerValue,fontFamily,fontSize,fontStyle);if(headerWidth>tooltipWidth){tooltipWidth=headerWidth;}}
var space=tooltipWidth-nameWidth-valueWidth;var xSpace=tooltipWidth-valueWidth-stjs.trunc(space/2);var tooltipHeight=(fontSize+padding)*numRow+padding;var ySpace=fontSize+padding;if(x+tooltipWidth>chartRightPos){x-=tooltipWidth+2*xPadding;}
if(y+tooltipHeight>chartBottomPos){y-=tooltipHeight;}
var tooltipBound=tooltipArea.getAreaBound();tooltipBound.reset();tooltipBound.setLeft(x);tooltipBound.setTop(y);tooltipBound.setWidth(tooltipWidth);tooltipBound.setHeight(tooltipHeight);tooltipBound.setBorder(1.0);tooltipBound.setPadding(padding);this.customPlacement(tooltipBound,chartView);var backgroundColor=style.getBackgroundColor();this.tooltip.init(layer,parent,x,y,tooltipWidth,tooltipHeight);this.tooltip.setNameWidth(nameWidth);this.tooltip.setValueWidth(valueWidth);this.tooltip.setxSpace(xSpace);this.tooltip.setySpace(ySpace);this.tooltip.setFontColor(defaultFontColor);this.tooltip.setFontFamily(defaultFontFamily);this.tooltip.setFontSize(defaultFontSize);this.tooltip.setFontStyle(defaultFontStyle);this.tooltip.setBackgroundColor(backgroundColor);tooltipArea.addElement(this.tooltip);};prototype.createHeader=function(layer,chartView,chartData,context,tooltipArea){var padding=DefaultLayout.DEFAULT_PADDING_PIXELS;var tooltipBound=tooltipArea.getAreaBound();if(this.tooltip.getHeader()==null||tooltipBound==null||this.headerFontStyles==null){return;}
var style=this.tooltip.getHeader().getValueStyle();var backgroundColor=ChartColor.lightYellow;if(style!=null){backgroundColor=(style["backgroundColor"]!=null?style["backgroundColor"]:ChartColor.lightYellow);}
var fontFamily=this.headerFontStyles[0];var fontSize=this.headerFontStyles[1];var fontStyle=this.headerFontStyles[2];var fontColor=this.headerFontStyles[3];var headerValue=this.tooltip.getHeader().value;var left=stjs.trunc(tooltipBound.getLeft());var top=stjs.trunc(tooltipBound.getTop());var width=stjs.trunc(tooltipBound.getWidth());var height=fontSize;var headerLabel=ChartElementFactory.createLabel(layer,0.0,headerValue,left,top,width,height);headerLabel.setFontSize(fontSize);headerLabel.setColor(fontColor);headerLabel.setBackgroundColor(backgroundColor);tooltipArea.addElement(headerLabel);};prototype.customPlacement=function(tooltipArea,chartView){};prototype.customEvent=function(chartView,chartData,context){};},{tooltip:"ToolTipComponent",headerFontStyles:"Array",options:"ChartOption"},{});
var DefaultDrawEngine=function(options){DrawEngine.call(this,options);};DefaultDrawEngine=stjs.extend(DefaultDrawEngine,DrawEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showElements){return;}
var layer=this.getDrawingLayer(chartView);for(var index in this.drawElements){if(!(this.drawElements).hasOwnProperty(index))
continue;var iShape=this.drawElements[index];if(iShape!=null){var shapesInCurrentContext=iShape.getShapes(layer,chartView,chartData,context);if(shapesInCurrentContext!=null&&iShape.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(iShape.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(iShape.getAssociatedAreaId());if(associatedArea!=null){associatedArea.addElements(shapesInCurrentContext);}}}}}
if(this.selectedElement!=null&&this.selectedElement.isComplete()){var shapesInCurrentContext=this.selectedElement.getShapes(layer,chartView,chartData,context);if(shapesInCurrentContext!=null&&this.selectedElement.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(this.selectedElement.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(this.selectedElement.getAssociatedAreaId());if(associatedArea!=null){associatedArea.addElements(shapesInCurrentContext);}}}}};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showElements){return;}
var layer=chartView.getOverlayLayer();if(this.selectedElement!=null){this.selectedElement.updatePosition(context.getCurrentPosition());var shapesBeingDrawn=this.selectedElement.getShapes(layer,chartView,chartData,context);var anchorPoints=this.selectedElement.getAnchorPoints(layer,chartView,chartData,context);if(this.selectedElement.getAssociatedAreaId()!=null){if(this.allowedDrawAreaIds.indexOf(this.selectedElement.getAssociatedAreaId())!=-1){var associatedArea=chartView.getArea(this.selectedElement.getAssociatedAreaId());if(associatedArea!=null){if(shapesBeingDrawn!=null){associatedArea.addElements(shapesBeingDrawn);}
if(anchorPoints!=null){associatedArea.addElements(anchorPoints);}}}}}};prototype.createShape=function(chart,offsetX,offsetY){if(!this.showElements){return false;}
if(InteractiveShapeFactory.TEXT_TYPE.equals(this.currentDrawType)){var engine=chart.getEngineModel().getEngine(DrawEngine.ID);var shapeAtPosition=engine.getInteractiveShapeAtPosition(chart.getChartView(),offsetX,offsetY);if(shapeAtPosition!=null&&stjs.isInstanceOf(shapeAtPosition.constructor,InteractiveText)){return false;}}
var associatedArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var areaId=associatedArea.getId();if(this.isAllowed(areaId)){var yAxisId=this.getAxisAssociatedWith(areaId);this.selectedElement=InteractiveShapeFactory.createInteractiveShape(this.currentDrawType,areaId,yAxisId);if(this.selectedElement!=null){InteractiveText.blurAll(chart);this.selectedElement.setGroupId(this.currentGroupId);this.applyStyleToCurrentElement(chart);var completed=this.selectedElement.addCurrentPositionToShape(offsetX,offsetY,chart);return completed;}}
return false;};prototype.startDrawAt=function(chart,offsetX,offsetY){if(!this.showElements){return;}
if(this.currentMode==DrawEngine.DRAW_MODE){this.elementSelected();var completed=false;if(this.selectedElement==null){if(chart!=null&&chart.getChartView()!=null&&chart.getChartView().getAreaFromPosition(offsetX,offsetY)!=null){completed=this.createShape(chart,offsetX,offsetY);}}else{var associatedArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var areaId=associatedArea.getId();if(areaId==this.selectedElement.getAssociatedAreaId()){completed=this.selectedElement.addCurrentPositionToShape(offsetX,offsetY,chart);}}
if(completed){this.fireOnElementChangedCallbacks(this.selectedElement);}}else if(this.currentMode==DrawEngine.MOVE_MODE){var view=chart.getChartView();if(this.selectedElement!=null&&this.selectedElement.isComplete()){var layer=view.getOverlayLayer();var data=chart.getChartData();var anchors=this.selectedElement.getAnchorPoints(layer,view,data,chart.getEngineModel().getContext());var anchorsCount=anchors!=null?anchors.length:0;for(var index=0;index<anchorsCount;index++){var anchor=anchors[index];if(anchor!=null&&anchor.isInside(offsetX,offsetY)){this.selectedElement.setOriginTransform(index,offsetX,offsetY);return;}}}
this.elementSelected();var shape=this.getInteractiveShapeAtPosition(view,offsetX,offsetY);if(shape!=null){shape.setOriginTransform(-1,offsetX,offsetY);this.removeFromDrawElements(shape);this.selectedElement=shape;this.fireOnSelectElementCallbacks(shape);}}};prototype.removeFromDrawElements=function(shape){var index=this.drawElements.indexOf(shape);if(index>=0){this.drawElements.splice(index,1);}};prototype.endDrawAt=function(chart,offsetX,offsetY){if(!this.showElements){return false;}
if(this.selectedElement!=null&&this.currentMode==DrawEngine.MOVE_MODE&&chart!=null&&chart.getEngineModel()!=null){this.selectedElement.setEndTransform(offsetX,offsetY);this.fireOnElementChangedCallbacks(this.selectedElement);return true;}
return false;};},{selectCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},drawnCallbacks:{name:"Map",arguments:[null,{name:"Callback1",arguments:["InteractiveShape"]}]},allowedDrawAreaIds:{name:"Array",arguments:[null]},associatedAxes:{name:"Map",arguments:[null,null]},drawElements:{name:"Array",arguments:["InteractiveShape"]},selectedElement:"InteractiveShape"},{});
var DefaultYAxisEngine=function(options){AxisEngine.call(this,options);this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.logScale=false;};DefaultYAxisEngine=stjs.extend(DefaultYAxisEngine,AxisEngine,[],function(constructor,prototype){constructor.LABELS_OVERLAP_PIXELS_ALLOWED=3;constructor.SCALE_MULTIPLIER=10;constructor.MINIMUM_AXIS_VALUE=1.0E-5;constructor.STEPS=[0.01,0.025,0.05];constructor.MAX_LOOP_COUNT=20;prototype.logScale=false;prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);this.labelsPosition=context.getLabelsPosition(this.correspondingAreaId);this.logScale=chartData.isLogScale();var currentFormat=context.getFormat(this.correspondingAreaId);if(this.labelsFormatter!=null&&currentFormat!=null){var formatValue=parseInt(currentFormat)-1;if(formatValue!=null&&!isNaN(formatValue)&&formatValue>1){this.labelsFormatter.setFormat(String.valueOf(formatValue));}else{this.labelsFormatter.setFormat("1");}}
var maxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(axisStyle!=null){axisStyle.setAbsoluteWidth(maxLabelWidth);}
if(this.labelsFormatter!=null&&currentFormat!=null){this.labelsFormatter.setFormat(currentFormat);}};prototype.createMainGraphics=function(chartView,chartData,context){var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);if(axisArea==null||axisArea.getAreaBound()==null||!axisArea.getAreaBound().isVisible()||axisStyle==null||!axisStyle.isVisible()){return;}
var layer=chartView.getGroundLayer();this.createBackground(layer,axisArea,axisStyle);this.createTicks(layer,axisArea,context,axisStyle);this.createLabels(layer,chartView,chartData,axisArea,context,axisStyle);};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var axisArea=chartView.getArea(this.correspondingAreaId);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);if(axisArea!=null&&axisArea.getAreaBound()!=null&&axisArea.getAreaBound().isVisible()&&axisStyle!=null&&axisStyle.isVisible()&&!chartData.isEmpty()){this.createHighlightLabel(layer,axisArea,chartView,context,axisStyle);}};prototype.createTicks=function(layer,area,context,style){var areaBound=area.getAreaBound();var showTicks=style.isShowAxisTicks();var ticksColor=style.getAxisTicksColor();var ticksColorGradientParam=style.getAxisTicksColorGradientParam();if(ticksColor==null){ticksColor=ChartColor.red;}
if(showTicks){var xStart=0;var xEnd=0;if(this.position==Layout.Position.LEFT){xEnd=stjs.trunc(Math.round(areaBound.getLeft()+areaBound.getOuterWidth(true)));xStart=xEnd-style.getAxisTickLength();}else{xStart=stjs.trunc(Math.round(areaBound.getLeft()));xEnd=xStart+style.getAxisTickLength();}
var lineCount=0;if(this.labelsPosition!=null){lineCount=this.labelsPosition.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=1.0-this.labelsPosition[i];if(currentRelativePosition!=null){var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*areaBound.getContentHeight()));var currentTick=ChartElementFactory.createLine(layer,xStart,yCenter,xEnd,yCenter,style.getTickWidth());currentTick.setStrokeColor(ticksColor);currentTick.setStrokeColorGradientParam(ticksColorGradientParam);area.addElement(currentTick);}}}};prototype.createLabels=function(layer,chartView,chartData,area,context,style){if(this.range==null){return;}
var lowestValue=this.range[0];var highestValue=this.range[1];if(lowestValue==null||highestValue==null){return;}
var highestValueFormatted=this.labelsFormatter.format(highestValue);var areaBound=area.getAreaBound();var valueDelta=highestValue-lowestValue;var labelCount=this.labelsPosition.length;var axisHeight=stjs.trunc(areaBound.getContentHeight());var labelWidth=stjs.trunc(areaBound.getContentWidth());var layerId=layer.getId();var align=null;var font=style.getFont();var textColor=style.getTextColor();var colorGradientParam=style.getTextColorGradientParams();var isBold=style.isBoldFont();var fontSize=style.getFontSize();var xPos=0;var previousYTop=Double.POSITIVE_INFINITY;if(this.position==Layout.Position.LEFT){align=Label.ALIGN_RIGHT;xPos=stjs.trunc(areaBound.getContentLeft())+labelWidth;}else{align=Label.ALIGN_LEFT;xPos=stjs.trunc((areaBound.getContentLeft()));}
for(var i=0;i<labelCount;i++){var ratio=this.labelsPosition[i];var value=this.getValue(lowestValue,highestValue,ratio,this.logScale);var currentRelativePosition=1.0-ratio;var labelHeight=style.getLabelsHeight();var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+currentRelativePosition*axisHeight));var yBottom=Math.floor(areaBound.getContentTop()+currentRelativePosition*axisHeight+labelHeight/2.0);if(yBottom<previousYTop){previousYTop=yBottom-labelHeight+DefaultYAxisEngine.LABELS_OVERLAP_PIXELS_ALLOWED;var currentValueFormatted=this.labelsFormatter.format(value);var nextValue=this.getValue(lowestValue,highestValue,this.labelsPosition[i+1],this.logScale);var nextValueFormatted=this.labelsFormatter.format(nextValue);var format=Integer.parseInt(this.labelsFormatter.getFormat());if(format<20&&currentValueFormatted.equals(nextValueFormatted)){this.labelsFormatter.setFormat(String.valueOf(format+1));currentValueFormatted=this.labelsFormatter.format(value);}
if(i>0&&highestValueFormatted.endsWith(AbbreviateNumberFormatter.THOUSAND_SUFFIX)&&currentValueFormatted.endsWith("0")){currentValueFormatted=AbbreviateNumberFormatter.separatedToSuffixedThousands(currentValueFormatted);}
var label=ChartElementFactory.createLabel(layer,value,currentValueFormatted,xPos,yCenter,labelWidth,labelHeight);label.setAlign(align);label.setBaseline(Label.BASELINE_MIDDLE);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);}}};prototype.getValue=function(min,max,ratio,logScale){if(logScale){var minLog=Math.log(min);return Math.exp((ratio*(Math.log(max)-minLog))+minLog);}else{return(ratio*(max-min))+min;}};prototype.createHighlightLabel=function(layer,area,chartView,context,style){var areaBounds=area.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var currentPosition=context.getCurrentPosition();if(this.range!=null&&graphArea.isPointInside(currentPosition)){var lowestValue=this.range[0];var highestValue=this.range[1];if(lowestValue==null||highestValue==null){return;}
var font=style.getFont();var textColor=style.getTextColor();var colorGradientParam=style.getTextColorGradientParams();var fontSize=style.getFontSize();var isBold=style.isLabelHighlightBold();var valueDelta=highestValue-lowestValue;var labelHeight=style.getLabelsHeight();var yPos=currentPosition.getY()-areaBounds.getContentTop();var ratio=1.0-(yPos/areaBounds.getContentHeight());var yPosCentered=stjs.trunc(Math.round(currentPosition.getY()));var axisContentWidth=stjs.trunc(areaBounds.getContentWidth());var axisWidth=stjs.trunc(areaBounds.getOuterWidth(true));var align=null;var xPos=0;var rectLeft=stjs.trunc(areaBounds.getLeft());var currentMaxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var labelWidth=currentMaxLabelWidth;var rectWidth=labelWidth;var top=stjs.trunc(Math.round(yPosCentered-(labelHeight/2.0)-DefaultLayout.DEFAULT_PADDING_PIXELS));var heightWithPadding=labelHeight+2*DefaultLayout.DEFAULT_PADDING_PIXELS;if(this.position==Layout.Position.LEFT){align=Label.ALIGN_RIGHT;xPos=stjs.trunc(areaBounds.getContentLeft())+axisContentWidth;if(currentMaxLabelWidth<=axisContentWidth){rectWidth=currentMaxLabelWidth+stjs.trunc(areaBounds.getPaddingRight())+stjs.trunc(areaBounds.getPaddingLeft());rectLeft+=axisWidth-rectWidth;}else{labelWidth=axisContentWidth;rectWidth=axisWidth;}}else{align=Label.ALIGN_LEFT;xPos=stjs.trunc(areaBounds.getContentLeft());if(currentMaxLabelWidth<=axisContentWidth){rectWidth=currentMaxLabelWidth+stjs.trunc(areaBounds.getPaddingRight())+stjs.trunc(areaBounds.getPaddingLeft());}else{labelWidth=axisContentWidth;rectWidth=axisWidth;}}
var yValue=this.getValue(lowestValue,highestValue,ratio,this.logScale);var formatter=this.labelsFormatter;var text=formatter.formatValue(yValue);var labelsBackground=ChartElementFactory.createRect(layer,rectLeft,top,rectWidth,heightWithPadding);labelsBackground.setFillColor(style.getLabelHighlightColor());labelsBackground.setFillColorGradientParam(style.getLabelHighlightColorGradientParam());var highlightLabel=ChartElementFactory.createLabel(layer,yValue,text,xPos,yPosCentered,labelWidth,labelHeight);highlightLabel.setAlign(align);highlightLabel.setBaseline(Label.BASELINE_MIDDLE);highlightLabel.setColor(textColor);highlightLabel.setColorGradientParam(colorGradientParam);highlightLabel.setBold(isBold);highlightLabel.setFont(font);highlightLabel.setFontSize(fontSize);area.addElement(labelsBackground);area.addElement(highlightLabel);}};prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){this.labelsPosition=[];if(graphArea==null||currentRange==null||currentRange[0]==null||currentRange[1]==null){this.range=null;return null;}
var yMin=parseFloat((currentRange[0]).toFixed(precision));var yMax=parseFloat((currentRange[1]).toFixed(precision));var graphBounds=graphArea.getAreaBound();var availableHeight=graphBounds.getInnerHeight();var labelHeight=style.getLabelsHeight();var maxLabels=Math.floor(availableHeight/labelHeight);maxLabels=Math.max(maxLabels,1.0);var startScale=100.0/Math.pow(10,precision);var scale=startScale;var step=DefaultYAxisEngine.STEPS[0]*scale;var yMinWithStep=Math.floor(yMin/step)*step;var yMaxWithStep=Math.ceil(yMax/step)*step;var diff=yMaxWithStep-yMinWithStep;var labelNumber=diff/step;var i=2;while(labelNumber>maxLabels){step=DefaultYAxisEngine.STEPS[i]*scale;yMinWithStep=Math.floor(yMin/step)*step;yMaxWithStep=Math.ceil(yMax/step)*step;diff=Math.abs(yMaxWithStep-yMinWithStep);labelNumber=diff/step;if(labelNumber>maxLabels){i++;if(i>=DefaultYAxisEngine.STEPS.length){i=0;scale=scale*DefaultYAxisEngine.SCALE_MULTIPLIER;}}}
if(labelNumber>0){if(logScale&&this.validateYMinLog(yMinWithStep,yMin,step,scale,i)!=null&&yMaxWithStep>=0){var yMinWithStepValid=this.validateYMinLog(yMinWithStep,yMin,step,scale,i);if(yMaxWithStep<=yMinWithStepValid){yMaxWithStep=yMinWithStepValid+1;}
var yMinWithStepLog=Math.log(yMinWithStepValid);var yMaxWithStepLog=Math.log(yMaxWithStep);var diffLog=yMaxWithStepLog-yMinWithStepLog;var lastLabelIndex=stjs.trunc(Math.round(labelNumber));var positionStep=1.0/lastLabelIndex;this.labelsPosition[0]=0.0;for(i=1;i<=lastLabelIndex;i++){var currentLabelValue=yMinWithStep+i*positionStep*diff;if(currentLabelValue>yMinWithStepValid){var currentLogValue=Math.log(currentLabelValue/yMinWithStepValid);this.labelsPosition[i]=currentLogValue/diffLog;}}
yMinWithStep=yMinWithStepValid;}else{var lastLabelIndex=stjs.trunc(Math.round(labelNumber));var positionStep=1.0/lastLabelIndex;for(i=0;i<=lastLabelIndex;i++){this.labelsPosition[i]=i*positionStep;}}}
this.range=[yMinWithStep,yMaxWithStep];return step;};prototype.validateYMinLog=function(yMinWithStep,yMin,step,startScale,startIndex){if(yMinWithStep<0){return null;}else if(yMinWithStep>0){return yMinWithStep;}else{if(yMin<=0){return DefaultYAxisEngine.MINIMUM_AXIS_VALUE;}
var newYMinWithStep=step;var i=startIndex;var loopCount=0;var scale=startScale;while((newYMinWithStep==0||newYMinWithStep>yMin)&&loopCount<DefaultYAxisEngine.MAX_LOOP_COUNT){step=DefaultYAxisEngine.STEPS[i]*scale;newYMinWithStep=Math.floor(yMin/step)*step;loopCount++;i--;if(i<0){i=DefaultYAxisEngine.STEPS.length-1;scale=scale/DefaultYAxisEngine.SCALE_MULTIPLIER;}}
if(newYMinWithStep==0||newYMinWithStep>yMin){return DefaultYAxisEngine.MINIMUM_AXIS_VALUE;}
return newYMinWithStep;}};prototype.getMaxLabelsWidth=function(chartView,range){if(range==null||range[0]==null||range[1]==null){return 0;}else{var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var font=axisStyle.getFont();var fontSize=axisStyle.getFontSize();var isBold=axisStyle.isLabelHighlightBold();var lowestValue=range[0];var highestValue=range[1];var valueDelta=highestValue-lowestValue;var labelCount=this.labelsPosition!=null?this.labelsPosition.length:0;var maxValueWidth=0;for(var i=0;i<labelCount;i++){var ratio=this.labelsPosition[i];var value=(ratio*valueDelta)+lowestValue;var valueString="";if(this.labelsFormatter!=null){valueString=this.labelsFormatter.formatValue(value);}else{valueString=String.valueOf(value);}
var currentValueWidth=chartView.getLabelWidth(valueString,font,fontSize,isBold);if(currentValueWidth>maxValueWidth){maxValueWidth=currentValueWidth;}}
return maxValueWidth;}};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultY1AxisEngine=function(options){DefaultYAxisEngine.call(this,options);this.labelsFormatter=options.getY1AxisFormatter();this.correspondingAreaId=DefaultLayout.Y1_AXIS_AREA;this.position=options.getY1AxisPosition();};DefaultY1AxisEngine=stjs.extend(DefaultY1AxisEngine,DefaultYAxisEngine,[],null,{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultY2AxisEngine=function(options){DefaultYAxisEngine.call(this,options);this.labelsFormatter=options.getY2AxisFormatter();this.correspondingAreaId=DefaultLayout.Y2_AXIS_AREA;this.position=options.getY2AxisPosition();};DefaultY2AxisEngine=stjs.extend(DefaultY2AxisEngine,DefaultYAxisEngine,[],function(constructor,prototype){constructor.TRIM_THRESHOLD=100;constructor.TRIM_FORMAT="0";constructor.NORMAL_FORMAT="2";prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);this.labelsPosition=context.getLabelsPosition(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);var areaBound=axisArea.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var currentFormat=DefaultY2AxisEngine.NORMAL_FORMAT;if(this.range!=null&&this.range[0]!=null&&this.range[1]!=null&&(this.range[1]-this.range[0])>=DefaultY2AxisEngine.TRIM_THRESHOLD){currentFormat=DefaultY2AxisEngine.TRIM_FORMAT;}
if(this.labelsFormatter!=null){this.labelsFormatter.setFormat("1");}
var maxLabelWidth=this.getMaxLabelsWidth(chartView,this.range);var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);axisStyle.setAbsoluteWidth(maxLabelWidth);if(this.labelsFormatter!=null){this.labelsFormatter.setFormat(currentFormat);}};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultXAxisEngine=function(options){AxisEngine.call(this,options);this.labelsFormatter=options.getXAxisFormatter();this.correspondingAreaId=DefaultLayout.X_AXIS_AREA;this.associatedGraphId=DefaultLayout.GRAPH_AREA;this.position=options.getXAxisPosition();this.messages=ChartMessagesRepository.getInstance();};DefaultXAxisEngine=stjs.extend(DefaultXAxisEngine,AxisEngine,[],function(constructor,prototype){prototype.labelsParameters=null;prototype.messages=null;prototype.update=function(chartView,chartData,context){this.range=context.getRange(this.correspondingAreaId);var xAxisStyle=chartView.getStyleModel().getXAxisStyle();this.computeLabelsContext(chartView,chartData,context,xAxisStyle);context.setLabelsPosition(this.correspondingAreaId,this.labelsPosition);if(this.labelsFormatter!=null&&context.getFormat(this.correspondingAreaId)!=null){this.labelsFormatter.setFormat(context.getFormat(this.correspondingAreaId));}};prototype.computeLabelsContext=function(chartView,chartData,context,style){this.labelsPosition=[];this.labelsParameters=[];var xRange=this.range;if(xRange==null){xRange=chartData.getExtremums();if(xRange==null){return;}}
var axisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);var graphBounds=graphArea.getAreaBound();var chartWidth=graphBounds.getContentWidth();var availableFormats=chartData.getAvailableFormats();var possibleSteps=chartData.getPossibleXSteps();var currentStepIndex=0;var availableXSpace=chartData.getCurrentXSpaceSize(xRange);var exampleXValue=context.getMainMax(Serie.X);var currentFormats=availableFormats[currentStepIndex];var currentSteps=possibleSteps[currentStepIndex];var availableXValues=availableXSpace*chartData.getXStepSize();var labelNumberWithSmallestStep=availableXValues/currentSteps[0];this.labelsFormatter.setFormat(currentFormats[0]);var textWithFormat=this.labelsFormatter.formatValue(exampleXValue);var labelWidth=chartView.getLabelWidth(textWithFormat,axisStyle.getFont(),axisStyle.getFontSize(),false);if(currentFormats.length>1){labelWidth=labelWidth+2;}
var widthNeeded=labelNumberWithSmallestStep*labelWidth;while(widthNeeded>chartWidth&&currentStepIndex<(availableFormats.length-1)){currentStepIndex++;currentFormats=availableFormats[currentStepIndex];currentSteps=possibleSteps[currentStepIndex];labelNumberWithSmallestStep=availableXValues/currentSteps[0];this.labelsFormatter.setFormat(currentFormats[0]);textWithFormat=this.labelsFormatter.formatValue(exampleXValue);labelWidth=chartView.getLabelWidth(textWithFormat,axisStyle.getFont(),axisStyle.getFontSize(),false);if(currentFormats.length>1){labelWidth=labelWidth+2;}
widthNeeded=labelNumberWithSmallestStep*labelWidth;}
if(!style.isVisible()&&currentFormats==null||currentSteps==null||currentFormats.length==0||currentSteps.length==0){return;}
this.labelsFormatter.setFormat(currentFormats[0]);var maxNormalizedXValue=xRange[1];var minNormalizedXValue=xRange[0];var possibleStepCount=currentSteps.length;var labelsFormatsCount=currentFormats.length;var minXValue=chartData.normalizedXValue2XValue(minNormalizedXValue);var maxXValue=chartData.normalizedXValue2XValue(maxNormalizedXValue);if(minXValue==null||maxXValue==null){return;}
var currentLabelParameters={};currentLabelParameters["position"]=0;if(chartData.isIndexed()){currentLabelParameters["value"]=minXValue;}else{currentLabelParameters["value"]=this.labelsFormatter.toValueInScale(minXValue,currentSteps[possibleStepCount-1]);}
currentLabelParameters["format"]=currentFormats[labelsFormatsCount-1];currentLabelParameters["step"]=currentSteps[possibleStepCount-1];currentLabelParameters["bold"]=currentFormats.length>1;var currentTypeLabelsParameters=[currentLabelParameters];this.labelsParameters[possibleStepCount-1]=currentTypeLabelsParameters;this.labelsPosition.push(0.0);var nextXValues=[];for(var stepIndex=0;stepIndex<possibleStepCount;stepIndex++){nextXValues[stepIndex]=this.labelsFormatter.nextValueInScale(this.labelsFormatter.toValueInScale(minXValue,currentSteps[stepIndex]),currentSteps[stepIndex]);}
for(var xPixel=1;xPixel<chartWidth;xPixel++){var xSpacePosition=context.getXSpaceValueAtPosition(xPixel,chartWidth);var timeValueMs=chartData.xSpace2CurrentOrPreviousXValue(xSpacePosition);currentLabelParameters=null;var stepIndex=currentFormats.length-1;while(stepIndex>=0){if(timeValueMs>=nextXValues[stepIndex]){var currentStep=currentSteps[stepIndex];if(currentLabelParameters==null){currentLabelParameters={};currentLabelParameters["position"]=xPixel/chartWidth;var valueToSet=timeValueMs;if(!chartData.isIndexed()){valueToSet=this.labelsFormatter.toValueInScale(timeValueMs,currentStep);}
currentLabelParameters["value"]=valueToSet;currentLabelParameters["format"]=currentFormats[stepIndex];currentLabelParameters["step"]=currentStep;currentLabelParameters["bold"]=stepIndex>0;currentTypeLabelsParameters=this.labelsParameters[stepIndex];if(currentTypeLabelsParameters==null){currentTypeLabelsParameters=[];this.labelsParameters[stepIndex]=currentTypeLabelsParameters;}
currentTypeLabelsParameters.push(currentLabelParameters);this.labelsPosition.push(xPixel/chartWidth);}
nextXValues[stepIndex]=this.labelsFormatter.nextValueInScale(this.labelsFormatter.toValueInScale(timeValueMs,currentStep),currentStep);}
stepIndex--;}}
if(this.labelsPosition.length==1){currentLabelParameters={};currentLabelParameters["position"]=1.0;if(chartData.isIndexed()){currentLabelParameters["value"]=maxXValue;}else{currentLabelParameters["value"]=this.labelsFormatter.toValueInScale(maxXValue,currentSteps[possibleStepCount-1]);}
currentLabelParameters["format"]=currentFormats[labelsFormatsCount-1];currentLabelParameters["step"]=currentSteps[possibleStepCount-1];currentLabelParameters["bold"]=currentFormats.length>1;currentTypeLabelsParameters.push(currentLabelParameters);this.labelsPosition.push(1.0);}};prototype.computePrettyLabels=function(graphArea,currentRange,precision,style,logScale){return null;};prototype.createMainGraphics=function(chartView,chartData,context){var axisStyle=chartView.getStyleModel().getStyle(this.correspondingAreaId);var axisArea=chartView.getArea(this.correspondingAreaId);if(axisArea==null||axisArea.getAreaBound()==null||!axisArea.getAreaBound().isVisible()||axisStyle==null||!axisStyle.isVisible()){return;}
var layer=chartView.getGroundLayer();this.createBackground(layer,axisArea,axisStyle);this.createTicks(layer,axisArea,context,axisStyle);this.createLabels(layer,chartView,chartData,axisArea,context,axisStyle);};prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);if(xAxisStyle.isVisible()&&xAxisStyle.isShowLabelHighlight()&&graphArea.isPointInside(context.getCurrentPosition())&&!chartData.isEmpty()){this.createHighlightLabel(layer,chartView,chartData,context);}};prototype.createHighlightLabel=function(layer,chartView,chartData,context){if(chartData==null||context.getData()==null){return;}
var area=chartView.getArea(this.correspondingAreaId);var areaBounds=area.getAreaBound();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var format=xAxisStyle.getLabelHighlightFormat();if(format!=null){this.labelsFormatter.setFormat(format);}else if(context.getFormat(this.correspondingAreaId)!=null){this.labelsFormatter.setFormat(context.getFormat(this.correspondingAreaId));}
var value=this.getXValueInMilliseconds(context,chartView);var text=this.millisecondsToDateLabelText(value,chartData,this.labelsFormatter.getFormat());if(text==null){return;}
var font=xAxisStyle.getFont();var textColor=xAxisStyle.getTextColor();var colorGradientParam=xAxisStyle.getTextColorGradientParams();var fontSize=xAxisStyle.getFontSize();var isBold=xAxisStyle.isLabelHighlightBold();var labelWidth=chartView.getLabelWidth(text,font,fontSize,isBold);var xPosCentered=context.getCurrentPosition().getX();var minLeft=areaBounds.getLeft()+labelWidth/2.0;var maxLeft=areaBounds.getLeft()+areaBounds.getOuterWidth(true)-labelWidth/2.0;if(xPosCentered<minLeft){xPosCentered=minLeft;}else if(xPosCentered>maxLeft){xPosCentered=maxLeft;}
var xCenter=stjs.trunc(Math.round(xPosCentered));var height=stjs.trunc(areaBounds.getOuterHeight(true));var yMiddle=stjs.trunc(Math.round(areaBounds.getTop()+height/2.0));var highlightLabel=ChartElementFactory.createLabel(layer,value,text,xCenter,yMiddle,labelWidth,height);highlightLabel.setAlign(Label.ALIGN_CENTER);highlightLabel.setBaseline(Label.BASELINE_MIDDLE);highlightLabel.setColor(textColor);highlightLabel.setColorGradientParam(colorGradientParam);highlightLabel.setBackgroundColor(xAxisStyle.getLabelHighlightColor());highlightLabel.setBackgroundColorGradientParam(xAxisStyle.getLabelHighlightColorGradientParam());highlightLabel.setBold(isBold);highlightLabel.setFont(font);highlightLabel.setFontSize(fontSize);area.addElement(highlightLabel);};prototype.getXValueInMilliseconds=function(context,chartView){var chartData=context.getData();if(chartData==null){return null;}
var graphArea=chartView.getArea(this.associatedGraphId);var graphBounds=graphArea.getAreaBound();var currentPositionOnGraph=stjs.trunc(Math.round(context.getCurrentPosition().getX()-graphBounds.getContentLeft()));var xSpacePosition=context.getXSpaceValueAtPosition(currentPositionOnGraph,graphBounds.getContentWidth());var xValueInMilliseconds=chartData.xSpace2ClosestXValue(xSpacePosition);var mainSerie=chartData.getMainSerie();if(mainSerie!=null&&!mainSerie.isEmpty()){var lastPointMaxPossibleValue=mainSerie.getLastPoint()["x"]+stjs.trunc(this.getStepInMilliseconds(chartData)/2);if(stjs.isInstanceOf(chartData.constructor,FinancialChartData)){var financialSerie=chartData.getMainSerie();if(financialSerie.isIntraday()&&!financialSerie.getPeriod().isLive()&&xValueInMilliseconds<=lastPointMaxPossibleValue){return mainSerie.getPoint(mainSerie.findIndexClosestToXValue(xValueInMilliseconds))["x"];}}}
return xValueInMilliseconds;};prototype.millisecondsToDateLabelText=function(dateInMilliseconds,chartData,format){if(chartData!=null&chartData.getMainSerie()!=null){var dateLabelText=DateTimeFormatter.formatDateAs(dateInMilliseconds,this.getStepInMilliseconds(chartData),format);var outOfBonds=this.isIntervalOutOfBounds(chartData,dateInMilliseconds);return outOfBonds?DateTimeFormatter.closeDateOfIntervalToLiteral(dateLabelText,this.messages.get("last")):dateLabelText;}
return null;};prototype.getStepInMilliseconds=function(chartData){if(stjs.isInstanceOf(chartData.constructor,FinancialChartData)){var financialSerie=chartData.getMainSerie();return financialSerie.getPeriod().getFrequency().getTimeValue();}
return chartData.getMainSerie().getStepSize();};prototype.isIntervalOutOfBounds=function(chartData,value){var mainSerie=chartData!=null?chartData.getMainSerie():null;if(mainSerie!=null&&stjs.isInstanceOf(mainSerie.constructor,HistoSerie)){var histoMainSerie=mainSerie;var lastPointMiddle=histoMainSerie.getLastPoint()["x"];var halfOfTheStep=stjs.trunc(this.getStepInMilliseconds(chartData)/2);var minPossibleValue=lastPointMiddle-halfOfTheStep;var maxPossibleValue=lastPointMiddle+halfOfTheStep;return value<=maxPossibleValue&&value>=minPossibleValue&&maxPossibleValue>new Date().getTime();}
return false;};prototype.createTicks=function(layer,area,context,style){var areaBound=area.getAreaBound();var showTicks=style.isShowAxisTicks();var ticksColor=style.getAxisTicksColor();var ticksColorGradientParam=style.getAxisTicksColorGradientParam();if(ticksColor==null){ticksColor=ChartColor.red;}
if(showTicks){var yStart=0;var yEnd=0;if(this.position==Layout.Position.TOP){yEnd=stjs.trunc(Math.round(areaBound.getTop()+areaBound.getOuterHeight(true)));yStart=yEnd-style.getAxisTickLength();}else{yStart=stjs.trunc(Math.round(areaBound.getTop()));yEnd=yStart+style.getAxisTickLength();}
var relativeLabelPositions=context.getLabelsPosition(this.correspondingAreaId);var lineCount=0;if(relativeLabelPositions!=null){lineCount=relativeLabelPositions.length;}
for(var i=0;i<lineCount;i++){var currentRelativePosition=relativeLabelPositions[i];if(currentRelativePosition!=null){var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+currentRelativePosition*areaBound.getContentWidth()));var currentTick=ChartElementFactory.createLine(layer,xCenter,yStart,xCenter,yEnd,style.getTickWidth());currentTick.setStrokeColor(ticksColor);currentTick.setStrokeColorGradientParam(ticksColorGradientParam);area.addElement(currentTick);}}}};prototype.createLabels=function(layer,chartView,chartData,area,context,style){var areaBound=area.getAreaBound();var labelsTypeCount=this.labelsParameters!=null?this.labelsParameters.length:0;var axisWidth=stjs.trunc(areaBound.getContentWidth());var align=Label.ALIGN_CENTER;var font=style.getFont();var textColor=style.getTextColor();var colorGradientParam=style.getTextColorGradientParams();var fontSize=style.getFontSize();var xRange=this.range;if(xRange==null){xRange=chartData.getExtremums();}
if(xRange==null||labelsTypeCount<=0){return;}
var formatter=this.labelsFormatter;var top=stjs.trunc(areaBound.getContentTop());var labelHeight=stjs.trunc(areaBound.getContentHeight());var labelBounds=[];var leftPos=stjs.trunc(areaBound.getContentLeft());var leftPosLimit=stjs.trunc(areaBound.getInnerLeft());var rightPosLimit=leftPosLimit+stjs.trunc(areaBound.getInnerWidth());for(var i=labelsTypeCount-1;i>=0;i--){var isBold=i>0;var currentLabelsTypeParameters=this.labelsParameters[i];var currentLabelsTypeCount=currentLabelsTypeParameters!=null?currentLabelsTypeParameters.length:0;for(var j=currentLabelsTypeCount-1;j>=0;j--){var currentLabelParameters=currentLabelsTypeParameters[j];if(currentLabelParameters!=null&&currentLabelParameters["position"]!=null&&currentLabelParameters["value"]!=null){var relativePosition=currentLabelParameters["position"];var xValue=currentLabelParameters["value"];formatter.setFormat(currentLabelParameters["format"]);var text=formatter.formatValue(xValue);var labelWidth=stjs.trunc(Math.ceil(chartView.getLabelWidth(text,font,fontSize,isBold)));var halfWidth=stjs.trunc(Math.round(labelWidth/2.0));var xCenter=stjs.trunc(Math.round(leftPos+(relativePosition*axisWidth)));var xStart=xCenter-halfWidth;var xEnd=xCenter+halfWidth;if(xStart<leftPosLimit){var correction=leftPosLimit-xStart;xCenter+=correction;xStart=leftPosLimit;}else if(xEnd>rightPosLimit){var correction=xEnd-rightPosLimit;xCenter-=correction;xStart-=correction;}
var currentLabelBound=new AreaBound(xStart,top,labelWidth,labelHeight);if(this.hasSpaceForLabel(labelBounds,currentLabelBound)){labelBounds.push(currentLabelBound);var label=ChartElementFactory.createLabel(layer,xValue,text,xCenter,top,labelWidth,labelHeight);label.setAlign(align);label.setBaseline(Label.BASELINE_TOP);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);}}}}};prototype.hasSpaceForLabel=function(currentBounds,newBound){if(currentBounds==null||newBound==null){return false;}
var currentBoundsCount=currentBounds.length;for(var i=0;i<currentBoundsCount;i++){var currentBound=currentBounds[i];if(currentBound!=null&&currentBound.isVisible()&&currentBound.intersects(newBound)){return false;}}
return true;};},{labelsParameters:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},messages:"ChartMessagesRepository",position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var DefaultGraphEngine=function(){};DefaultGraphEngine=stjs.extend(DefaultGraphEngine,null,[],function(constructor,prototype){prototype.createGraphElement=function(layer,area,serie,context,style){};prototype.createForegroundElements=function(layer,area,context,style){};prototype.traceGraphWith=function(path,area,serie,context,renderingRatio,direction,mainField,aggregationStrategy){if(serie==null){return;}
var bounds=area.getAreaBound();var serieId=serie.getId();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
if(path==null||renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var lastValidXCoordinate=chartLeftPos;var currentValues=null;var i=0;var increment=1;if(direction<0){i=renderingWidth-1;increment=-1;}
for(;i<renderingWidth&&i>=0;i=i+increment){var currentXPosition=i+chartLeftPos;currentValues=serie.getAggregatedValues(aggregationStrategy,context,i,chartWidth,mainField,true);if(currentValues!=null&&currentValues.length>0){lastValidXCoordinate=currentXPosition;for(var j=0;j<currentValues.length;j++){var currentValue=this.filterValue(currentValues[j],yMin,useLogScale);if(currentValue!=null){yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));if(yCoordinate<chartTopPos){yCoordinate=chartTopPos;}else if(yCoordinate>chartBottomPos){yCoordinate=chartBottomPos;}
path.pushPoint(lastValidXCoordinate,yCoordinate);}}}}};prototype.traceGraph=function(path,area,serie,context,renderingRatio,direction){if(serie==null){return;}
this.traceGraphWith(path,area,serie,context,renderingRatio,direction,serie.getMainField(),serie.getAggregationStrategy());};prototype.filterValue=function(value,yMin,useLogScale){if(value!=null&&!isNaN(value)){if(useLogScale){if(value>0){return Math.log(value);}else{return yMin;}}else{return value;}}else{return null;}};},{},{});
var DefaultAreaGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultAreaGraphEngine=stjs.extend(DefaultAreaGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultAreaGraphEngine.instance==null){DefaultAreaGraphEngine.instance=new DefaultAreaGraphEngine();}
return DefaultAreaGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var mainStrat=serie.getAggregationStrategy();var mainField=serie.getMainField();var renderingRatio=style.getRenderingRatio();var bounds=area.getAreaBound();var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=stjs.trunc((bounds.getBottom()-bounds.getBorderBottom()-bounds.getBorderTop()));var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);var highlightedTop=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraph(highlightedTop,area,serie,context,renderingRatio,1);var startPoint=highlightedTop.getStartPoint();var endPoint=highlightedTop.getEndPoint();if(startPoint!=null){areaZone.pushPoint(startPoint.getX(),chartBottomPos);}else{areaZone.pushPoint(chartLeftPos,chartBottomPos);}
this.traceGraph(areaZone,area,serie,context,renderingRatio,1);if(endPoint!=null){areaZone.pushPoint(endPoint.getX(),chartBottomPos);}else{areaZone.pushPoint(chartLeftPos+renderingWidth-1,chartBottomPos);}
var colorStrategy=serie.getColorStrategy();var contourColor=style.getAreaContourColor();if(colorStrategy!=null){if(serie.getLastValidValue(serie.getLength()-1,serie.getMainField())>=serie.getReferenceValue()){areaZone.setFillColor(colorStrategy.getPositiveColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(colorStrategy.getPositiveColor());}}else{areaZone.setFillColor(colorStrategy.getNegativeColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(colorStrategy.getNegativeColor());}}}else if(serie.getColor()!=null){areaZone.setFillColor(serie.getColor());if(contourColor!=null){highlightedTop.setStrokeColor(contourColor);}else{highlightedTop.setStrokeColor(serie.getColor());}}else{areaZone.setFillColor(ChartColor.black);highlightedTop.setStrokeColor(ChartColor.black);}
areaZone.setFillColorGradientParam([0,chartTopPos,0,chartBottomPos]);area.addElement(areaZone);area.addElement(highlightedTop);};},{instance:"DefaultAreaGraphEngine"},{});
var DefaultBarGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultBarGraphEngine=stjs.extend(DefaultBarGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){prototype.barType=null;prototype.chartZeroPos=0;constructor.instance=null;constructor.getInstance=function(){if(DefaultBarGraphEngine.instance==null){DefaultBarGraphEngine.instance=new DefaultBarGraphEngine();}
return DefaultBarGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);this.chartZeroPos=stjs.trunc((chartTopPos+heightRatio*yMax));if(yMax==0&&yMin==0){heightRatio=0;this.chartZeroPos=chartTopPos+stjs.trunc(chartHeight/2);}
this.chartZeroPos=DefaultBarGraphEngine.filterYCoordinate(this.chartZeroPos,chartTopPos,chartBottomPos,0,this.barType);var colorStrategy=serie.getColorStrategy();var backupColor=serie.getColor()!=null?serie.getColor():ChartColor.black;var yCoordinate=0;for(var i=0;i<renderingWidth;i++){var currentValues=serie.getAggregatedValues(serie.getAggregationStrategy(),context,i,chartWidth,serie.getMainField(),true);var currentValue=null;if(currentValues!=null&&currentValues.length>0){currentValue=currentValues[0];if(currentValue!=null&&useLogScale){if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}}
if(currentValue!=null){var indexes=serie.getCorrespondingIndices(context,i,chartWidth,true);if(indexes==null){}
var currentPoint=serie.getPoint(indexes[0]);var pointColor=currentPoint[ChartConstant.COLOR];var yRect=0;if(ChartOption.NORMAL_BAR.equals(this.barType)){yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));yCoordinate=DefaultBarGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentValue,this.barType);yRect=chartBottomPos;}else if(ChartOption.INVERSE_NEGATIVE_BAR.equals(this.barType)){var bothNegPos=false;if(yMin>0){yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*(currentValue-yMin)));}else if(yMax<0){yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*(currentValue-yMax)));}else{yCoordinate=stjs.trunc(Math.round(this.chartZeroPos-heightRatio*currentValue));bothNegPos=true;}
yCoordinate=DefaultBarGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentValue,this.barType);if(bothNegPos){if(currentValue>0){yRect=this.chartZeroPos;}else{yRect=this.chartZeroPos+1;}}else{yRect=this.chartZeroPos;}}else{throw new RuntimeException();}
var width=currentPoint[ChartConstant.WIDTH]==null?style.getBarWidth():currentPoint[ChartConstant.WIDTH];width=width!=null?width:1;var height=yCoordinate-yRect+1;if(currentValue==0){height=2;width=1;}
var xRectCorrection=stjs.trunc(Math.floor(width/2.0));var xRect=i+chartLeftPos-xRectCorrection;var bar=ChartElementFactory.createRect(layer,xRect,yRect,width,height);var id=currentPoint[ChartConstant.ID];if(id!=null){bar.setId(id);}
bar.setHighlightRectWidth(style.getHighlightBarWidth());bar.setHighlightColor(style.getHighlightBarColor());bar.setHighlightColorGradientParam(style.getHighlightLineColorGradientParams());bar.setHighlightMode(style.getHighlightBarMode());bar.setHoverRectWidth(style.getHoverBarWidth());bar.setHoverColor(style.getHoverBarColor());bar.setHoverColorGradientParam(style.getHoverBarColorGradientParams());bar.setHoverMode(style.getHoverBarMode());bar.setGroupRectWidth(style.getGroupBarWidth());bar.setGroupColor(style.getGroupBarColor());bar.setGroupColorGradientParam(style.getGroupBarColorGradientParams());if(currentValue==0){bar.setHoverMode(sq.ChartElement.HOVER.CIRCLE);}
bar.setData(currentPoint);if(pointColor!=null){bar.setFillColor(ChartColor.getColor(pointColor));}else if(colorStrategy!=null){if(yCoordinate<this.chartZeroPos){bar.setFillColor(colorStrategy.getPositiveColor());}else if(yCoordinate>this.chartZeroPos){bar.setFillColor(colorStrategy.getNegativeColor());}}else{bar.setFillColor(backupColor);}
if(currentPoint[ChartConstant.HIGHLIGHTED]!=null&&currentPoint[ChartConstant.HIGHLIGHTED]){var highlightColor=ChartColor.getColor(currentPoint[ChartConstant.HIGHLIGHT_COLOR]);var highlightWidth=currentPoint[ChartConstant.HIGHLIGHT_WIDTH];if(highlightColor!=null){bar.setHighlightColor(highlightColor);}
if(highlightWidth!=null){bar.setHighlightRectWidth(highlightWidth);}
bar.setHighlighted(true);}
if(currentPoint[ChartConstant.GROUPED]!=null&&currentPoint[ChartConstant.GROUPED]){this.createGroupElement(currentPoint,bar);}
area.addElement(bar);}}};prototype.createGroupElement=function(currentPoint,bar){var groupColor=ChartColor.getColor(currentPoint[ChartConstant.GROUP_COLOR]);var grouptWidth=currentPoint[ChartConstant.GROUP_WIDTH];if(groupColor!=null){bar.setGroupColor(groupColor);}
if(grouptWidth!=null){bar.setGroupRectWidth(grouptWidth);}
bar.setGrouped(true);};prototype.createForegroundElements=function(layer,area,context,style){var bounds=area.getAreaBound();var chartRightPos=stjs.trunc((bounds.getOuterWidth(true)+bounds.getLeft()));var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var chartBottomPos=chartTopPos+chartHeight;if(ChartOption.INVERSE_NEGATIVE_BAR.equals(this.barType)){this.chartZeroPos=DefaultBarGraphEngine.filterYCoordinate(this.chartZeroPos,chartTopPos,chartBottomPos,0,this.barType);var zeroLine=ChartElementFactory.createLine(layer,stjs.trunc(bounds.getLeft()),this.chartZeroPos,chartRightPos,this.chartZeroPos,1);area.addElement(zeroLine);}};constructor.filterYCoordinate=function(yValue,chartTopPos,chartBottomPos,currentValue,barType){var res=yValue;if(res<chartTopPos){res=chartTopPos;}
if(res>chartBottomPos){res=chartBottomPos;}
if(res==chartBottomPos&&currentValue>0){res=chartBottomPos-1;}
if(res==chartTopPos&&currentValue<=0&&ChartOption.INVERSE_NEGATIVE_BAR.equals(barType)){res=chartTopPos+1;}
return res;};prototype.getBarType=function(){return this.barType;};prototype.setBarType=function(barType){this.barType=barType;};},{instance:"DefaultBarGraphEngine"},{});
var DefaultLineGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultLineGraphEngine=stjs.extend(DefaultLineGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultLineGraphEngine.instance==null){DefaultLineGraphEngine.instance=new DefaultLineGraphEngine();}
return DefaultLineGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var graph=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraph(graph,area,serie,context,renderingRatio,1);if(serie.isDashed()){graph.setDashed(true);var dashValues=[5,4];graph.setDashValues(dashValues);}
var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){if(serie.getLastValidValue(serie.getLength()-1,serie.getMainField())>=serie.getReferenceValue()){graph.setStrokeColor(colorStrategy.getPositiveColor());}else{graph.setStrokeColor(colorStrategy.getNegativeColor());}}else{graph.setStrokeColor(serie.getColor());}
area.addElement(graph);};},{instance:"DefaultLineGraphEngine"},{});
var DefaultPointGraphEngine=function(){DefaultGraphEngine.call(this);};DefaultPointGraphEngine=stjs.extend(DefaultPointGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(DefaultPointGraphEngine.instance==null){DefaultPointGraphEngine.instance=new DefaultPointGraphEngine();}
return DefaultPointGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin>0&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var lastValidXCoordinate=chartLeftPos;var color=serie.getColor();if(color==null){color=ChartColor.black;}
var pointRadius=2;var currentValues=null;var i=0;for(;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;currentValues=serie.getAggregatedValues(serie.getAggregationStrategy(),context,i,chartWidth,serie.getMainField(),true);if(currentValues!=null&&currentValues.length>0){lastValidXCoordinate=currentXPosition;for(var j=0;j<currentValues.length;j++){var currentValue=currentValues[j];if(currentValue!=null){if(useLogScale){if(currentValue>0){currentValue=Math.log(currentValue);}else{currentValue=yMin;}}
yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentValue-yMin)));if(yCoordinate<chartTopPos){yCoordinate=chartTopPos;}else if(yCoordinate>chartBottomPos){yCoordinate=chartBottomPos;}
var point=ChartElementFactory.createCircle(layer,lastValidXCoordinate,yCoordinate,pointRadius);point.setStrokeColor(color);area.addElement(point);}}}}};},{instance:"DefaultPointGraphEngine"},{});
var BidAskAreaEngine=function(){DefaultGraphEngine.call(this);};BidAskAreaEngine=stjs.extend(BidAskAreaEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(BidAskAreaEngine.instance==null){BidAskAreaEngine.instance=new BidAskAreaEngine();}
return BidAskAreaEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,1,BidAskSerie.BID,AggregationStrategy.MIN);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,-1,BidAskSerie.ASK,AggregationStrategy.MAX);var bidLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(bidLine,area,serie,context,renderingRatio,1,BidAskSerie.BID,AggregationStrategy.MIN);var askLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(askLine,area,serie,context,renderingRatio,1,BidAskSerie.ASK,AggregationStrategy.MAX);var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){askLine.setStrokeColor(colorStrategy.getPositiveColor());bidLine.setStrokeColor(colorStrategy.getNegativeColor());areaZone.setFillColor(ChartColor.grey);}else{bidLine.setStrokeColor(ChartColor.redOld);askLine.setStrokeColor(ChartColor.greenOld);areaZone.setFillColor(ChartColor.grey);}
area.addElement(areaZone);area.addElement(bidLine);area.addElement(askLine);};},{instance:"BidAskAreaEngine"},{});
var HighLowAreaGraphEngine=function(){DefaultGraphEngine.call(this);};HighLowAreaGraphEngine=stjs.extend(HighLowAreaGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.getInstance=function(){if(HighLowAreaGraphEngine.instance==null){HighLowAreaGraphEngine.instance=new HighLowAreaGraphEngine();}
return HighLowAreaGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var renderingRatio=style.getRenderingRatio();var areaZone=ChartElementFactory.createPath(layer,style.getGraphLineWidth());areaZone.setFillShape(true);areaZone.setStrokeShape(false);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,1,FinancialSerie.LOW,AggregationStrategy.MIN);this.traceGraphWith(areaZone,area,serie,context,renderingRatio,-1,FinancialSerie.HIGH,AggregationStrategy.MAX);var lowLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(lowLine,area,serie,context,renderingRatio,1,FinancialSerie.LOW,AggregationStrategy.MIN);var highLine=ChartElementFactory.createPath(layer,style.getGraphLineWidth());this.traceGraphWith(highLine,area,serie,context,renderingRatio,1,FinancialSerie.HIGH,AggregationStrategy.MAX);var colorStrategy=serie.getColorStrategy();if(colorStrategy!=null){highLine.setStrokeColor(colorStrategy.getPositiveColor());lowLine.setStrokeColor(colorStrategy.getNegativeColor());areaZone.setFillColor(ChartColor.grey);}else{lowLine.setStrokeColor(ChartColor.redOld);highLine.setStrokeColor(ChartColor.greenOld);areaZone.setFillColor(ChartColor.grey);}
area.addElement(areaZone);area.addElement(lowLine);area.addElement(highLine);};},{instance:"HighLowAreaGraphEngine"},{});
var FinancialLegendEngine=function(options){DefaultLegendEngine.call(this,options);};FinancialLegendEngine=stjs.extend(FinancialLegendEngine,DefaultLegendEngine,[],function(constructor,prototype){prototype.createMainGraphics=function(chartView,chartData,context){if(!this.isVisible||chartData.isEmpty()){return;}
var legendStyle=chartView.getStyleModel().getLegendStyle();if(!legendStyle.isVisible()){return;}
var groundLayer=chartView.getGroundLayer();var legendArea=chartView.getArea(this.correspondingAreaId);this.createHeader(chartView,chartData,legendStyle,context);this.createTable(groundLayer,chartView,chartData,legendArea,legendStyle,context);};prototype.createHeader=function(chartView,chartData,style,context){var backgroundColor=style.getHeaderBackgroundColor();var backgroundColorGradientParam=style.getHeaderBackgroundColorGradientParam();var columnsRelativeWidth=style.getColumnsRelativeWidth();var messageRepo=ChartMessagesRepository.getInstance();var format=DateTimeFormatter.FORMAT_DATE;if(chartData.isIntraday()){format=DateTimeFormatter.FORMAT_DAY_MONTH_TIME;}
if(columnsRelativeWidth!=null&&columnsRelativeWidth.length>=4&&chartData.getExtremums()!=null){var xRange=context.getRange(Serie.X);var minNormalizedXValue=xRange!=null?xRange[0]:null;var maxNormalizedXValue=xRange!=null?xRange[1]:null;var firstXValue=Math.round(chartData.normalizedXValue2XValue(minNormalizedXValue));var lastXValue=Math.round(chartData.normalizedXValue2XValue(maxNormalizedXValue));var periodText="";if(firstXValue!=null&&lastXValue!=null&&!isNaN(lastXValue)&&!isNaN(firstXValue)){periodText=DateTimeFormatter.formatValueAs(firstXValue,format);periodText+=" "+messageRepo.get("to")+" ";periodText+=DateTimeFormatter.formatValueAs(lastXValue,format);}
var headerTexts=[periodText,messageRepo.get("periodHigh"),messageRepo.get("periodLow"),messageRepo.get("periodChange")];this.createRow(0,chartView,columnsRelativeWidth,headerTexts,[backgroundColor],[backgroundColorGradientParam],[style.getTextColor()],[style.getTextColorGradientParams()],[style.isBoldFont()]);}};prototype.createTable=function(layer,chartView,chartData,area,style,context){var pricesFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);var absolutePriceFormatValue=parseInt(pricesFormat);if(absolutePriceFormatValue==null||isNaN(absolutePriceFormatValue)||absolutePriceFormatValue<AbbreviateNumberFormatter.EXACTLY_2_DECIMALS){pricesFormat=String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS);}
var percentsFormat=context.getFormat(DefaultLayout.Y2_AXIS_AREA);var columnsRelativeWidth=style.getColumnsRelativeWidth();var series=chartData.getSeries();var evenColumnsColor=style.getEvenColumnsColor();var oddColumnsColor=style.getOddColumnsColor();var evenColumnsColorGradientParam=style.getEvenColumnsColorGradientParam();var oddColumnsColorGradientParam=style.getOddColumnsColorGradientParam();var columnsColors=[evenColumnsColor,oddColumnsColor];var columnsColorGradientParams=[evenColumnsColorGradientParam,oddColumnsColorGradientParam];var isBoldFonts=[true,false,false,false];var textColor=style.getTextColor();var count=1;for(var index in series){if(!(series).hasOwnProperty(index))
continue;var currentSerie=series[index];if(currentSerie!=null&&currentSerie.isEnabled()&&currentSerie.isInteractionAllowed()){var serieName="";var currentStock=currentSerie.getStock();if(currentStock!=null&&currentStock.getSymbol()!=null){serieName=currentStock.getSymbol()+currentStock.getMarketExtension();}
var startIndex=context.getMinIndex(currentSerie.getId(),Serie.X);var endIndex=context.getMaxIndex(currentSerie.getId(),Serie.X);var periodLowStr="-";var periodHighStr="-";if(startIndex!=null&&endIndex!=null){var minValues=currentSerie.getAggregateValuesFromRange(AggregationStrategy.MIN,startIndex,endIndex,FinancialSerie.LOW);var maxValues=currentSerie.getAggregateValuesFromRange(AggregationStrategy.MAX,startIndex,endIndex,FinancialSerie.HIGH);if(minValues!=null&&minValues[0]!=null&&minValues[0]>0){periodLowStr=AbbreviateNumberFormatter.formatAs(minValues[0],pricesFormat);}
if(maxValues!=null&&maxValues[0]!=null&&maxValues[0]>0){periodHighStr=AbbreviateNumberFormatter.formatAs(maxValues[0],pricesFormat);}}
var firstValue=currentSerie.getFirstValidValue(startIndex,Serie.Y);var endValue=currentSerie.getLastValidValue(endIndex,Serie.Y);var periodChangeStr="-";if(firstValue!=null&&endValue!=null&&!isNaN(firstValue)&&!isNaN(endValue)&&firstValue>0&&endValue>0){var change=endValue-firstValue;periodChangeStr=AbbreviateNumberFormatter.formatAs(change,pricesFormat);periodChangeStr+=" ("+PercentNumberFormatter.formatAs(100*(change/firstValue),percentsFormat)+")";}
var cellTexts=[serieName,periodHighStr,periodLowStr,periodChangeStr];var columnsTextColor=[FinancialEngineModel.COLORS_ARRAY[(count-1)%FinancialEngineModel.COLORS_ARRAY.length],textColor,textColor,textColor];this.createRow(count,chartView,columnsRelativeWidth,cellTexts,columnsColors,columnsColorGradientParams,columnsTextColor,null,isBoldFonts);count++;}}};prototype.createRow=function(count,chartView,columnsRelativeWidth,cellTexts,columnsBackgroundColor,columnsColorGradientParams,columnsTextColor,columnsTextColorGradientParams,isBoldFonts){var groundLayer=chartView.getGroundLayer();var legendArea=chartView.getArea(this.correspondingAreaId);var legendStyle=chartView.getStyleModel().getLegendStyle();var areaBound=legendArea.getAreaBound();var fontSize=legendStyle.getFontSize();var left=stjs.trunc(Math.round(areaBound.getInnerLeft()));var height=legendStyle.getLabelsHeight();var top=areaBound.getContentTop()+count*height;var yCenter=stjs.trunc(Math.round(top+height/2.0));var labelWidth=0;var columnsCount=columnsRelativeWidth.length;var columnsBackgroundColorCount=columnsBackgroundColor!=null?columnsBackgroundColor.length:0;var columnsColorGradientParamsCount=columnsColorGradientParams!=null?columnsColorGradientParams.length:0;var columnsTextColorCount=columnsTextColor!=null?columnsTextColor.length:0;var columnsTextColorGradientParamsCount=columnsTextColorGradientParams!=null?columnsTextColorGradientParams.length:0;var isBoldFontsCount=isBoldFonts!=null?isBoldFonts.length:0;for(var i=0;i<columnsCount;i++){left=left+labelWidth;labelWidth=stjs.trunc(Math.round(columnsRelativeWidth[i]*areaBound.getInnerWidth()));var centerX=stjs.trunc(Math.round(left+(labelWidth/2.0)));var backgroundColor=null;if(columnsBackgroundColorCount>0){backgroundColor=columnsBackgroundColor[i%columnsBackgroundColorCount];}
var backgroundColorGradientParam=[];if(columnsColorGradientParamsCount>0){backgroundColorGradientParam=columnsColorGradientParams[i%columnsColorGradientParamsCount];}
var textColor=null;if(columnsTextColorCount>0){textColor=columnsTextColor[i%columnsTextColorCount];}
var textColorGradientParams=[];if(columnsTextColorGradientParamsCount>0){textColorGradientParams=columnsTextColorGradientParams[i%columnsTextColorGradientParamsCount];}
var isBold=false;if(isBoldFontsCount>0){isBold=isBoldFonts[i%isBoldFontsCount];}
var currentLabel=ChartElementFactory.createLabel(groundLayer,0.0,cellTexts[i],centerX,yCenter,labelWidth,height);currentLabel.setAlign(Label.ALIGN_CENTER);currentLabel.setBaseline(Label.BASELINE_MIDDLE);currentLabel.setColor(textColor);currentLabel.setColorGradientParam(textColorGradientParams);currentLabel.setBackgroundColor(backgroundColor);currentLabel.setBackgroundColorGradientParam(backgroundColorGradientParam);currentLabel.setFontSize(fontSize);currentLabel.setBold(isBold);legendArea.addElement(currentLabel);}};},{},{});
var InterationModelEventHandlers=function(interactionModel,chart){this.interactionModel=interactionModel;this.chart=chart;};InterationModelEventHandlers=stjs.extend(InterationModelEventHandlers,null,[],function(constructor,prototype){constructor.MIN_TIME_BETWEEN_MOUSEMOVE=25;constructor.MIN_TIME_BETWEEN_MOUSEWHEEL=25;prototype.lastMouseMoveTime=0.0;prototype.lastMouseWheelTime=0.0;prototype.leftButton=false;prototype.rightButton=false;prototype.resizeTimer=null;prototype.interactionModel=null;prototype.chart=null;prototype.getOnResizeEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){clearTimeout(self.resizeTimer);var resizeChart=function(){self.chart.onResize(true);return false;};self.resizeTimer=setTimeout(resizeChart,100);return true;},1);return eh;};prototype.getOnMouseDownEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.leftButton=false;self.rightButton=false;if((typeof ev.which)!="undefined"){self.leftButton=(ev.which==1);self.rightButton=(ev.which==3);}else if((typeof ev.button)!="undefined"){self.leftButton=(ev.button==1);self.rightButton=(ev.button==2);}
if(self.leftButton){self.interactionModel.onLeftMouseDown(ev,THIS,self.chart);}else if(self.rightButton){self.interactionModel.onRightMouseDown(ev,THIS,self.chart);}else{self.interactionModel.onOtherMouseDown(ev,THIS,self.chart);}
return false;}
return true;},1);return eh;};prototype.getOnMouseUpEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseUp(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseMoveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){var now=(new Date()).getTime();if(now-self.lastMouseMoveTime<=InterationModelEventHandlers.MIN_TIME_BETWEEN_MOUSEMOVE){return true;}
self.lastMouseMoveTime=(new Date()).getTime();ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseMove(ev,THIS,self.chart);self.lastMouseMoveTime=(new Date()).getTime();return false;}
return true;},1);return eh;};prototype.getOnMouseLeaveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);self.interactionModel.lastMouseXPosition=null;self.interactionModel.lastMouseYPosition=null;self.interactionModel.onMouseLeave(ev,THIS,self.chart);return false;},1);return eh;};prototype.getOnMouseOverEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseOver(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseOutEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseOut(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnMouseEnterEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onMouseEnter(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnClickEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onClick(ev,THIS,self.chart);return true;}
return true;},1);return eh;};prototype.getOnUpdateSelectedElementEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onUpdateSelectedElement(ev,THIS,self.chart);return true;}
return true;},1);return eh;};prototype.getOnDoubleClickEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){self.interactionModel.onDoubleClick(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnContextMenuEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){ev=self.validateEvent(ev);if(self.chart.isChartRendered()){return false;}
return true;},1);return eh;};prototype.getOnMouseWheelEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){var now=(new Date()).getTime();if(now-self.lastMouseWheelTime<=InterationModelEventHandlers.MIN_TIME_BETWEEN_MOUSEWHEEL||(typeof ev.originalEvent)=="undefined"){return false;}
self.lastMouseWheelTime=(new Date()).getTime();if(self.chart.isChartRendered()){ev.offsetX=self.interactionModel.lastMouseXPosition;ev.offsetY=self.interactionModel.lastMouseYPosition;ev=self.validateEvent(ev);self.interactionModel.onMouseWheel(ev,THIS,self.chart);self.lastMouseWheelTime=(new Date()).getTime();return false;}
return false;},1);return eh;};prototype.getOnTouchStartEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){if(self.chart.isChartRendered()){self.interactionModel.onTouchStart(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnTouchMoveEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){if(self.chart.isChartRendered()){self.interactionModel.onTouchMove(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnTouchEndEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){if(self.chart.isChartRendered()){self.interactionModel.onTouchEnd(ev,THIS,self.chart);}
return true;},1);return eh;};prototype.getOnTouchCancelEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){if(self.chart.isChartRendered()){self.interactionModel.onTouchCancel(ev,THIS,self.chart);return false;}
return true;},1);return eh;};prototype.getOnKeyUpEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){return self.interactionModel.onKeyUp(ev,THIS,self.chart);},1);return eh;};prototype.getOnKeyDownEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){return self.interactionModel.onKeyDown(ev,THIS,self.chart);},1);return eh;};prototype.validateEvent=function(event){if(event==null){event=(window)["event"];}
if((typeof event.offsetX)=="undefined"||(typeof event.offsetY)=="undefined"){var targetOffset=SQW.$(event.target).offset();event.offsetX=event.pageX-targetOffset.left;event.offsetY=event.pageY-targetOffset.top;}
this.interactionModel.lastMouseXPosition=event.offsetX;this.interactionModel.lastMouseYPosition=event.offsetY;return event;};},{resizeTimer:"TimeoutHandler",interactionModel:"AbstractInteractionModel",chart:"Chart"},{});
var AbstractInteractionModel=function(){};AbstractInteractionModel=stjs.extend(AbstractInteractionModel,null,[],function(constructor,prototype){constructor.ZOOM_IN_TOUCH_PERCENT=0.9;constructor.ZOOM_OUT_TOUCH_PERCENT=1.15;constructor.ZOOM_IN_WHEEL_PERCENT=0.8;constructor.ZOOM_OUT_WHEEL_PERCENT=1.25;constructor.ZOOM_DOUBLE_CLICK_PERCENT=0.6;prototype.lastMouseXPosition=null;prototype.lastMouseYPosition=null;prototype.currentCursorType="default";prototype.onMouseMoveEventHandler=null;prototype.onMouseOverEventHandler=null;prototype.onMouseOutEventHandler=null;prototype.onMouseEnterEventHandler=null;prototype.onMouseLeaveEventHandler=null;prototype.onMouseUpEventHandler=null;prototype.onMouseDownEventHandler=null;prototype.onClickEventHandler=null;prototype.onDoubleClickEventHandler=null;prototype.onMouseWheelEventHandler=null;prototype.onTouchStartEventHandler=null;prototype.onTouchMoveEventHandler=null;prototype.onTouchEndEventHandler=null;prototype.onTouchCancelEventHandler=null;prototype.onKeyDownEventHandler=null;prototype.onKeyUpEventHandler=null;prototype.onResizeEventHandler=null;prototype.onUpdateSelectedElementEventHandler=null;prototype.onContextMenuEventHandler=null;prototype.getInteractionModelType=function(){};constructor.getDefaultFromDevice=function(){return new DefaultInteractionModel();};constructor.registerModelOn=function(interactionModel,element,chart){if(chart==null||interactionModel==null||element==null||element.data(interactionModel.getInteractionModelType())!=null){return;}
AbstractInteractionModel.initEvents(interactionModel,element,chart);AbstractInteractionModel.attachEvents(interactionModel,element);interactionModel.onUserEvent(element,chart);element.data(interactionModel.getInteractionModelType(),true);};constructor.unregisterModelOn=function(interactionModel,element){if(interactionModel==null||element==null||element.data(interactionModel.getInteractionModelType())==null){return;}
AbstractInteractionModel.detachEvents(interactionModel,element);interactionModel.offUserEvent(element);element.data(interactionModel.getInteractionModelType(),null);};prototype.getLastMouseXPosition=function(){return this.lastMouseXPosition;};prototype.getLastMouseYPosition=function(){return this.lastMouseYPosition;};prototype.onMouseMove=function(event,element,chart){};prototype.onMouseOver=function(event,element,chart){};prototype.onMouseEnter=function(event,element,chart){};prototype.onMouseOut=function(event,element,chart){this.lastMouseXPosition=-1;this.lastMouseYPosition=-1;chart.mouseAt(-1,-1);};prototype.onMouseLeave=function(event,element,chart){this.onMouseOut(event,element,chart);};prototype.onLeftMouseDown=function(event,element,chart){};prototype.onRightMouseDown=function(event,element,chart){};prototype.onOtherMouseDown=function(event,element,chart){};prototype.onMouseUp=function(event,element,chart){};prototype.onClick=function(event,element,chart){};prototype.onDoubleClick=function(event,element,chart){};prototype.onMouseWheel=function(event,element,chart){};prototype.onTouchStart=function(event,element,chart){};prototype.onTouchMove=function(event,element,chart){};prototype.onTouchEnd=function(event,element,chart){};prototype.onTouchCancel=function(event,element,chart){};prototype.onKeyDown=function(event,element,chart){return true;};prototype.onKeyUp=function(event,element,chart){return true;};prototype.onUserEvent=function(element,chart){};prototype.offUserEvent=function(element){};prototype.onUpdateSelectedElement=function(event,element,chart){};prototype.getTargetTouches=function(event){if(event==null){event=(window)["event"];}
if(event==null||(typeof event)=="undefined"||(typeof event.originalEvent)=="undefined"){return null;}
return(event.originalEvent)["targetTouches"];};constructor.initEvents=function(interactionModel,element,chart){var eventHandlers=new InterationModelEventHandlers(interactionModel,chart);interactionModel.onResizeEventHandler=eventHandlers.getOnResizeEventHandler();interactionModel.onMouseUpEventHandler=eventHandlers.getOnMouseUpEventHandler();interactionModel.onMouseMoveEventHandler=eventHandlers.getOnMouseMoveEventHandler();interactionModel.onMouseDownEventHandler=eventHandlers.getOnMouseDownEventHandler();interactionModel.onMouseOverEventHandler=eventHandlers.getOnMouseOverEventHandler();interactionModel.onMouseOutEventHandler=eventHandlers.getOnMouseOutEventHandler();interactionModel.onMouseEnterEventHandler=eventHandlers.getOnMouseEnterEventHandler();interactionModel.onMouseLeaveEventHandler=eventHandlers.getOnMouseLeaveEventHandler();interactionModel.onClickEventHandler=eventHandlers.getOnClickEventHandler();interactionModel.onUpdateSelectedElementEventHandler=eventHandlers.getOnUpdateSelectedElementEventHandler();interactionModel.onDoubleClickEventHandler=eventHandlers.getOnDoubleClickEventHandler();interactionModel.onContextMenuEventHandler=eventHandlers.getOnContextMenuEventHandler();interactionModel.onMouseWheelEventHandler=eventHandlers.getOnMouseWheelEventHandler();interactionModel.onTouchStartEventHandler=eventHandlers.getOnTouchStartEventHandler();interactionModel.onTouchMoveEventHandler=eventHandlers.getOnTouchMoveEventHandler();interactionModel.onTouchEndEventHandler=eventHandlers.getOnTouchEndEventHandler();interactionModel.onTouchCancelEventHandler=eventHandlers.getOnTouchCancelEventHandler();interactionModel.onKeyDownEventHandler=eventHandlers.getOnKeyDownEventHandler();interactionModel.onKeyUpEventHandler=eventHandlers.getOnKeyUpEventHandler();};constructor.attachEvents=function(interactionModel,element){SQW.$(window).resize(interactionModel.onResizeEventHandler);SQW.$(window).on("mouseup",interactionModel.onMouseUpEventHandler);SQW.$(window).on("keydown",interactionModel.onKeyDownEventHandler);SQW.$(window).on("keyup",interactionModel.onKeyUpEventHandler);element.on("mousemove",interactionModel.onMouseMoveEventHandler);element.on("mousedown",interactionModel.onMouseDownEventHandler);element.on("mouseover",interactionModel.onMouseOverEventHandler);element.on("mouseout",interactionModel.onMouseOutEventHandler);element.on("mouseenter",interactionModel.onMouseEnterEventHandler);element.on("mouseleave",interactionModel.onMouseLeaveEventHandler);element.on("click",interactionModel.onClickEventHandler);element.on("updateSelectedElement",interactionModel.onUpdateSelectedElementEventHandler);element.on("dblclick",interactionModel.onDoubleClickEventHandler);element.on("contextmenu",interactionModel.onContextMenuEventHandler);element.on("DOMMouseScroll",interactionModel.onMouseWheelEventHandler);element.on("mousewheel",interactionModel.onMouseWheelEventHandler);element.on("touchstart",interactionModel.onTouchStartEventHandler);element.on("touchmove",interactionModel.onTouchMoveEventHandler);element.on("touchend",interactionModel.onTouchEndEventHandler);element.on("touchcancel",interactionModel.onTouchCancelEventHandler);};constructor.detachEvents=function(interactionModel,element){SQW.$(window).off("resize",interactionModel.onResizeEventHandler);SQW.$(window).off("mouseup",interactionModel.onMouseUpEventHandler);SQW.$(window).off("keydown",interactionModel.onKeyDownEventHandler);SQW.$(window).off("keyup",interactionModel.onKeyUpEventHandler);element.off("mousemove",interactionModel.onMouseMoveEventHandler);element.off("mousedown",interactionModel.onMouseDownEventHandler);element.off("mouseover",interactionModel.onMouseOverEventHandler);element.off("mouseout",interactionModel.onMouseOutEventHandler);element.off("mouseenter",interactionModel.onMouseEnterEventHandler);element.off("mouseleave",interactionModel.onMouseLeaveEventHandler);element.off("click",interactionModel.onClickEventHandler);element.off("updateSelectedElement",interactionModel.onUpdateSelectedElementEventHandler);element.off("dblclick",interactionModel.onDoubleClickEventHandler);element.off("contextmenu",interactionModel.onContextMenuEventHandler);element.off("DOMMouseScroll",interactionModel.onMouseWheelEventHandler);element.off("mousewheel",interactionModel.onMouseWheelEventHandler);element.off("touchstart",interactionModel.onTouchStartEventHandler);element.off("touchmove",interactionModel.onTouchMoveEventHandler);element.off("touchend",interactionModel.onTouchEndEventHandler);element.off("touchcancel",interactionModel.onTouchCancelEventHandler);};},{onMouseMoveEventHandler:"EventHandler",onMouseOverEventHandler:"EventHandler",onMouseOutEventHandler:"EventHandler",onMouseEnterEventHandler:"EventHandler",onMouseLeaveEventHandler:"EventHandler",onMouseUpEventHandler:"EventHandler",onMouseDownEventHandler:"EventHandler",onClickEventHandler:"EventHandler",onDoubleClickEventHandler:"EventHandler",onMouseWheelEventHandler:"EventHandler",onTouchStartEventHandler:"EventHandler",onTouchMoveEventHandler:"EventHandler",onTouchEndEventHandler:"EventHandler",onTouchCancelEventHandler:"EventHandler",onKeyDownEventHandler:"EventHandler",onKeyUpEventHandler:"EventHandler",onResizeEventHandler:"EventHandler",onUpdateSelectedElementEventHandler:"EventHandler",onContextMenuEventHandler:"EventHandler"},{});
var DefaultInteractionModel=function(){AbstractInteractionModel.call(this);};DefaultInteractionModel=stjs.extend(DefaultInteractionModel,AbstractInteractionModel,[],function(constructor,prototype){prototype.lastOffsetX=null;prototype.lastOffsetY=null;constructor.INTERACTION_MODEL_TYPE="defaultInteractionModel";prototype.centerPoint=null;prototype.previousP0=null;prototype.previousP1=null;prototype.previousP0Identifier=0;prototype.previousP1Identifier=0;prototype.getInteractionModelType=function(){return DefaultInteractionModel.INTERACTION_MODEL_TYPE;};prototype.onMouseMove=function(event,element,chart){var offsetX=event.offsetX;var offsetY=event.offsetY;if(chart.isPanStarted()){chart.movePan(offsetX,offsetY);}else if(chart.isZoomStarted()){chart.moveZoom(offsetX,offsetY);}else{chart.mouseAt(offsetX,offsetY);var chartView=chart.getChartView();if(chartView.isInside(offsetX,offsetY)){var zoomIcon=chartView.findElementById(DefaultTitleEngine.ICON_ID);var elementStyle=(element)["style"];if(zoomIcon!=null&&zoomIcon.isInside(offsetX,offsetY)){if(this.currentCursorType!="pointer"){this.currentCursorType="pointer";elementStyle["cursor"]=this.currentCursorType;}}else if(this.currentCursorType!="default"){this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}}}};prototype.onLeftMouseDown=function(event,element,chart){var startedPanning=chart.startPan(event.offsetX,event.offsetY);if(startedPanning&&element!=null&&this.currentCursorType!="move"){var elementStyle=(element)["style"];this.currentCursorType="move";elementStyle["cursor"]=this.currentCursorType;}};prototype.onRightMouseDown=function(event,element,chart){chart.zoomBack();chart.mouseAt(event.offsetX,event.offsetY);};prototype.onMouseUp=function(event,element,chart){var target=$(event.target);chart.endPan(event.offsetX,event.offsetY);chart.endZoom(event.offsetX,event.offsetY);this.lastMouseXPosition=-1;this.lastMouseYPosition=-1;if(chart.getParentElement()!=null){var jElement=chart.getParentElement();if(jElement.has(target.get(0)).size()>0){chart.mouseAt(event.offsetX,event.offsetY);this.lastMouseXPosition=event.offsetX;this.lastMouseYPosition=event.offsetY;}
if(jElement.get(0)!=null&&this.currentCursorType!="default"){var elementStyle=(jElement.get(0))["style"];this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}}};prototype.onClick=function(event,element,chart){chart.click(event.offsetX,event.offsetY);if(chart.getParentElement()!=null&&chart.getParentElement().get(0)!=null&&this.currentCursorType!="default"){var elementStyle=(chart.getParentElement().get(0))["style"];this.currentCursorType="default";elementStyle["cursor"]=this.currentCursorType;}};prototype.onDoubleClick=function(event,element,chart){chart.zoomIn(event.offsetX,event.offsetY,AbstractInteractionModel.ZOOM_DOUBLE_CLICK_PERCENT);chart.mouseAt(event.offsetX,event.offsetY);};prototype.onMouseWheel=function(event,element,chart){var zoomIn=true;if((typeof event.originalEvent.wheelDelta)!="undefined"){zoomIn=event.originalEvent.wheelDelta>0;}else if(typeof event.originalEvent.detail!='undefined'){zoomIn=event.originalEvent.detail<0;}else if(typeof event.originalEvent.deltaY!='undefined'){zoomIn=event.originalEvent.deltaY<0;}else{return;}
if(zoomIn){chart.zoomInWheel(this.lastMouseXPosition,this.lastMouseYPosition,AbstractInteractionModel.ZOOM_IN_WHEEL_PERCENT);}else{chart.zoomOutWheel(this.lastMouseXPosition,this.lastMouseYPosition,AbstractInteractionModel.ZOOM_OUT_WHEEL_PERCENT);}
chart.mouseAt(this.lastMouseXPosition,this.lastMouseYPosition);};prototype.onTouchStart=function(event,element,chart){var targetTouches=this.getTargetTouches(event);if(chart==null||(typeof targetTouches)=="undefined"||targetTouches==null||targetTouches.length==0||targetTouches.length>2){return;}
var elementOffset=$(event.target).offset();if(targetTouches.length==1){var touch=targetTouches[0];var offsetX=touch.pageX-elementOffset.left;var offsetY=touch.pageY-elementOffset.top;this.lastOffsetX=offsetX;this.lastOffsetY=offsetY;chart.startPan(offsetX,offsetY);chart.mouseAt(null,null);}else if(targetTouches.length==2){event.preventDefault();if(chart.isPanning()){chart.endPan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);this.lastOffsetX=null;this.lastOffsetY=null;}
var touch0=targetTouches[0];var offsetX0=touch0.pageX-elementOffset.left;var offsetY0=touch0.pageY-elementOffset.top;var touch1=targetTouches[1];var offsetX1=touch1.pageX-elementOffset.left;var offsetY1=touch1.pageY-elementOffset.top;this.previousP0=new Point2D(offsetX0,offsetY0);this.previousP0Identifier=touch0.identifier;this.previousP1=new Point2D(offsetX1,offsetY1);this.previousP1Identifier=touch1.identifier;this.centerPoint=this.previousP0.midpointWith(this.previousP1);}};prototype.onTouchMove=function(event,element,chart){var targetTouches=this.getTargetTouches(event);if(chart==null||(typeof targetTouches)=="undefined"||targetTouches==null||targetTouches.length==0||targetTouches.length>2){return;}
var elementOffset=$(event.target).offset();if(chart.isPanning()){event.preventDefault();var touch=targetTouches[0];this.lastOffsetX=touch.pageX-elementOffset.left;this.lastOffsetY=touch.pageY-elementOffset.top;chart.movePan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);}else if(this.previousP0!=null&&this.previousP1!=null){event.preventDefault();var p0=this.previousP0;var p1=this.previousP1;var touchesCount=targetTouches.length;for(var i=0;i<touchesCount;i++){var currentTouch=targetTouches[i];var offsetX=currentTouch.pageX-elementOffset.left;var offsetY=currentTouch.pageY-elementOffset.top;if(currentTouch.identifier==this.previousP0Identifier){p0=new Point2D(offsetX,offsetY);}else if(currentTouch.identifier==this.previousP1Identifier){p1=new Point2D(offsetX,offsetY);}}
var previousDistance=this.previousP0.distanceTo(this.previousP1);var currentDistance=p0.distanceTo(p1);if(currentDistance>previousDistance){chart.zoomIn(this.centerPoint.getX(),this.centerPoint.getY(),AbstractInteractionModel.ZOOM_IN_TOUCH_PERCENT);}else if(currentDistance<previousDistance){chart.zoomOut(this.centerPoint.getX(),this.centerPoint.getY(),AbstractInteractionModel.ZOOM_OUT_TOUCH_PERCENT);}
chart.mouseAt(null,null);this.previousP0=p0;this.previousP1=p1;}};prototype.onTouchEnd=function(event,element,chart){this.previousP0=null;this.previousP1=null;this.centerPoint=null;this.previousP0Identifier=-1;this.previousP1Identifier=-1;if(event==null){event=(window)["event"];}
if(chart==null||(typeof event)=="undefined"||(typeof event.originalEvent)=="undefined"){return;}
var elementOffset=$(event.target).offset();if(chart.isPanning()){event.preventDefault();chart.endPan(this.lastOffsetX,this.lastOffsetY);chart.mouseAt(null,null);this.lastOffsetX=null;this.lastOffsetY=null;}};},{centerPoint:"Point2D",previousP0:"Point2D",previousP1:"Point2D",onMouseMoveEventHandler:"EventHandler",onMouseOverEventHandler:"EventHandler",onMouseOutEventHandler:"EventHandler",onMouseEnterEventHandler:"EventHandler",onMouseLeaveEventHandler:"EventHandler",onMouseUpEventHandler:"EventHandler",onMouseDownEventHandler:"EventHandler",onClickEventHandler:"EventHandler",onDoubleClickEventHandler:"EventHandler",onMouseWheelEventHandler:"EventHandler",onTouchStartEventHandler:"EventHandler",onTouchMoveEventHandler:"EventHandler",onTouchEndEventHandler:"EventHandler",onTouchCancelEventHandler:"EventHandler",onKeyDownEventHandler:"EventHandler",onKeyUpEventHandler:"EventHandler",onResizeEventHandler:"EventHandler",onUpdateSelectedElementEventHandler:"EventHandler",onContextMenuEventHandler:"EventHandler"},{});
var StyleModel=function(){this.styles={};};StyleModel=stjs.extend(StyleModel,null,[],function(constructor,prototype){prototype.globalStyle=null;prototype.tooltipStyle=null;prototype.titleStyle=null;prototype.xAxisStyle=null;prototype.y1AxisStyle=null;prototype.y2AxisStyle=null;prototype.legendStyle=null;prototype.graphStyle=null;prototype.drawStyle=null;prototype.styles=null;prototype.init=function(options){};prototype.getYAxesWidth=function(){};prototype.getTooltipStyle=function(){return this.tooltipStyle;};prototype.setTooltipStyle=function(tooltipStyle){this.tooltipStyle=tooltipStyle;};prototype.getGlobalStyle=function(){return this.globalStyle;};prototype.setGlobalStyle=function(globalStyle){this.globalStyle=globalStyle;};prototype.getTitleStyle=function(){return this.titleStyle;};prototype.setTitleStyle=function(titleStyle){this.titleStyle=titleStyle;};prototype.getLegendStyle=function(){return this.legendStyle;};prototype.setLegendStyle=function(legendStyle){this.legendStyle=legendStyle;};prototype.getGraphStyle=function(){return this.graphStyle;};prototype.setGraphStyle=function(graphStyle){this.graphStyle=graphStyle;};prototype.getXAxisStyle=function(){return this.xAxisStyle;};prototype.setxAxisStyle=function(xAxisStyle){this.xAxisStyle=xAxisStyle;};prototype.getY1AxisStyle=function(){return this.y1AxisStyle;};prototype.setY1AxisStyle=function(y1AxisStyle){this.y1AxisStyle=y1AxisStyle;};prototype.getY2AxisStyle=function(){return this.y2AxisStyle;};prototype.setY2AxisStyle=function(y2AxisStyle){this.y2AxisStyle=y2AxisStyle;};prototype.getStyle=function(styleId){return this.styles[styleId];};prototype.setStyle=function(styleId,style){this.styles[styleId]=style;};},{globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var DefaultStyleModel=function(){StyleModel.call(this);};DefaultStyleModel=stjs.extend(DefaultStyleModel,StyleModel,[],function(constructor,prototype){prototype.init=function(options){this.graphStyle=this.getGraphStyleFromType(options);this.globalStyle=new DefaultGlobalStyle(options);this.tooltipStyle=new DefaultToolTipStyle(options);this.titleStyle=new DefaultTitleStyle(options);this.xAxisStyle=new DefaultXAxisStyle(options);this.y1AxisStyle=new DefaultYAxisStyle(options);this.y1AxisStyle.setPosition(options.getY1AxisPosition());this.y1AxisStyle.setVisible(options.getY1AxisPosition()!=Layout.Position.NONE);this.y2AxisStyle=new DefaultYAxisStyle(options);this.y2AxisStyle.setPosition(options.getY2AxisPosition());this.y2AxisStyle.setVisible(options.getY2AxisPosition()!=Layout.Position.NONE);this.legendStyle=new DefaultLegendStyle(options);this.drawStyle=new DefaultDrawStyle(options);this.extend(options);this.styles[DefaultLayout.TITLE_AREA]=this.titleStyle;this.styles[DefaultLayout.X_AXIS_AREA]=this.xAxisStyle;this.styles[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisStyle;this.styles[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisStyle;this.styles[DefaultLayout.GRAPH_AREA]=this.graphStyle;this.styles[DefaultLayout.LEGEND_AREA]=this.legendStyle;this.styles[DefaultLayout.TOOLTIP_AREA]=this.tooltipStyle;this.styles[DrawStyle.ID]=this.drawStyle;};prototype.extend=function(options){var customStyleModel=options.getCustomStyleModel();if(customStyleModel!=null){if((customStyleModel)["init"]!=null){options.setCustomeStyleModel(null);customStyleModel.init(options);options.setCustomeStyleModel(customStyleModel);}
var validStyles={};var tmp={};this.extendStyle(customStyleModel,validStyles,"titleStyle");this.extendStyle(customStyleModel,validStyles,"xAxisStyle");this.extendStyle(customStyleModel,validStyles,"y1AxisStyle");this.extendStyle(customStyleModel,validStyles,"y2AxisStyle");this.extendStyle(customStyleModel,validStyles,"graphStyle");this.extendStyle(customStyleModel,validStyles,"legendStyle");this.extendStyle(customStyleModel,validStyles,"tooltipStyle");this.extendStyle(customStyleModel,validStyles,"drawStyle");SQW.$.extend(true,tmp,customStyleModel,validStyles);SQW.$.extend(true,this,tmp);}};prototype.extendStyle=function(customStyleModel,a,propName){if((customStyleModel)[propName]!=null){(a)[propName]=SQW.$.extend((this)[propName],(customStyleModel)[propName]);}};prototype.getGraphStyleFromType=function(options){var type=Chart.ChartType.valueOf(options.getType());if(type==Chart.ChartType.LINE){return new DefaultLineGraphStyle(options);}else if(type==Chart.ChartType.POINT){return new DefaultPointGraphStyle(options);}else if(type==Chart.ChartType.AREA){return new DefaultAreaGraphStyle(options);}else if(type==Chart.ChartType.BAR){return new DefaultBarGraphStyle(options);}else{return new DefaultLineGraphStyle(options);}};prototype.getYAxesWidth=function(){var axesWidth={};var y1Width=this.y1AxisStyle!=null?this.y1AxisStyle.getLabelsWidth():0;var y2Width=this.y2AxisStyle!=null?this.y2AxisStyle.getLabelsWidth():0;axesWidth[DefaultLayout.Y1_AXIS_AREA]=y1Width;axesWidth[DefaultLayout.Y2_AXIS_AREA]=y2Width;return axesWidth;};},{globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var Style=function(option){this.style={};this.zIndex=1;this.textColor=ChartColor.black;this.fontSize=12;this.boldFont=false;this.font="Arial";if(this.font==null){this.font="Arial";}
this.borderLeftStyle="solid";this.borderRightStyle="solid";this.borderTopStyle="solid";this.borderBottomStyle="solid";this.borderLeft=0;this.borderRight=0;this.borderTop=0;this.borderBottom=0;this.borderLeftColor=ChartColor.black;if(option!=null){this.backgroundColor=option.getBackgroundColor();this.backgroundColorGradientParams=option.getBackgroundColorGradientParams();if(option.getBorderColor()!=null){this.borderLeftColor=option.getBorderColor();}
if(option.getTextColor()!=null){this.textColor=option.getTextColor();}
this.font=option.getLabelFont();this.fontSize=option.getNormalLabelFontSize();}
this.borderRightColor=this.borderLeftColor;this.borderTopColor=this.borderLeftColor;this.borderBottomColor=this.borderLeftColor;this.visible=true;};Style=stjs.extend(Style,null,[],function(constructor,prototype){prototype.style=null;prototype.position=null;prototype.cursor=null;prototype.zIndex=0;prototype.textColor=null;prototype.textColorGradientParams=null;prototype.fontSize=0;prototype.boldFont=false;prototype.font=null;prototype.fontStyle=null;prototype.leftAbsolute=null;prototype.topAbsolute=null;prototype.widthAbsolute=null;prototype.heightAbsolute=null;prototype.leftRatio=null;prototype.topRatio=null;prototype.widthRatio=null;prototype.heightRatio=null;prototype.paddingLeftAbsolute=null;prototype.paddingRightAbsolute=null;prototype.paddingTopAbsolute=null;prototype.paddingBottomAbsolute=null;prototype.paddingLeftRatio=null;prototype.paddingRightRatio=null;prototype.paddingTopRatio=null;prototype.paddingBottomRatio=null;prototype.marginLeftAbsolute=null;prototype.marginRightAbsolute=null;prototype.marginTopAbsolute=null;prototype.marginBottomAbsolute=null;prototype.marginLeftRatio=null;prototype.marginRightRatio=null;prototype.marginTopRatio=null;prototype.marginBottomRatio=null;prototype.borderLeftStyle=null;prototype.borderRightStyle=null;prototype.borderTopStyle=null;prototype.borderBottomStyle=null;prototype.borderLeft=0.0;prototype.borderRight=0.0;prototype.borderTop=0.0;prototype.borderBottom=0.0;prototype.borderLeftColor=null;prototype.borderRightColor=null;prototype.borderTopColor=null;prototype.borderBottomColor=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParams=null;prototype.visible=false;prototype.getStyle=function(){return this.style;};prototype.setStyle=function(style){this.style=style;};prototype.getPosition=function(){return this.position;};prototype.setPosition=function(position){this.position=position;};prototype.getCursor=function(){return this.cursor;};prototype.setCursor=function(cursor){this.cursor=cursor;};prototype.getzIndex=function(){return this.zIndex;};prototype.setzIndex=function(zIndex){this.zIndex=zIndex;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getTextColorGradientParams=function(){return this.textColorGradientParams;};prototype.setTextColorGradientParams=function(textColorGradientParams){this.textColorGradientParams=textColorGradientParams;};prototype.getBorderLeftStyle=function(){return this.borderLeftStyle;};prototype.setBorderLeftStyle=function(borderLeftStyle){this.borderLeftStyle=borderLeftStyle;};prototype.getBorderRightStyle=function(){return this.borderRightStyle;};prototype.setBorderRightStyle=function(borderRightStyle){this.borderRightStyle=borderRightStyle;};prototype.getBorderTopStyle=function(){return this.borderTopStyle;};prototype.setBorderTopStyle=function(borderTopStyle){this.borderTopStyle=borderTopStyle;};prototype.getBorderBottomStyle=function(){return this.borderBottomStyle;};prototype.setBorderBottomStyle=function(borderBottomStyle){this.borderBottomStyle=borderBottomStyle;};prototype.getBorderLeft=function(){return this.borderLeft;};prototype.setBorderLeft=function(borderLeft){this.borderLeft=borderLeft;};prototype.getBorderRight=function(){return this.borderRight;};prototype.setBorderRight=function(borderRight){this.borderRight=borderRight;};prototype.getBorderTop=function(){return this.borderTop;};prototype.setBorderTop=function(borderTop){this.borderTop=borderTop;};prototype.getBorderBottom=function(){return this.borderBottom;};prototype.setBorderBottom=function(borderBottom){this.borderBottom=borderBottom;};prototype.getBorderLeftColor=function(){return this.borderLeftColor;};prototype.setBorderLeftColor=function(borderLeftColor){this.borderLeftColor=borderLeftColor;};prototype.getBorderRightColor=function(){return this.borderRightColor;};prototype.setBorderRightColor=function(borderRightColor){this.borderRightColor=borderRightColor;};prototype.getBorderTopColor=function(){return this.borderTopColor;};prototype.setBorderTopColor=function(borderTopColor){this.borderTopColor=borderTopColor;};prototype.getBorderBottomColor=function(){return this.borderBottomColor;};prototype.setBorderBottomColor=function(borderBottomColor){this.borderBottomColor=borderBottomColor;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParams=function(){return this.backgroundColorGradientParams;};prototype.setBackgroundColorGradientParams=function(backgroundColorGradientParams){this.backgroundColorGradientParams=backgroundColorGradientParams;};prototype.isVisible=function(){return this.visible;};prototype.setVisible=function(visible){this.visible=visible;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.isBoldFont=function(){return this.boldFont;};prototype.setBoldFont=function(boldFont){this.boldFont=boldFont;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getFontStyle=function(){return this.fontStyle;};prototype.setFontStyle=function(fontStyle){this.fontStyle=fontStyle;};prototype.setAbsoluteLeft=function(absoluteLeft){this.leftAbsolute=absoluteLeft;this.leftRatio=null;};prototype.setAbsoluteTop=function(absoluteTop){this.topAbsolute=absoluteTop;this.topRatio=null;};prototype.setAbsoluteWidth=function(absoluteWidth){this.widthAbsolute=absoluteWidth;this.widthRatio=null;};prototype.setAbsoluteHeight=function(absoluteHeight){this.heightAbsolute=absoluteHeight;this.heightRatio=null;};prototype.setLeftRatio=function(leftRatio){this.leftAbsolute=null;this.leftRatio=leftRatio;};prototype.setTopRatio=function(topRatio){this.topAbsolute=null;this.topRatio=topRatio;};prototype.setWidthRatio=function(widthRatio){this.widthAbsolute=null;this.widthRatio=widthRatio;};prototype.setHeightRatio=function(heightRatio){this.heightAbsolute=null;this.heightRatio=heightRatio;};prototype.getLeft=function(fullWidth){if(this.leftAbsolute!=null){return this.leftAbsolute;}else if(this.leftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.leftRatio*fullWidth));}else{return null;}};prototype.getTop=function(fullHeight){if(this.topAbsolute!=null){return this.topAbsolute;}else if(this.topRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.topRatio*fullHeight));}else{return null;}};prototype.getWidth=function(fullWidth){if(this.widthAbsolute!=null){return this.widthAbsolute;}else if(this.widthRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.widthRatio*fullWidth));}else{return null;}};prototype.getHeight=function(fullHeight){if(this.heightAbsolute!=null){return this.heightAbsolute;}else if(this.heightRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.heightRatio*fullHeight));}else{return null;}};prototype.setPaddingLeftAbsolute=function(paddingLeftAbsolute){this.paddingLeftAbsolute=paddingLeftAbsolute;this.paddingLeftRatio=null;};prototype.setPaddingRightAbsolute=function(paddingRightAbsolute){this.paddingRightAbsolute=paddingRightAbsolute;this.paddingRightRatio=null;};prototype.setPaddingTopAbsolute=function(paddingTopAbsolute){this.paddingTopAbsolute=paddingTopAbsolute;this.paddingTopRatio=null;};prototype.setPaddingBottomAbsolute=function(paddingBottomAbsolute){this.paddingBottomAbsolute=paddingBottomAbsolute;this.paddingBottomRatio=null;};prototype.setPaddingLeftRatio=function(paddingLeftRatio){this.paddingLeftAbsolute=null;this.paddingLeftRatio=paddingLeftRatio;};prototype.setPaddingRightRatio=function(paddingRightRatio){this.paddingRightAbsolute=null;this.paddingRightRatio=paddingRightRatio;};prototype.setPaddingTopRatio=function(paddingTopRatio){this.paddingTopAbsolute=null;this.paddingTopRatio=paddingTopRatio;};prototype.setPaddingBottomRatio=function(paddingBottomRatio){this.paddingBottomAbsolute=null;this.paddingBottomRatio=paddingBottomRatio;};prototype.getPaddingLeft=function(fullWidth){if(this.paddingLeftAbsolute!=null){return this.paddingLeftAbsolute;}else if(this.paddingLeftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.paddingLeftRatio*fullWidth));}else{return null;}};prototype.getPaddingTop=function(fullHeight){if(this.paddingTopAbsolute!=null){return this.paddingTopAbsolute;}else if(this.paddingTopRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.paddingTopRatio*fullHeight));}else{return null;}};prototype.getPaddingRight=function(fullWidth){if(this.paddingRightAbsolute!=null){return this.paddingRightAbsolute;}else if(this.paddingRightRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.paddingRightRatio*fullWidth));}else{return null;}};prototype.getPaddingBottom=function(fullHeight){if(this.paddingBottomAbsolute!=null){return this.paddingBottomAbsolute;}else if(this.paddingBottomRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.paddingBottomRatio*fullHeight));}else{return null;}};prototype.setMarginLeftAbsolute=function(marginLeftAbsolute){this.marginLeftAbsolute=marginLeftAbsolute;this.marginLeftRatio=null;};prototype.setMarginRightAbsolute=function(marginRightAbsolute){this.marginRightAbsolute=marginRightAbsolute;this.marginRightRatio=null;};prototype.setMarginTopAbsolute=function(marginTopAbsolute){this.marginTopAbsolute=marginTopAbsolute;this.marginTopRatio=null;};prototype.setMarginBottomAbsolute=function(marginBottomAbsolute){this.marginBottomAbsolute=marginBottomAbsolute;this.marginBottomRatio=null;};prototype.setMarginLeftRatio=function(marginLeftRatio){this.marginLeftAbsolute=null;this.marginLeftRatio=marginLeftRatio;};prototype.setMarginRightRatio=function(marginRightRatio){this.marginRightAbsolute=null;this.marginRightRatio=marginRightRatio;};prototype.setMarginTopRatio=function(marginTopRatio){this.marginTopAbsolute=null;this.marginTopRatio=marginTopRatio;};prototype.setMarginBottomRatio=function(marginBottomRatio){this.marginBottomAbsolute=null;this.marginBottomRatio=marginBottomRatio;};prototype.getMarginLeft=function(fullWidth){if(this.marginLeftAbsolute!=null){return this.marginLeftAbsolute;}else if(this.marginLeftRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.marginLeftRatio*fullWidth));}else{return null;}};prototype.getMarginTop=function(fullHeight){if(this.marginTopAbsolute!=null){return this.marginTopAbsolute;}else if(this.marginTopRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.marginTopRatio*fullHeight));}else{return null;}};prototype.getMarginRight=function(fullWidth){if(this.marginRightAbsolute!=null){return this.marginRightAbsolute;}else if(this.marginRightRatio!=null&&fullWidth!=null){return stjs.trunc(Math.round(this.marginRightRatio*fullWidth));}else{return null;}};prototype.getMarginBottom=function(fullHeight){if(this.marginBottomAbsolute!=null){return this.marginBottomAbsolute;}else if(this.marginBottomRatio!=null&&fullHeight!=null){return stjs.trunc(Math.round(this.marginBottomRatio*fullHeight));}else{return null;}};},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var AxisStyle=function(option){Style.call(this,option);};AxisStyle=stjs.extend(AxisStyle,Style,[],function(constructor,prototype){prototype.labelsHeight=0;prototype.tickWidth=0;prototype.axisTickLength=0;prototype.showAxisTicks=false;prototype.axisTicksColor=null;prototype.axisTicksColorGradientParam=null;prototype.showLabelHighlight=false;prototype.labelHighlightBold=false;prototype.labelHighlightColor=null;prototype.labelHighlightColorGradientParam=null;prototype.labelHighlightFormat=null;prototype.labelsWidth=0;prototype.getTickWidth=function(){return this.tickWidth;};prototype.setTickWidth=function(tickWidth){this.tickWidth=tickWidth;};prototype.getAxisTickLength=function(){return this.axisTickLength;};prototype.setAxisTickLength=function(axisTickLength){this.axisTickLength=axisTickLength;};prototype.isShowAxisTicks=function(){return this.showAxisTicks;};prototype.setShowAxisTicks=function(showAxisTicks){this.showAxisTicks=showAxisTicks;};prototype.getAxisTicksColor=function(){return this.axisTicksColor;};prototype.setAxisTicksColor=function(axisTicksColor){this.axisTicksColor=axisTicksColor;};prototype.getAxisTicksColorGradientParam=function(){return this.axisTicksColorGradientParam;};prototype.setAxisTicksColorGradientParam=function(axisTicksColorGradientParam){this.axisTicksColorGradientParam=axisTicksColorGradientParam;};prototype.getLabelsHeight=function(){return this.labelsHeight;};prototype.setLabelsHeight=function(labelsHeight){this.labelsHeight=labelsHeight;};prototype.isShowLabelHighlight=function(){return this.showLabelHighlight;};prototype.setShowLabelHighlight=function(showLabelHighlight){this.showLabelHighlight=showLabelHighlight;};prototype.getLabelHighlightColor=function(){return this.labelHighlightColor;};prototype.setLabelHighlightColor=function(labelHighlightColor){this.labelHighlightColor=labelHighlightColor;};prototype.getLabelHighlightColorGradientParam=function(){return this.labelHighlightColorGradientParam;};prototype.setLabelHighlightColorGradientParam=function(labelHighlightColorGradientParam){this.labelHighlightColorGradientParam=labelHighlightColorGradientParam;};prototype.getLabelHighlightFormat=function(){return this.labelHighlightFormat;};prototype.setLabelHighlightFormat=function(labelHighlightFormat){this.labelHighlightFormat=labelHighlightFormat;};prototype.isLabelHighlightBold=function(){return this.labelHighlightBold;};prototype.setLabelHighlightBold=function(labelHighlightBold){this.labelHighlightBold=labelHighlightBold;};prototype.getLabelsWidth=function(){return this.labelsWidth;};prototype.setLabelsWidth=function(labelsWidth){this.labelsWidth=labelsWidth;};},{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DrawStyle=function(option){Style.call(this,option);};DrawStyle=stjs.extend(DrawStyle,Style,[],function(constructor,prototype){constructor.ID="drawStyleId";prototype.lineStyle=null;prototype.lineWidth=0.0;prototype.lineColor=null;prototype.getLineStyle=function(){return this.lineStyle;};prototype.setLineStyle=function(lineStyle){this.lineStyle=lineStyle;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineColor=function(){return this.lineColor;};prototype.setLineColor=function(lineColor){this.lineColor=lineColor;};},{lineColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var GlobalStyle=function(option){Style.call(this,option);};GlobalStyle=stjs.extend(GlobalStyle,Style,[],function(constructor,prototype){prototype.globalFontSize=0;prototype.labelFont=null;prototype.animateChart=false;prototype.animationTime=0.0;prototype.isAnimateChart=function(){return this.animateChart;};prototype.getAnimationTime=function(){return this.animationTime;};},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var GraphStyle=function(option){Style.call(this,option);};GraphStyle=stjs.extend(GraphStyle,Style,[],function(constructor,prototype){constructor.NONE_GRID_STYLE="none";constructor.NORMAL_GRID_STYLE="normal";constructor.CLASSIC_GRID_STYLE="classic";constructor.DASHED_GRID_STYLE="dashed";constructor.HORIZONTAL_GRID_STYLE="horizontal";constructor.VERTICAL_GRID_STYLE="vertical";constructor.NO_HIGHLIGHT="none";constructor.CIRCLE_HIGHLIGHT="circle";constructor.LINES_HIGHLIGHT="lines";constructor.VERTICAL_LINE_HIGHLIGHT="vertical_line";constructor.HORIZONTAL_LINE_HIGHLIGHT="horizontal_line";constructor.INFO_HIGHLIGHT="info";constructor.COLOR_HIGHLIGHT="color";prototype.backgroundGridColor=null;prototype.backgroundGridColorGradientParams=null;prototype.backgroundGridStyle=null;prototype.backgroundGridLineWidth=0;prototype.barWidth=0;prototype.graphLineWidth=0;prototype.renderingRatio=0.0;prototype.halfSpacing=0;prototype.highlightType=null;prototype.highlightField=null;prototype.highlightLineWidth=0;prototype.highlightLineColor=null;prototype.highlightLineColorGradientParams=null;prototype.circleHighlightRadius=0;prototype.circleHighlightLineWidth=0;prototype.circleHighlightColor=null;prototype.circleHighlightColorGradientParams=null;prototype.copyrightFontSize=0;prototype.copyrightBold=false;prototype.copyrightColor=null;prototype.highlightBarMode=null;prototype.highlightBarWidth=0;prototype.highlightBarColor=null;prototype.highlightBarColorGradientParams=null;prototype.hoverBarMode=null;prototype.hoverBarWidth=0;prototype.hoverBarColor=null;prototype.hoverBarColorGradientParams=null;prototype.groupBarWidth=0;prototype.groupBarColor=null;prototype.groupBarColorGradientParams=null;prototype.areaContourColor=null;prototype.setHighlightType=function(highlightType){this.highlightType=highlightType;};prototype.getHighlightType=function(){return this.highlightType;};prototype.setRenderingRatio=function(ratio){this.renderingRatio=ratio;};prototype.getRenderingRatio=function(){return this.renderingRatio;};prototype.getBackgroundGridColor=function(){return this.backgroundGridColor;};prototype.setBackgroundGridColor=function(backgroundGridColor){this.backgroundGridColor=backgroundGridColor;};prototype.getBackgroundGridColorGradientParams=function(){return this.backgroundGridColorGradientParams;};prototype.setBackgroundGridColorGradientParams=function(backgroundGridColorGradientParams){this.backgroundGridColorGradientParams=backgroundGridColorGradientParams;};prototype.getBackgroundGridStyle=function(){return this.backgroundGridStyle;};prototype.setBackgroundGridStyle=function(backgroundGridStyle){this.backgroundGridStyle=backgroundGridStyle;};prototype.getBackgroundGridLineWidth=function(){return this.backgroundGridLineWidth;};prototype.setBackgroundGridLineWidth=function(backgroundGridLineWidth){this.backgroundGridLineWidth=backgroundGridLineWidth;};prototype.getGraphLineWidth=function(){return this.graphLineWidth;};prototype.setGraphLineWidth=function(graphLineWidth){this.graphLineWidth=graphLineWidth;};prototype.getHighlightLineWidth=function(){return this.highlightLineWidth;};prototype.setHighlightLineWidth=function(highlightLineWidth){this.highlightLineWidth=highlightLineWidth;};prototype.getHighlightLineColor=function(){return this.highlightLineColor;};prototype.setHighlightLineColor=function(highlightLineColor){this.highlightLineColor=highlightLineColor;};prototype.getHighlightLineColorGradientParams=function(){return this.highlightLineColorGradientParams;};prototype.setHighlightLineColorGradientParams=function(highlightLineColorGradientParams){this.highlightLineColorGradientParams=highlightLineColorGradientParams;};prototype.getCircleHighlightRadius=function(){return this.circleHighlightRadius;};prototype.setCircleHighlightRadius=function(circleHighlightRadius){this.circleHighlightRadius=circleHighlightRadius;};prototype.getCircleHighlightColor=function(){return this.circleHighlightColor;};prototype.setCircleHighlightColor=function(circleHighlightColor){this.circleHighlightColor=circleHighlightColor;};prototype.getCircleHighlightColorGradientParams=function(){return this.circleHighlightColorGradientParams;};prototype.setCircleHighlightColorGradientParams=function(circleHighlightColorGradientParams){this.circleHighlightColorGradientParams=circleHighlightColorGradientParams;};prototype.getCircleHighlightLineWidth=function(){return this.circleHighlightLineWidth;};prototype.setCircleHighlightLineWidth=function(circleHighlightLineWidth){this.circleHighlightLineWidth=circleHighlightLineWidth;};prototype.getBarWidth=function(){return this.barWidth;};prototype.setBarWidth=function(barWidth){this.barWidth=barWidth;};prototype.getCopyrightFontSize=function(){return this.copyrightFontSize;};prototype.setCopyrightFontSize=function(copyrightFontSize){this.copyrightFontSize=copyrightFontSize;};prototype.isCopyrightBold=function(){return this.copyrightBold;};prototype.setCopyrightBold=function(copyrightBold){this.copyrightBold=copyrightBold;};prototype.getCopyrightColor=function(){return this.copyrightColor;};prototype.setCopyrightColor=function(copyrightColor){this.copyrightColor=copyrightColor;};prototype.getHighlightBarMode=function(){return this.highlightBarMode;};prototype.setHighlightBarMode=function(highlightBarMode){this.highlightBarMode=highlightBarMode;};prototype.getHighlightBarWidth=function(){return this.highlightBarWidth;};prototype.setHighlightBarWidth=function(highlightBarWidth){this.highlightBarWidth=highlightBarWidth;};prototype.getHighlightBarColor=function(){return this.highlightBarColor;};prototype.setHighlightBarColor=function(highlightBarColor){this.highlightBarColor=highlightBarColor;};prototype.getHighlightBarColorGradientParams=function(){return this.highlightBarColorGradientParams;};prototype.setHighlightBarColorGradientParams=function(highlightBarColorGradientParams){this.highlightBarColorGradientParams=highlightBarColorGradientParams;};prototype.getHoverBarMode=function(){return this.hoverBarMode;};prototype.setHoverBarMode=function(hoverBarMode){this.hoverBarMode=hoverBarMode;};prototype.getHoverBarWidth=function(){return this.hoverBarWidth;};prototype.setHoverBarWidth=function(hoverBarWidth){this.hoverBarWidth=hoverBarWidth;};prototype.getHoverBarColor=function(){return this.hoverBarColor;};prototype.setHoverBarColor=function(hoverBarColor){this.hoverBarColor=hoverBarColor;};prototype.getHoverBarColorGradientParams=function(){return this.hoverBarColorGradientParams;};prototype.setHoverBarColorGradientParams=function(hoverBarColorGradientParams){this.hoverBarColorGradientParams=hoverBarColorGradientParams;};prototype.getHalfSpacing=function(){return this.halfSpacing;};prototype.setHalfSpacing=function(halfSpacing){this.halfSpacing=halfSpacing;};prototype.getHighlightField=function(){return this.highlightField;};prototype.setHighlightField=function(highlightField){this.highlightField=highlightField;};prototype.getGroupBarWidth=function(){return this.groupBarWidth;};prototype.setGroupBarWidth=function(groupBarWidth){this.groupBarWidth=groupBarWidth;};prototype.getGroupBarColor=function(){return this.groupBarColor;};prototype.setGroupBarColor=function(groupBarColor){this.groupBarColor=groupBarColor;};prototype.getGroupBarColorGradientParams=function(){return this.groupBarColorGradientParams;};prototype.setGroupBarColorGradientParams=function(groupBarColorGradientParams){this.groupBarColorGradientParams=groupBarColorGradientParams;};prototype.getAreaContourColor=function(){return this.areaContourColor;};prototype.setAreaContourColor=function(areaContourColor){this.areaContourColor=areaContourColor;};},{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var LegendStyle=function(option){Style.call(this,option);};LegendStyle=stjs.extend(LegendStyle,Style,[],function(constructor,prototype){prototype.columnsRelativeWidth=null;prototype.labelsHeight=0;prototype.headerBackgroundColor=null;prototype.headerBackgroundColorGradientParam=null;prototype.evenColumnsColor=null;prototype.oddColumnsColor=null;prototype.evenColumnsColorGradientParam=null;prototype.oddColumnsColorGradientParam=null;prototype.getColumnsRelativeWidth=function(){return this.columnsRelativeWidth;};prototype.setColumnsRelativeWidth=function(columnsRelativeWidth){this.columnsRelativeWidth=columnsRelativeWidth;};prototype.getLabelsHeight=function(){return this.labelsHeight;};prototype.setLabelsHeight=function(labelsHeight){this.labelsHeight=labelsHeight;};prototype.getHeaderBackgroundColor=function(){return this.headerBackgroundColor;};prototype.setHeaderBackgroundColor=function(headerBackgroundColor){this.headerBackgroundColor=headerBackgroundColor;};prototype.getHeaderBackgroundColorGradientParam=function(){return this.headerBackgroundColorGradientParam;};prototype.setHeaderBackgroundColorGradientParam=function(headerBackgroundColorGradientParam){this.headerBackgroundColorGradientParam=headerBackgroundColorGradientParam;};prototype.getEvenColumnsColor=function(){return this.evenColumnsColor;};prototype.getOddColumnsColor=function(){return this.oddColumnsColor;};prototype.getEvenColumnsColorGradientParam=function(){return this.evenColumnsColorGradientParam;};prototype.getOddColumnsColorGradientParam=function(){return this.oddColumnsColorGradientParam;};prototype.setEvenColumnsColor=function(evenColumnsColor){this.evenColumnsColor=evenColumnsColor;};prototype.setOddColumnsColor=function(oddColumnsColor){this.oddColumnsColor=oddColumnsColor;};prototype.setEvenColumnsColorGradientParam=function(evenColumnsColorGradientParam){this.evenColumnsColorGradientParam=evenColumnsColorGradientParam;};prototype.setOddColumnsColorGradientParam=function(oddColumnsColorGradientParam){this.oddColumnsColorGradientParam=oddColumnsColorGradientParam;};},{columnsRelativeWidth:{name:"Array",arguments:[null]},headerBackgroundColor:"ChartColor",headerBackgroundColorGradientParam:{name:"Array",arguments:[null]},evenColumnsColor:"ChartColor",oddColumnsColor:"ChartColor",evenColumnsColorGradientParam:{name:"Array",arguments:[null]},oddColumnsColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var TitleStyle=function(option){Style.call(this,option);};TitleStyle=stjs.extend(TitleStyle,Style,[],function(constructor,prototype){constructor.HIDE_VALUES="showNoValue";constructor.SHOW_MAIN_VALUE="showMainValue";constructor.SHOW_VALUE_VOLUME="showValueVolume";prototype.titleFontSize=0;prototype.copyrightFontSize=0;prototype.valueFontSize=0;prototype.zoomIconSize=0;prototype.titleBold=false;prototype.copyrightBold=false;prototype.valueBold=false;prototype.popoverAllowed=false;prototype.titleColor=null;prototype.copyrightColor=null;prototype.valueColor=null;prototype.type=null;prototype.iconType=null;prototype.getTitleFontSize=function(){return this.titleFontSize;};prototype.setTitleFontSize=function(titleFontSize){this.titleFontSize=titleFontSize;};prototype.getCopyrightFontSize=function(){return this.copyrightFontSize;};prototype.setCopyrightFontSize=function(copyrightFontSize){this.copyrightFontSize=copyrightFontSize;};prototype.getValueFontSize=function(){return this.valueFontSize;};prototype.setValueFontSize=function(valueFontSize){this.valueFontSize=valueFontSize;};prototype.getTitleColor=function(){return this.titleColor;};prototype.setTitleColor=function(titleColor){this.titleColor=titleColor;};prototype.getCopyrightColor=function(){return this.copyrightColor;};prototype.setCopyrightColor=function(copyrightColor){this.copyrightColor=copyrightColor;};prototype.getValueColor=function(){return this.valueColor;};prototype.setValueColor=function(valueColor){this.valueColor=valueColor;};prototype.isTitleBold=function(){return this.titleBold;};prototype.setTitleBold=function(titleBold){this.titleBold=titleBold;};prototype.isCopyrightBold=function(){return this.copyrightBold;};prototype.setCopyrightBold=function(copyrightBold){this.copyrightBold=copyrightBold;};prototype.isValueBold=function(){return this.valueBold;};prototype.setValueBold=function(valueBold){this.valueBold=valueBold;};prototype.getZoomIconSize=function(){return this.zoomIconSize;};prototype.setZoomIconSize=function(zoomIconSize){this.zoomIconSize=zoomIconSize;};prototype.isPopoverAllowed=function(){return this.popoverAllowed;};prototype.setPopoverAllowed=function(popoverAllowed){this.popoverAllowed=popoverAllowed;};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.getIconType=function(){return this.iconType;};prototype.setIconType=function(iconType){this.iconType=iconType;};},{titleColor:"ChartColor",copyrightColor:"ChartColor",valueColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var ToolTipStyle=function(){Style.call(this,null);this.valueStyle={};this.nameStyle={};};ToolTipStyle=stjs.extend(ToolTipStyle,Style,[],function(constructor,prototype){prototype.valueStyle=null;prototype.nameStyle=null;prototype.customElementStyle=function(data){};prototype.customeHeaderStyle=function(header){};prototype.getValueStyle=function(){return this.valueStyle;};prototype.setValueStyle=function(valueStyle){this.valueStyle=valueStyle;};prototype.getNameStyle=function(){return this.nameStyle;};prototype.setNameStyle=function(nameStyle){this.nameStyle=nameStyle;};},{valueStyle:{name:"Map",arguments:[null,"Object"]},nameStyle:{name:"Map",arguments:[null,"Object"]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultDrawStyle=function(option){DrawStyle.call(this,option);this.lineStyle="solid";this.lineWidth=1.0;this.lineColor=ChartColor.black;this.textColor=ChartColor.black;this.fontSize=12;};DefaultDrawStyle=stjs.extend(DefaultDrawStyle,DrawStyle,[],null,{lineColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultXAxisStyle=function(options){AxisStyle.call(this,options);this.tickWidth=0;this.axisTickLength=0;this.showAxisTicks=options.isShowXAxisTicks();this.axisTicksColor=options.getXAxisTicksColor();this.axisTicksColorGradientParam=null;this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize;this.boldFont=false;this.font=options.getLabelFont();this.visible=options.getXAxisPosition()!=Layout.Position.NONE;this.labelHighlightFormat=options.getXHighlightLabelFormat();this.labelHighlightColor=options.getLabelHighlightColor();this.showLabelHighlight=true;this.labelHighlightBold=true;this.position=options.getXAxisPosition();var paddingTop=stjs.trunc(Math.round(DefaultLayout.DEFAULT_PADDING_PIXELS/2.0));this.setPaddingTopAbsolute(paddingTop);this.setPaddingBottomAbsolute((2*DefaultLayout.DEFAULT_PADDING_PIXELS)-paddingTop);};DefaultXAxisStyle=stjs.extend(DefaultXAxisStyle,AxisStyle,[],null,{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultYAxisStyle=function(options){AxisStyle.call(this,options);this.tickWidth=1;this.axisTickLength=3;this.showAxisTicks=options.isShowYAxisTicks();this.axisTicksColor=options.getYAxisTicksColor();this.axisTicksColorGradientParam=null;this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize+2;this.boldFont=false;this.font=options.getLabelFont();this.labelHighlightColor=options.getLabelHighlightColor();this.showLabelHighlight=true;this.labelHighlightBold=true;this.position=options.getY1AxisPosition();};DefaultYAxisStyle=stjs.extend(DefaultYAxisStyle,AxisStyle,[],null,{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultGlobalStyle=function(options){GlobalStyle.call(this,options);this.animateChart=options.isAddYesterday();this.animationTime=options.getAnimationTime();this.setMarginLeftRatio(options.getChartMarginLeftPercent()/100.0);this.setMarginRightRatio(options.getChartMarginRightPercent()/100.0);this.setMarginTopRatio(options.getChartMarginTopPercent()/100.0);this.setMarginBottomRatio(options.getChartMarginBottomPercent()/100.0);};DefaultGlobalStyle=stjs.extend(DefaultGlobalStyle,GlobalStyle,[],function(constructor,prototype){prototype.DEFAULT_WIDTH=400;prototype.DEFAULT_HEIGHT=400;prototype.MINIMUM_WIDTH=100;prototype.MINIMUM_HEIGHT=100;prototype.MINIMUM_WIDTH_FOR_NORMAL_FONT=360;prototype.MINIMUM_HEIGHT_FOR_NORMAL_FONT=200;prototype.BIG_FONT_SIZE=13;prototype.NORMAL_FONT_SIZE=12;prototype.SMALL_FONT_SIZE=11;},{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultLegendStyle=function(options){LegendStyle.call(this,options);this.visible=options.isShowLegend();this.fontSize=options.getNormalLabelFontSize();this.labelsHeight=this.fontSize+DefaultLayout.DEFAULT_PADDING_PIXELS;this.boldFont=false;this.font=options.getLabelFont();this.columnsRelativeWidth=options.getColumnsRelativeWidth();this.headerBackgroundColor=ChartColor.greyBackground;this.oddColumnsColor=ChartColor.lightYellow;this.setPaddingTopAbsolute(2*DefaultLayout.DEFAULT_PADDING_PIXELS);this.setPaddingBottomAbsolute(0);this.setAbsoluteHeight(4*this.labelsHeight);};DefaultLegendStyle=stjs.extend(DefaultLegendStyle,LegendStyle,[],null,{columnsRelativeWidth:{name:"Array",arguments:[null]},headerBackgroundColor:"ChartColor",headerBackgroundColorGradientParam:{name:"Array",arguments:[null]},evenColumnsColor:"ChartColor",oddColumnsColor:"ChartColor",evenColumnsColorGradientParam:{name:"Array",arguments:[null]},oddColumnsColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultTitleStyle=function(options){TitleStyle.call(this,options);this.titleFontSize=16;this.valueFontSize=options.getBigLabelFontSize();this.copyrightFontSize=11;this.titleColor=options.getTitleColor();this.copyrightColor=ChartColor.black;this.valueColor=options.getTitleColor();this.titleBold=true;this.valueBold=true;this.copyrightBold=false;this.zoomIconSize=options.getZoomIconSize();this.popoverAllowed=options.isPopOverAllowed();this.position=Layout.Position.TOP;this.visible=options.isShowTitle()||options.isShowCopyright();this.type=options.getTitleType();if(this.type==null){this.type=TitleStyle.SHOW_MAIN_VALUE;}};DefaultTitleStyle=stjs.extend(DefaultTitleStyle,TitleStyle,[],null,{titleColor:"ChartColor",copyrightColor:"ChartColor",valueColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultToolTipStyle=function(options){ToolTipStyle.call(this);this.style["fontColor"]=ChartColor.black;this.nameStyle["fontStyle"]="bold";this.backgroundColor=ChartColor.white;};DefaultToolTipStyle=stjs.extend(DefaultToolTipStyle,ToolTipStyle,[],function(constructor,prototype){prototype.customElementStyle=function(data){};prototype.customeHeaderStyle=function(header){};},{valueStyle:{name:"Map",arguments:[null,"Object"]},nameStyle:{name:"Map",arguments:[null,"Object"]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultGraphStyle=function(options){GraphStyle.call(this,options);this.backgroundGridColor=options.getGridColor();this.backgroundGridColorGradientParams=options.getGridColorGradientParams();this.backgroundGridStyle=options.getGridStyle();if(this.backgroundGridColor==null){this.backgroundGridColor=ChartColor.grey;}
if(this.backgroundGridStyle==null){this.backgroundGridStyle=GraphStyle.CLASSIC_GRID_STYLE;}
this.areaContourColor=options.getAreaContourColor();this.barWidth=2;this.backgroundGridLineWidth=1;this.graphLineWidth=1;this.renderingRatio=1.0;this.highlightType=options.getHighlightType();if(this.highlightType==null){this.highlightType=GraphStyle.LINES_HIGHLIGHT+GraphStyle.COLOR_HIGHLIGHT;}
this.highlightLineWidth=1;this.highlightLineColor=ChartColor.black;this.copyrightFontSize=11;this.copyrightColor=ChartColor.black;this.copyrightBold=false;this.fontSize=options.getNormalLabelFontSize();this.boldFont=false;this.font=options.getLabelFont();this.setPaddingLeftRatio(options.getChartPaddingLeftPercent()/100.0);this.setPaddingRightRatio(options.getChartPaddingRightPercent()/100.0);this.setPaddingTopRatio(options.getChartPaddingTopPercent()/100.0);this.setPaddingBottomRatio(options.getChartPaddingBottomPercent()/100.0);this.borderLeft=options.getChartBorderLeft();this.borderRight=options.getChartBorderRight();this.borderTop=options.getChartBorderTop();this.borderBottom=options.getChartBorderBottom();};DefaultGraphStyle=stjs.extend(DefaultGraphStyle,GraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultAreaGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;};DefaultAreaGraphStyle=stjs.extend(DefaultAreaGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultBarGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.barWidth=2;this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;this.highlightBarWidth=4;this.highlightBarColor=ChartColor.orange;this.highlightBarMode=sq.ChartElement.HIGHLIGHT.COLOR_FISH_EYE;this.hoverBarWidth=4;this.hoverBarColor=ChartColor.orange;this.hoverBarMode=sq.ChartElement.HOVER.COLOR_FISH_EYE;this.groupBarWidth=6;this.groupBarColor=ChartColor.orange;};DefaultBarGraphStyle=stjs.extend(DefaultBarGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultLineGraphStyle=function(options){DefaultGraphStyle.call(this,options);this.circleHighlightRadius=6;this.circleHighlightLineWidth=2;this.circleHighlightColor=ChartColor.orange;};DefaultLineGraphStyle=stjs.extend(DefaultLineGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultPointGraphStyle=function(options){DefaultGraphStyle.call(this,options);};DefaultPointGraphStyle=stjs.extend(DefaultPointGraphStyle,DefaultGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var Point2D=function(x,y){this.x=x;this.y=y;};Point2D=stjs.extend(Point2D,null,[],function(constructor,prototype){prototype.x=null;prototype.y=null;prototype.distanceTo=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return Math.sqrt(diffX*diffX+diffY*diffY);}else{return Double.POSITIVE_INFINITY;}};prototype.distanceSquared=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return diffX*diffX+diffY*diffY;}else{return Double.POSITIVE_INFINITY;}};prototype.midpointWith=function(p2){if(p2==null){return new Point2D(this.x,this.y);}else{var midX=stjs.trunc(Math.round((this.x+p2.x)/2.0));var midY=stjs.trunc(Math.round((this.y+p2.y)/2.0));return new Point2D(midX,midY);}};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.getClone=function(){return new Point2D(this.x,this.y);};prototype.minus=function(p){return new Vector2D(this.x-p.x,this.y-p.y);};prototype.add=function(vector){if(vector!=null){return new Point2D(stjs.trunc(Math.round(this.x+vector.x)),stjs.trunc(Math.round(this.y+vector.y)));}else{return null;}};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Point2D))){return false;}
var other=obj;return other.x==this.x&&other.y==this.y;};constructor.isPointBetween=function(pointInbetween,p1,p2){if(pointInbetween==null||p1==null||p2==null){return false;}
var xIsBetween=(pointInbetween.x>=p1.x&&pointInbetween.x<=p2.x)||(pointInbetween.x<=p1.x&&pointInbetween.x>=p2.x);var yIsBetween=(pointInbetween.y>=p1.y&&pointInbetween.y<=p2.y)||(pointInbetween.y<=p1.y&&pointInbetween.y>=p2.y);return xIsBetween&&yIsBetween;};constructor.distanceSquaredP1P2=function(p1X,p1Y,p2X,p2Y){var diffX=p1X-p2X;var diffY=p1Y-p2Y;return diffX*diffX+diffY*diffY;};},{},{});
var Point2Df=function(x,y){this.x=x;this.y=y;};Point2Df=stjs.extend(Point2Df,null,[],function(constructor,prototype){prototype.x=0.0;prototype.y=0.0;prototype.distanceTo=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return Math.sqrt(diffX*diffX+diffY*diffY);}else{return Double.POSITIVE_INFINITY;}};prototype.distanceSquared=function(p2){if(p2!=null){var diffX=this.x-p2.x;var diffY=this.y-p2.y;return diffX*diffX+diffY*diffY;}else{return Double.POSITIVE_INFINITY;}};prototype.midpointWith=function(p2){if(p2==null){return new Point2Df(this.x,this.y);}else{var midX=stjs.trunc(Math.round((this.x+p2.x)/2.0));var midY=stjs.trunc(Math.round((this.y+p2.y)/2.0));return new Point2Df(midX,midY);}};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.getClone=function(){return new Point2Df(this.x,this.y);};prototype.minus=function(p){return new Vector2D(this.x-p.x,this.y-p.y);};prototype.add=function(vector){if(vector!=null){return new Point2Df(Math.round(this.x+vector.x),Math.round(this.y+vector.y));}else{return null;}};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Point2Df))){return false;}
var other=obj;return other.x==this.x&&other.y==this.y;};constructor.isPointBetween=function(pointInbetween,p1,p2){if(pointInbetween==null||p1==null||p2==null){return false;}
var xIsBetween=(pointInbetween.x>=p1.x&&pointInbetween.x<=p2.x)||(pointInbetween.x<=p1.x&&pointInbetween.x>=p2.x);var yIsBetween=(pointInbetween.y>=p1.y&&pointInbetween.y<=p2.y)||(pointInbetween.y<=p1.y&&pointInbetween.y>=p2.y);return xIsBetween&&yIsBetween;};},{},{});
var Vector2D=function(x,y){this.x=x;this.y=y;};Vector2D=stjs.extend(Vector2D,null,[],function(constructor,prototype){prototype.x=null;prototype.y=null;prototype.scalarMultiplication=function(scalar){return new Vector2D(this.x*scalar,this.y*scalar);};prototype.add=function(toAdd){if(toAdd!=null){return new Vector2D(this.x+toAdd.x,this.y+toAdd.y);}else{return null;}};prototype.dot=function(otherVector){if(otherVector!=null){return(this.x*otherVector.x)+(this.y*otherVector.y);}else{return null;}};prototype.normalize=function(){var currentLength=this.length();if(currentLength!=null){return new Vector2D(this.x/currentLength,this.y/currentLength);}else{return null;}};prototype.getOppositeVector=function(){return this.scalarMultiplication(-1.0);};prototype.minus=function(otherVector){if(otherVector!=null){return new Vector2D(this.x-otherVector.x,this.y-otherVector.y);}else{return null;}};prototype.length=function(){var factor=this.dot(this);if(factor!=null&&factor>0){return Math.sqrt(factor);}else{return null;}};prototype.magnitude=function(){return this.length();};prototype.equals=function(obj){if(obj==null||!(stjs.isInstanceOf(obj.constructor,Vector2D))){return false;}
var other=obj;return this.x==other.x&&this.y==other.y;};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};prototype.inverse=function(){return new Vector2D(-this.x,-this.y);};},{},{});
var Line2D=function(p1,p2){this.p1=p1.getClone();this.p2=p2.getClone();if(p1!=null&&p2!=null){this.n=p2.minus(p1).normalize();}};Line2D=stjs.extend(Line2D,null,[],function(constructor,prototype){prototype.p1=null;prototype.p2=null;prototype.n=null;prototype.dist=function(p){if(this.p1!=null&&this.p2!=null&&this.n!=null&&p!=null){return this.p1.minus(p).minus(this.n.scalarMultiplication(this.p1.minus(p).dot(this.n))).length();}else{return null;}};prototype.distFromSegment=function(p){if(this.p1!=null&&this.p2!=null&&p!=null){var segmentLengthSquared=this.p1.distanceSquared(this.p2);if(segmentLengthSquared==0){return p.distanceTo(this.p1);}
var t=((p.getX()-this.p1.getX())*(this.p2.getX()-this.p1.getX())+(p.getY()-this.p1.getY())*(this.p2.getY()-this.p1.getY()))/segmentLengthSquared;if(t<0){return p.distanceTo(this.p1);}
if(t>1){return p.distanceTo(this.p2);}
return this.dist(p);}else{return null;}};prototype.isOnLine=function(p1){return this.dist(p1)==0;};prototype.getIntersectionPoint=function(otherLine){if(otherLine==null||this.isParallel(otherLine)||this.n==null||otherLine.n==null){return null;}else{if(this.n.x!=0){var denominator=(this.n.x*otherLine.n.y)-(this.n.y*otherLine.n.x);var tmp1=(this.n.x*this.p1.y)+(this.n.y*otherLine.p1.x);var tmp2=(this.n.y*this.p1.x)+(this.n.x*otherLine.p1.y);var b=(tmp1-tmp2)/denominator;return otherLine.p1.add(otherLine.n.scalarMultiplication(b));}else{return otherLine.getIntersectionPoint(this);}}};prototype.isParallel=function(otherLine){if(otherLine!=null&&this.n!=null&&otherLine.n!=null){return this.n.equals(otherLine.n)||this.n.inverse().equals(otherLine.n);}else{return false;}};prototype.getP1=function(){return this.p1;};prototype.setP1=function(p1){this.p1=p1;};prototype.getP2=function(){return this.p2;};prototype.setP2=function(p2){this.p2=p2;};prototype.length=function(p2){this.p2=p2;};},{p1:"Point2D",p2:"Point2D",n:"Vector2D"},{});
var ArrayUtil=function(){};ArrayUtil=stjs.extend(ArrayUtil,null,[],function(constructor,prototype){constructor.SPECIAL_CHARACTERS="<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";constructor.TOLERANCE_PERCENT=1.0E-6;constructor.isSameArray=function(array1,array2){if(array1==null&&array2==null){return true;}else if(array1==null||array2==null||array1.length!=array2.length){return false;}else{var elementCount=array1.length;for(var i=0;i<elementCount;i++){if(array1[i]!=array2[i]){return false;}}
return true;}};constructor.isSimilarArray=function(array1,array2){var sameArray=ArrayUtil.isSameArray(array1,array2);if(sameArray){return true;}
var elementCount=array1.length;for(var i=0;i<elementCount;i++){var differencePercent=100*Math.abs(array1[i]-array2[i])/array1[i];if(differencePercent>ArrayUtil.TOLERANCE_PERCENT){return false;}}
return true;};constructor.containsSameObject=function(array,object){if(array==null||object==null||array.length<=0){return false;}else{var elementCount=array.length;for(var i=0;i<elementCount;i++){if(object.equals(array[i])){return true;}}
return false;}};constructor.getRangeSpan=function(range){if(!ArrayUtil.isValidRange(range)){return 0.0;}else{return Math.abs(range[1]-range[0]);}};constructor.isValidRange=function(range){if(range==null||range.length!=2||range[0]==null||range[1]==null||isNaN(range[0])||isNaN(range[1])){return false;}else{return true;}};constructor.sortFunction=function(a,b){if(a==null||b==null){return-1;}
if(ArrayUtil.startInSameCase(a,b)||ArrayUtil.startsWithSpecialCharacterOrNumber(a)&&ArrayUtil.startsWithSpecialCharacterOrNumber(b)){return ArrayUtil.naturalSortFunction(a,b);}else if(ArrayUtil.startsWithUppercase(a)){return-1;}else if(ArrayUtil.startsWithSpecialCharacterOrNumber(a)){return 1;}else if(ArrayUtil.startsWithSpecialCharacterOrNumber(b)){return-1;}
return 1;};constructor.naturalSortFunction=function(a,b){if(a>b){return 1;}
if(a<b){return-1;}
return 0;};constructor.startsWithUppercase=function(str){if(str!=null&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str)){return str.charAt(0)==str.charAt(0).toUpperCase();}else{return false;}};constructor.startInSameCase=function(str1,str2){if(str1!=null&&str2!=null&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str1)&&!ArrayUtil.startsWithSpecialCharacterOrNumber(str2)){return ArrayUtil.startsWithUppercase(str1)==ArrayUtil.startsWithUppercase(str2);}else{return false;}};constructor.startsWithSpecialCharacterOrNumber=function(str){if(str!=null){return ArrayUtil.SPECIAL_CHARACTERS.indexOf(str.charAt(0))>-1||str.charAt(0)>=0&&str.charAt(0)<=9;}else{return false;}};constructor.aplhabeticalArraySort=function(array){if(array!=null){array.sort(ArrayUtil.sortFunction);}};},{sortFunction:{name:"SortFunction",arguments:[null]}},{});
var ChartMessagesRepository=function(){this.messages={};this.messages["noPrice"]=ChartMessagesRepository.DEFAULT_NO_DATA_MESSAGE;this.messages["noIntradayPrice"]=ChartMessagesRepository.DEFAULT_NO_DATA_MESSAGE;this.messages["compareWith"]="Compare with";this.messages["definePeriod"]="Define a period";this.messages["title"]="Title";this.messages["from"]="from";this.messages["to"]="to";this.messages["draw"]="Draw";this.messages["intraday"]="Intraday";this.messages["1week"]="One week";this.messages["1month"]="One month";this.messages["6months"]="Six months";this.messages["1year"]="One year";this.messages["maximum"]="Maximum";this.messages["noStock"]="- no stock -";this.messages["periodHigh"]="Period high";this.messages["periodLow"]="Period low";this.messages["periodChange"]="Change (%)";this.messages["YTDShort"]="YTD";this.messages["YTD"]="Year-to-date";this.messages["lang"]="en";this.messages["lang_short"]="e";};ChartMessagesRepository=stjs.extend(ChartMessagesRepository,null,[],function(constructor,prototype){constructor.instance=null;prototype.messages=null;constructor.DEFAULT_NO_DATA_MESSAGE="No data found for this security";constructor.getInstance=function(){if(ChartMessagesRepository.instance==null){ChartMessagesRepository.instance=new ChartMessagesRepository();}
return ChartMessagesRepository.instance;};prototype.set=function(id,message){this.messages[id]=message;};prototype.get=function(id){return this.messages[id];};},{instance:"ChartMessagesRepository",messages:{name:"Map",arguments:[null,null]}},{});
var MathUtil=function(){};MathUtil=stjs.extend(MathUtil,null,[],function(constructor,prototype){constructor.EPSILON=1.0E-8;constructor.isPointInsideTriangle=function(point,p1,p2,p3){if(point==null||p1==null||p2==null||p3==null){return false;}
var b1=MathUtil.sign(point,p1,p2)<0;var b2=MathUtil.sign(point,p2,p3)<0;var b3=MathUtil.sign(point,p3,p1)<0;return((b1==b2)&&(b2==b3));};constructor.isPointInsideQuadri=function(point,p1,p2,p3,p4){if(point==null||p1==null||p2==null||p3==null||p4==null){return false;}
var b1=MathUtil.sign(point,p1,p2)<0;var b2=MathUtil.sign(point,p2,p3)<0;var b3=MathUtil.sign(point,p3,p4)<0;var b4=MathUtil.sign(point,p4,p1)<0;return((b1==b2)&&(b2==b3)&&(b3==b4));};constructor.sign=function(point,p1,p2){return(point.getX()-p1.getX())*(p2.getY()-p1.getY())-(p2.getX()-p1.getX())*(point.getY()-p1.getY());};constructor.setInsideComputationValues=function(points,constants,multiples){if(points==null||constants==null||multiples==null){return;}
var pointsCount=points.length;var pj=points[pointsCount-1];if(pj==null){return;}
for(var i=0;i<pointsCount;i++){var pi=points[i];if(pi==null){return;}
var denominator=pj.getY()-pi.getY();if(denominator==0){constants[i]=pi.getX();multiples[i]=0.0;}else{constants[i]=pi.getX()-(pi.getY()*pj.getX())/denominator+(pi.getY()*pi.getX())/denominator;multiples[i]=(pj.getX()-pi.getX())/denominator;}
pj=pi;}};constructor.isPointInPolygon=function(point,points){if(point==null||points==null){return false;}
var constants=[];var multiples=[];MathUtil.setInsideComputationValues(points,constants,multiples);if(constants==null||multiples==null||points.length!=constants.length||points.length!=multiples.length){return false;}
var pointsCount=points.length;var pj=points[pointsCount-1];var oddNodes=false;var x=point.getX();var y=point.getY();if(pj==null){return false;}
for(var i=0;i<pointsCount;i++){var pi=points[i];if(pi==null){return false;}
if(pi.getY()<y&&pj.getY()>=y||pj.getY()<y&&pi.getY()>=y){var tmp=(y*multiples[i]+constants[i]<x);oddNodes=oddNodes?!tmp:tmp;}
pj=pi;}
return oddNodes;};},{},{});
var StringUtil=function(){};StringUtil=stjs.extend(StringUtil,null,[],function(constructor,prototype){constructor.getCopyright=function(){return(String).fromCharCode(169)+" Swissquote";};},{},{});
var XMLUtil=function(){};XMLUtil=stjs.extend(XMLUtil,null,[],function(constructor,prototype){constructor.getValue=function(node,valueKey){if(node!=null&&valueKey!=null&&node.childNodes!=null){var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=node.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode.textContent;}}}
return null;};constructor.getChildNodes=function(node,valueKey){if(node!=null&&valueKey!=null&&node.childNodes!=null){var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=node.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode.childNodes;}}}
return null;};constructor.getNode=function(parentNode,valueKey){if(parentNode!=null&&valueKey!=null&&parentNode.childNodes!=null){var childCount=parentNode.childNodes.length;for(var i=0;i<childCount;i++){var currentNode=parentNode.childNodes[i];if(currentNode!=null&&currentNode.nodeName==valueKey){return currentNode;}}}
return null;};constructor.serializeXmlNode=function(xmlNode){if(typeof window.XMLSerializer!='undefined'){return(new window.XMLSerializer()).serializeToString(xmlNode);}else if(typeof xmlNode.xml!='undefined'){return xmlNode.xml;};return"";};constructor.getStringFromArray=function(name,list){var values="";for(var index in list){if(!(list).hasOwnProperty(index))
continue;var value=list[index];if(value!=null){values+=XMLUtil.createNodeString("item",String.valueOf(value));}else{values+="<item/>";}}
return XMLUtil.createNodeString(name,values);};constructor.createNodeString=function(nodeName,textContent){return"<"+nodeName+">"+textContent+"</"+nodeName+">";};},{},{});
var ChartColor=function(colorType,colorValues,colorStop){this.colorType=colorType;this.colorValues=colorValues;this.colorStop=colorStop;};ChartColor=stjs.extend(ChartColor,null,[],function(constructor,prototype){constructor.ColorType=stjs.enumeration("SIMPLE","LINEAR_GRADIENT","RADIAL_GRADIENT");constructor.transparent=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,0,0)"],null);constructor.black=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,0,1)"],null);constructor.lightOrange=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,190,160,1)"],null);constructor.lightOrangeTransparent=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,190,160,0.35)"],null);constructor.salmon=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 204, 153,1)"],null);constructor.lightYellow=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 204,1)"],null);constructor.brown=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 102, 51,1)"],null);constructor.kaki=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(140, 190, 40,1)"],null);constructor.lightRed=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(240, 216, 223,1)"],null);constructor.lightGreen=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(200, 240, 212,1)"],null);constructor.lightBlue=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(210, 220, 247,1)"],null);constructor.lightBlue2=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(56, 142, 240,1)"],null);constructor.red=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(235, 29, 37, 1)"],null);constructor.green=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 220, 0, 1)"],null);constructor.orange=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(253, 103, 50, 1)"],null);constructor.blue=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(30, 30, 230,1)"],null);constructor.white=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 255, 1)"],null);constructor.cyan=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 255, 255, 1)"],null);constructor.yellow=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 255, 0, 1)"],null);constructor.redOld=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(230, 30, 30, 1)"],null);constructor.greenOld=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(30, 180, 30, 1)"],null);constructor.lightGrey=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(247, 247, 247, 1)"],null);constructor.lightGrey2=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(192, 192, 192, 1)"],null);constructor.darkGrey=new ChartColor(ChartColor.ColorType.SIMPLE,["#898989"],null);constructor.grey=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(217, 217, 217, 1)"],null);constructor.greyBackground=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(222, 222, 222, 1)"],null);constructor.redGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(235, 29, 37, 1)","rgba(252, 225, 225, 0.4)"],[1.0,0.0]);constructor.greenGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 220, 0, 1)","rgba(235, 243, 222, 0.4)"],[1.0,0.0]);constructor.blueGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 220, 0, 1)","rgba(235, 243, 222, 0.4)"],[1.0,0.0]);constructor.orangeGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(235, 29, 37, 1)","rgba(252, 225, 225, 0.4)"],[1.0,0.0]);constructor.blackGradient=new ChartColor(ChartColor.ColorType.LINEAR_GRADIENT,["rgba(0, 0, 0, 1)","rgba(0, 0, 0, 0.4)"],[1.0,0.0]);constructor.LINE_SELECTED=ChartColor.blue;constructor.BG_UP=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(153, 255, 153,1)"],null);constructor.BG_DOWN=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 153, 153,1)"],null);constructor.GREEN_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,153,0,1)"],null);constructor.BLUE_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0,0,255,1)"],null);constructor.RED_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255,0,0,1)"],null);constructor.GRAY_MAV=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(128,128,128,1)"],null);constructor.PURPLE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(153, 51, 153,1)"],null);constructor.DARK_BLUE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(51, 102, 153,1)"],null);constructor.LIGHT_ORANGE=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 120, 35,1)"],null);constructor.RED_MACD=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 0, 0,1)"],null);constructor.MOMENTUM_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 102, 102,1)"],null);constructor.OBV_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 51, 0,1)"],null);constructor.RSI_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(204, 0, 204,1)"],null);constructor.STO_COLOR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 153, 153,1)"],null);constructor.RED_FULL=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(255, 0, 0, 1)"],null);constructor.BLUE_SAR=new ChartColor(ChartColor.ColorType.SIMPLE,["rgba(0, 0, 204, 1)"],null);prototype.colorType=null;prototype.colorValues=null;prototype.colorStop=null;prototype.applyColor=function(context,gradientParams){this.applyColorToFillStyle(context,gradientParams);this.applyColorToStrokeStyle(context,gradientParams);};prototype.applyColorToFillStyle=function(context,gradientParams){if(this.colorType==ChartColor.ColorType.SIMPLE||gradientParams==null||gradientParams.length!=4){context.fillStyle=this.getFlatColor();}else if(this.colorType==ChartColor.ColorType.LINEAR_GRADIENT){var gradient=this.getLinearGradient(context,gradientParams);context.fillStyle=gradient;}else{var gradient=this.getRadialGradient(context,gradientParams);context.fillStyle=gradient;}};prototype.applyColorToStrokeStyle=function(context,gradientParams){if(this.colorType==ChartColor.ColorType.SIMPLE||gradientParams==null||gradientParams.length!=4){context.strokeStyle=this.getFlatColor();}else if(this.colorType==ChartColor.ColorType.LINEAR_GRADIENT){var gradient=this.getLinearGradient(context,gradientParams);context.strokeStyle=gradient;}else{var gradient=this.getRadialGradient(context,gradientParams);context.strokeStyle=gradient;}};prototype.getFlatColor=function(){return(this.colorValues!=null)?this.colorValues[0]:"black";};prototype.getLinearGradient=function(context,gradientParams){var gradient=context.createLinearGradient(gradientParams[0],gradientParams[1],gradientParams[2],gradientParams[3]);var stopCount=this.colorValues.length;for(var i=0;i<stopCount;i++){gradient.addColorStop(this.colorStop[i],this.colorValues[i]);}
return gradient;};prototype.getRadialGradient=function(context,gradientParams){var gradient=context.createRadialGradient(gradientParams[0],gradientParams[1],gradientParams[2],gradientParams[3],gradientParams[4],gradientParams[5]);var stopCount=this.colorValues.length;for(var i=0;i<stopCount;i++){gradient.addColorStop(this.colorStop[i],this.colorValues[i]);}
return gradient;};constructor.getColor=function(color){return new ChartColor(ChartColor.ColorType.SIMPLE,[color],null);};constructor.color2ChartColor=function(color){return new ChartColor(ChartColor.ColorType.SIMPLE,[color.getColor()],null);};prototype.toHex=function(){if(this.colorValues!=null&&this.colorValues[0]!=null){return new Color(this.colorValues[0]).getColor();}else{return null;}};prototype.isTransparent=function(){return new Color(this.colorValues[0]).getAlpha()==0;};prototype.getChartColorWithAlpha=function(alpha){var hexColor=this.toHex();hexColor=hexColor.replace("#","");var rgbaColorWithOpacity="rgba("+parseInt(hexColor.substring(0,2),16)+","+parseInt(hexColor.substring(2,4),16)+","+parseInt(hexColor.substring(4,6),16)+","+alpha+")";return new ChartColor(this.colorType,[rgbaColorWithOpacity],this.colorStop);};},{transparent:"ChartColor",black:"ChartColor",lightOrange:"ChartColor",lightOrangeTransparent:"ChartColor",salmon:"ChartColor",lightYellow:"ChartColor",brown:"ChartColor",kaki:"ChartColor",lightRed:"ChartColor",lightGreen:"ChartColor",lightBlue:"ChartColor",lightBlue2:"ChartColor",red:"ChartColor",green:"ChartColor",orange:"ChartColor",blue:"ChartColor",white:"ChartColor",cyan:"ChartColor",yellow:"ChartColor",redOld:"ChartColor",greenOld:"ChartColor",lightGrey:"ChartColor",lightGrey2:"ChartColor",darkGrey:"ChartColor",grey:"ChartColor",greyBackground:"ChartColor",redGradient:"ChartColor",greenGradient:"ChartColor",blueGradient:"ChartColor",orangeGradient:"ChartColor",blackGradient:"ChartColor",LINE_SELECTED:"ChartColor",BG_UP:"ChartColor",BG_DOWN:"ChartColor",GREEN_MAV:"ChartColor",BLUE_MAV:"ChartColor",RED_MAV:"ChartColor",GRAY_MAV:"ChartColor",PURPLE:"ChartColor",DARK_BLUE:"ChartColor",LIGHT_ORANGE:"ChartColor",RED_MACD:"ChartColor",MOMENTUM_COLOR:"ChartColor",OBV_COLOR:"ChartColor",RSI_COLOR:"ChartColor",STO_COLOR:"ChartColor",RED_FULL:"ChartColor",BLUE_SAR:"ChartColor",colorType:{name:"Enum",arguments:["ChartColor.ColorType"]},colorValues:{name:"Array",arguments:[null]},colorStop:{name:"Array",arguments:[null]}},{});
var Color=function(val){this.val=val;this.parse();};Color=stjs.extend(Color,null,[],function(constructor,prototype){constructor.TRANSPARENT="transparent";constructor.names={"aliceblue":"F0F8FF","antiquewhite":"FAEBD7","aqua":"0FF","aquamarine":"7FFFD4","azure":"F0FFFF","beige":"F5F5DC","bisque":"FFE4C4","black":"000","blanchedalmond":"FFEBCD","blue":"00F","blueviolet":"8A2BE2","brown":"A52A2A","burlywood":"DEB887","cadetblue":"5F9EA0","chartreuse":"7FFF00","chocolate":"D2691E","coral":"FF7F50","cornflowerblue":"6495ED","cornsilk":"FFF8DC","crimson":"DC143C","cyan":"0FF","darkblue":"00008B","darkcyan":"008B8B","darkgoldenrod":"B8860B","darkgray":"A9A9A9","darkgreen":"006400","darkkhaki":"BDB76B","darkmagenta":"8B008B","darkolivegreen":"556B2F","darkorange":"FF8C00","darkorchid":"9932CC","darkred":"8B0000","darksalmon":"E9967A","darkseagreen":"8FBC8F","darkslateblue":"483D8B","darkslategray":"2F4F4F","darkturquoise":"00CED1","darkviolet":"9400D3","deeppink":"FF1493","deepskyblue":"00BFFF","dimgray":"696969","dodgerblue":"1E90FF","firebrick":"B22222","floralwhite":"FFFAF0","forestgreen":"228B22","fuchsia":"F0F","gainsboro":"DCDCDC","ghostwhite":"F8F8FF","gold":"FFD700","goldenrod":"DAA520","gray":"808080","green":"008000","greenyellow":"ADFF2F","honeydew":"F0FFF0","hotpink":"FF69B4","indianred":"CD5C5C","indigo":"4B0082","ivory":"FFFFF0","khaki":"F0E68C","lavender":"E6E6FA","lavenderblush":"FFF0F5","lawngreen":"7CFC00","lemonchiffon":"FFFACD","lightblue":"ADD8E6","lightcoral":"F08080","lightcyan":"E0FFFF","lightgoldenrodyellow":"FAFAD2","lightgreen":"90EE90","lightgrey":"D3D3D3","lightpink":"FFB6C1","lightsalmon":"FFA07A","lightseagreen":"20B2AA","lightskyblue":"87CEFA","lightslategray":"789","lightsteelblue":"B0C4DE","lightyellow":"FFFFE0","lime":"0F0","limegreen":"32CD32","linen":"FAF0E6","magenta":"F0F","maroon":"800000","mediumauqamarine":"66CDAA","mediumblue":"0000CD","mediumorchid":"BA55D3","mediumpurple":"9370D8","mediumseagreen":"3CB371","mediumslateblue":"7B68EE","mediumspringgreen":"00FA9A","mediumturquoise":"48D1CC","mediumvioletred":"C71585","midnightblue":"191970","mintcream":"F5FFFA","mistyrose":"FFE4E1","moccasin":"FFE4B5","navajowhite":"FFDEAD","navy":"000080","oldlace":"FDF5E6","olive":"808000","olivedrab":"688E23","orange":"FFA500","orangered":"FF4500","orchid":"DA70D6","palegoldenrod":"EEE8AA","palegreen":"98FB98","paleturquoise":"AFEEEE","palevioletred":"D87093","papayawhip":"FFEFD5","peachpuff":"FFDAB9","peru":"CD853F","pink":"FFC0CB","plum":"DDA0DD","powderblue":"B0E0E6","purple":"800080","red":"F00","rosybrown":"BC8F8F","royalblue":"4169E1","saddlebrown":"8B4513","salmon":"FA8072","sandybrown":"F4A460","seagreen":"2E8B57","seashell":"FFF5EE","sienna":"A0522D","silver":"C0C0C0","skyblue":"87CEEB","slateblue":"6A5ACD","slategray":"708090","snow":"FFFAFA","springgreen":"00FF7F","steelblue":"4682B4","tan":"D2B48C","teal":"008080","thistle":"D8BFD8","tomato":"FF6347","turquoise":"40E0D0","violet":"EE82EE","wheat":"F5DEB3","white":"FFF","whitesmoke":"F5F5F5","yellow":"FF0","yellowgreen":"9ACD32"};prototype.val=null;prototype.color=null;prototype.alpha=1.0;prototype.rgbaRegExp="\\s*rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d+|\\d*\\.\\d+)\\s*\\)\\s*";prototype.parse=function(){if(this.val==null||this.val.length==0){return;}
var rgbaRE=new RegExp(this.rgbaRegExp);if(rgbaRE.test(this.val)){var m=rgbaRE.exec(this.val);this.alpha=parseFloat(m[4]);this.color=this.alpha==0?Color.TRANSPARENT:this.rgbToHex(m[1],m[2],m[3]);}else{var vLower=this.val.toLowerCase();var v=Color.names[vLower];if(v!=null&&v.length>0){this.color="#"+v;this.alpha=(Color.TRANSPARENT.equals(v)?0.0:1.0);}else{this.color=this.val;}}};prototype.rgbToHex=function(r,g,b){return"#"+this.componentToHex(r)+this.componentToHex(g)+this.componentToHex(b);};prototype.componentToHex=function(c){var res=parseInt(c);var hex=(res).toString(16);return hex.length==1?"0"+hex:hex;};prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getAlpha=function(){return this.alpha;};prototype.setAlpha=function(alpha){this.alpha=alpha;};constructor.isSameColorPoint=function(color1,color2){var res=false;if(color2==null){if(color1==null){res=true;}}else{var c=new Color(color2).getColor();if(c!=null){res=c.equals(color1);}}
return res;};},{names:{name:"Map",arguments:[null,null]}},{});
var Frequency=function(type,value,name){this.type=type;this.value=value;this.name=name;this.intraday=Frequency.isTypeIntraday(type);if(Frequency.instances==null){Frequency.instances={};}
name=name!=null?name.toLowerCase():null;Frequency.instances[name]=this;};Frequency=stjs.extend(Frequency,null,[],function(constructor,prototype){constructor.Type=stjs.enumeration("LIVE","SECOND","MINUTE","HOUR","DAY","WEEK","MONTH","YEAR");constructor.isTypeIntraday=function(type){switch(type){case Frequency.Type.LIVE:case Frequency.Type.SECOND:case Frequency.Type.MINUTE:case Frequency.Type.HOUR:return true;case Frequency.Type.DAY:case Frequency.Type.WEEK:case Frequency.Type.MONTH:case Frequency.Type.YEAR:default:return false;}};constructor.typeToString=function(type){return type.toString().toLowerCase();};constructor.getTypeInString=function(str){if(str==null){return null;}
str=str.toLowerCase();var typeArray=(Frequency.Type.values());var typeCount=typeArray.length;for(var i=0;i<typeCount;i++){if(str.indexOf(typeArray[i].toString().toLowerCase())!=-1){return typeArray[i];}}
return null;};constructor.instances=null;constructor.DAY=new Frequency(Frequency.Type.DAY,1,"daily");constructor.WEEK=new Frequency(Frequency.Type.WEEK,1,"weekly");constructor.MONTH=new Frequency(Frequency.Type.MONTH,1,"monthly");constructor.QUARTER=new Frequency(Frequency.Type.MONTH,3,"quarterly");constructor.SEMESTER=new Frequency(Frequency.Type.MONTH,6,"semesterly");constructor.YEAR=new Frequency(Frequency.Type.YEAR,1,"yearly");constructor.HOUR=new Frequency(Frequency.Type.HOUR,1,"60minute");constructor.TWO_HOUR=new Frequency(Frequency.Type.HOUR,2,"120minute");constructor.MINUTE=new Frequency(Frequency.Type.MINUTE,1,"1minute");constructor.FIVE_MINUTE=new Frequency(Frequency.Type.MINUTE,5,"5minute");constructor.FIFTEEN_MINUTE=new Frequency(Frequency.Type.MINUTE,15,"15minute");constructor.SECOND=new Frequency(Frequency.Type.SECOND,1,"second");constructor.FIVE_SECOND=new Frequency(Frequency.Type.SECOND,5,"5second");constructor.FIFTEEN_SECOND=new Frequency(Frequency.Type.SECOND,15,"15second");constructor.THIRTY_SECOND=new Frequency(Frequency.Type.SECOND,30,"30second");constructor.LIVE=new Frequency(Frequency.Type.LIVE,-1,"live");constructor.ALL=new Frequency(Frequency.Type.LIVE,-1,"all");prototype.type=null;prototype.value=0;prototype.name=null;prototype.intraday=false;prototype.isIntraday=function(){return this.intraday;};prototype.getType=function(){return this.type;};prototype.getValue=function(){return this.value;};prototype.getTimeValue=function(){var typeValue=0;switch(this.type){case Frequency.Type.LIVE:return-1;case Frequency.Type.SECOND:typeValue=DateUtil.MS_SECOND;break;case Frequency.Type.MINUTE:typeValue=DateUtil.MS_MINUTE;break;case Frequency.Type.HOUR:typeValue=DateUtil.MS_HOUR;break;case Frequency.Type.DAY:typeValue=DateUtil.MS_DAY_24H;break;case Frequency.Type.WEEK:typeValue=DateUtil.MS_WEEK;break;case Frequency.Type.MONTH:typeValue=DateUtil.MS_MONTH;break;case Frequency.Type.YEAR:typeValue=DateUtil.MS_YEAR;break;default:typeValue=DateUtil.MS_DAY_24H;}
return this.value*typeValue;};prototype.getName=function(){return this.name;};prototype.toString=function(){return this.name;};prototype.isRegularFrequency=function(){return this.type!=Frequency.Type.LIVE;};prototype.isLive=function(){return this.type==Frequency.Type.LIVE;};constructor.getInstance=function(freq){if(freq==null){return null;}
freq=freq.toLowerCase();var f=Frequency.instances[freq];if(f!=null){return f;}
var lastS=freq.lastIndexOf("s");if(lastS>0&&lastS==freq.length-1){freq=freq.substring(0,lastS);f=Frequency.instances[freq];if(f!=null){return f;}}
var value=parseInt(freq);if(isNaN(value)||value<=0){value=1;}
var type=Frequency.getTypeInString(freq);if(type!=null&&!isNaN(value)){if(type==Frequency.Type.HOUR&&value==1){return Frequency.HOUR;}else if(type==Frequency.Type.HOUR&&value==2){return Frequency.TWO_HOUR;}else if(type==Frequency.Type.DAY&&value==1){return Frequency.DAY;}else if(type==Frequency.Type.WEEK&&value==1){return Frequency.WEEK;}else if(type==Frequency.Type.MONTH&&value==1){return Frequency.MONTH;}else if(type==Frequency.Type.MONTH&&value==3){return Frequency.QUARTER;}else if(type==Frequency.Type.MONTH&&value==6){return Frequency.SEMESTER;}else if(type==Frequency.Type.YEAR&&value==1){return Frequency.YEAR;}else{return new Frequency(type,value,freq);}}
return null;};constructor.minutesSince=function(startXValue,xValue){if(startXValue==null||xValue==null||isNaN(startXValue)||isNaN(xValue)){return null;}
return(xValue-startXValue)/DateUtil.MS_MINUTE;};},{instances:{name:"Map",arguments:[null,"Frequency"]},DAY:"Frequency",WEEK:"Frequency",MONTH:"Frequency",QUARTER:"Frequency",SEMESTER:"Frequency",YEAR:"Frequency",HOUR:"Frequency",TWO_HOUR:"Frequency",MINUTE:"Frequency",FIVE_MINUTE:"Frequency",FIFTEEN_MINUTE:"Frequency",SECOND:"Frequency",FIVE_SECOND:"Frequency",FIFTEEN_SECOND:"Frequency",THIRTY_SECOND:"Frequency",LIVE:"Frequency",ALL:"Frequency",type:{name:"Enum",arguments:["Frequency.Type"]}},{});
var Period=function(type,value,frequency){this.type=type;this.value=value;this.frequency=frequency;this.timeOffset=0;this.periodDates=null;if(type==null&&(frequency==null||!frequency.isIntraday())){this.type=Period.Type.MAXIMUM;}
if(frequency==null){if(this.type==Period.Type.LIVE||(this.type==Period.Type.DAY&&value==1)){this.frequency=Frequency.HOUR;}else{this.frequency=Frequency.DAY;}}
this.openPeriods=[];};Period=stjs.extend(Period,null,[],function(constructor,prototype){constructor.MAX_INTRADAY_DAYS=6;constructor.Type=stjs.enumeration("MAXIMUM","YEAR","MONTH","WEEK","DAY","LIVE");constructor.typeToRequestParameterString=function(type){switch(type){case Period.Type.MAXIMUM:return"a";case Period.Type.YEAR:return"y";case Period.Type.MONTH:return"m";case Period.Type.WEEK:return"w";case Period.Type.DAY:return"days";default:return"a";}};constructor.typeToTimeValue=function(type){switch(type){case Period.Type.MAXIMUM:return null;case Period.Type.YEAR:return DateUtil.MS_YEAR;case Period.Type.MONTH:return DateUtil.MS_MONTH;case Period.Type.WEEK:return DateUtil.MS_WEEK;case Period.Type.DAY:return DateUtil.MS_DAY_24H;default:return null;}};constructor.typeToString=function(type){if(type==null){return Period.Type.MAXIMUM.toString().toLowerCase();}
return type.toString().toLowerCase();};constructor.getTypeInString=function(str){if(str==null){return null;}
str=str.toLowerCase();var typeArray=(Period.Type.values());var typeCount=typeArray.length;for(var i=0;i<typeCount;i++){if(str.indexOf((typeArray[i].toString().toLowerCase()))!=-1){return typeArray[i];}}
return null;};constructor.HISTO="histo";constructor.INTRADAY="intraday";constructor.HISTO_DEFAULT=new Period(Period.Type.MAXIMUM,1,Frequency.DAY);constructor.INTRADAY_DEFAULT=new Period(Period.Type.DAY,1,Frequency.LIVE);prototype.type=null;prototype.value=0;prototype.frequency=null;prototype.from=null;prototype.to=null;prototype.forcedFrom=null;prototype.forcedTo=null;prototype.periodDates=null;prototype.openPeriods=null;prototype.timeOffset=0;prototype.isIntraday=function(){return(this.type==Period.Type.LIVE||this.type==Period.Type.DAY)&&this.frequency.isIntraday();};prototype.getType=function(){return this.type;};prototype.getValue=function(){return this.value;};prototype.getFrequency=function(){return this.frequency;};prototype.spanSeveralDays=function(){if(this.isIntraday()){if(this.openPeriods!=null&&this.openPeriods.length>0){return!DateUtil.isSameDay(this.from,this.to);}
return this.type!=Period.Type.DAY||this.value>1;}
return true;};prototype.setOpenPeriods=function(periodDates){this.periodDates=periodDates;this.openPeriods=[];this.from=null;this.to=null;if(periodDates==null){return;}
this.openPeriods=[];var openPeriodList=(periodDates).split(",");var openPeriodCount=openPeriodList.length;for(var i=0;i<openPeriodCount;i++){var openPeriodArray=(openPeriodList[i]).split("-");if(openPeriodArray.length==2){var currentFrom=new Date(parseInt(openPeriodArray[0])*DateUtil.MS_SECOND+this.timeOffset);var currentTo=new Date(parseInt(openPeriodArray[1])*DateUtil.MS_SECOND+this.timeOffset);if(this.forcedFrom==null||this.forcedTo==null||(currentFrom.getTime()<this.forcedTo.getTime()&&currentTo.getTime()>this.forcedFrom.getTime())){if(this.forcedFrom!=null&&currentFrom.getTime()<this.forcedFrom.getTime()){currentFrom=DateUtil.cloneDate(this.forcedFrom);}
if(this.forcedTo!=null&&currentTo.getTime()<this.forcedTo.getTime()){currentTo=DateUtil.cloneDate(this.forcedTo);}
if(currentFrom.getTime()<currentTo.getTime()){var openPeriod=[currentFrom,currentTo];this.openPeriods.push(openPeriod);}}}}
var sortFunc=function(a,b){return stjs.trunc((a[0].getTime()-b[0].getTime()));};this.openPeriods.sort(sortFunc);this.from=this.forcedFrom==null?this.openPeriods[0][0]:this.forcedFrom;var lastOpenPeriod=this.openPeriods.length-1;this.to=this.forcedTo==null?this.openPeriods[lastOpenPeriod][1]:this.forcedTo;};prototype.completeIntradayOpenPeriods=function(){var openPeriodsCount=this.openPeriods!=null?this.openPeriods.length:0;var refStart=this.openPeriods!=null?this.openPeriods[0]:null;if(this.isIntraday()&&openPeriodsCount>0&&this.value>openPeriodsCount&&refStart!=null&&refStart[0]!=null&&refStart[1]!=null){var daysToAdd=this.value-openPeriodsCount;var previousPeriods=[];for(var i=daysToAdd;i>=1;i--){var periodToAdd=[DateUtil.createDate(refStart[0].getTime()-(i*DateUtil.MS_DAY_24H)),DateUtil.createDate(refStart[1].getTime()-(i*DateUtil.MS_DAY_24H))];previousPeriods.push(periodToAdd);}
this.openPeriods=previousPeriods.concat(this.openPeriods);this.from=this.forcedFrom==null?this.openPeriods[0][0]:this.forcedFrom;var lastOpenPeriod=this.openPeriods.length-1;this.to=this.forcedTo==null?this.openPeriods[lastOpenPeriod][1]:this.forcedTo;}};prototype.getFrom=function(){return DateUtil.cloneDate(this.from);};prototype.getTo=function(){return DateUtil.cloneDate(this.to);};prototype.setTimeOffset=function(timeOffset){if(this.timeOffset!=timeOffset){this.timeOffset=timeOffset;this.setOpenPeriods(this.periodDates);}};prototype.getId=function(){var str="";if(this.frequency.isIntraday()){str=Period.INTRADAY;}else{str=Period.HISTO;}
str+=this.toString();str+="_"+this.frequency.toString();return str;};prototype.toString=function(){var typeString=Period.typeToString(this.type);if(this.forcedFrom!=null&&this.forcedTo!=null){return this.forcedFrom.getTime()+"-"+this.forcedTo.getTime();}else if(this.type==null||this.type==Period.Type.MAXIMUM||this.type==Period.Type.LIVE){return typeString;}else{if(this.value>1){typeString+="s";}
return String.valueOf(this.value)+typeString;}};prototype.hasOpenPeriods=function(){return this.openPeriods!=null&&this.openPeriods.length>0;};prototype.getOpenPeriods=function(){if(this.openPeriods==null){return null;}
var openPeriodsCount=this.openPeriods.length;var clonedOpenPeriods=[];for(var i=0;i<openPeriodsCount;i++){clonedOpenPeriods.push(Period.cloneOpenPeriod(this.openPeriods[i]));}
return clonedOpenPeriods;};prototype.getFirstOpenPeriod=function(){if(this.openPeriods==null){return null;}
return Period.cloneOpenPeriod(this.openPeriods[0]);};prototype.getLastOpenPeriod=function(){if(this.openPeriods==null){return null;}
var last=this.openPeriods.length-1;return Period.cloneOpenPeriod(this.openPeriods[last]);};prototype.hasRegularFrequency=function(){return this.frequency.isRegularFrequency();};prototype.isLive=function(){return this.frequency.isLive();};constructor.getInstance=function(period,frequency){var freq=Frequency.getInstance(frequency);if(period!=null&&period.indexOf("-")!=-1){var periodArray=(period).split("-");if(periodArray!=null&&periodArray.length==2){return Period.getInstanceBetweenDateValues(parseFloat(periodArray[0]),parseFloat(periodArray[1]));}}
var value=parseInt(period);if(isNaN(value)||value<=0){value=1;}
var type=Period.getTypeInString(period);if(type==Period.Type.LIVE){return new Period(Period.Type.DAY,1,Frequency.LIVE);}else if(type==Period.Type.DAY){var validValue=value;if(freq==null){if(value>Period.MAX_INTRADAY_DAYS){freq=Frequency.DAY;}else{freq=Frequency.MINUTE;}}
return new Period(type,validValue,freq);}else if(type==Period.Type.YEAR&&period=="yearToDate"){var now=new Date();var yesterday=DateUtil.createDate(DateUtil.getDateValueInScale(now.getTime(),DateUtil.MS_DAY_24H));yesterday.setMilliseconds(-1);var firstDayOfYear=DateUtil.createDate(DateUtil.getDateValueInScale(now.getTime(),DateUtil.MS_YEAR));if(yesterday.getTime()<firstDayOfYear.getTime()){return new Period(Period.Type.DAY,1,Frequency.LIVE);}
freq=freq!=null?freq:Frequency.DAY;var ytd=new Period(type,value,freq);ytd.forcedFrom=firstDayOfYear;ytd.forcedTo=yesterday;return ytd;}else if(type!=null){freq=freq!=null?freq:Frequency.DAY;return new Period(type,value,freq);}else if(freq!=null&&freq.isIntraday()){return new Period(Period.Type.DAY,1,freq);}else if(freq!=null){return new Period(Period.Type.MAXIMUM,1,freq);}else{return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}};prototype.toMaximumPeriod=function(){if(this.isIntraday()){return null;}
return new Period(Period.Type.MAXIMUM,this.value,this.frequency);};constructor.getInstanceBetweenDates=function(startDate,endDate){if(startDate==null||endDate==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}else{return Period.getInstanceBetweenDateValues(startDate.getTime(),endDate.getTime());}};constructor.getInstanceBetweenDateValues=function(startDateValue,endDateValue){if(startDateValue==null||endDateValue==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
var startDate=DateUtil.createDate(startDateValue);var endDate=DateUtil.createDate(endDateValue);var olderDate=endDateValue<startDateValue?endDate:startDate;var newerDate=endDateValue<startDateValue?startDate:endDate;var startTime=DateUtil.getDateValueInScale(olderDate.getTime(),DateUtil.MS_DAY_24H);var endTime=DateUtil.getDateValueInScale(newerDate.getTime(),DateUtil.MS_DAY_24H);var todayTime=DateUtil.getDateValueInScale((new Date()).getTime(),DateUtil.MS_DAY_24H);var timeSinceStartDate=todayTime-startTime;var p=null;if(timeSinceStartDate<=DateUtil.MS_DAY_24H){p=new Period(Period.Type.DAY,1,Frequency.LIVE);}else if(timeSinceStartDate<=DateUtil.MS_WEEK){p=new Period(Period.Type.WEEK,1,Frequency.DAY);}else if(timeSinceStartDate<=DateUtil.MS_MONTH){p=new Period(Period.Type.MONTH,1,Frequency.DAY);}else if(timeSinceStartDate<=6*(DateUtil.MS_MONTH+DateUtil.MS_DAY_24H)){p=new Period(Period.Type.MONTH,6,Frequency.DAY);}else if(timeSinceStartDate<=DateUtil.MS_YEAR){p=new Period(Period.Type.YEAR,1,Frequency.DAY);}else{p=new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
p.forcedFrom=DateUtil.cloneDate(olderDate);p.forcedTo=DateUtil.cloneDate(newerDate);return p;};prototype.getNextValueInPeriod=function(current,step){var nextValue=current+step;if(this.from!=null&&this.from.getTime()>nextValue){return this.from.getTime();}else if(this.openPeriods==null||this.openPeriods.length<=1){return nextValue;}else{var length=this.openPeriods!=null?this.openPeriods.length:0;for(var index=0;index<length;index++){var currentPeriod=this.openPeriods[index];if(currentPeriod!=null&&currentPeriod[0]!=null&&currentPeriod[1]!=null){var currentFromTime=currentPeriod[0].getTime();if(nextValue<currentFromTime){return currentPeriod[0].getTime();}else if(currentFromTime<=nextValue&&nextValue<=currentPeriod[1].getTime()){return nextValue;}}}
return nextValue;}};constructor.getInstanceBetweenDatesAsMax=function(startDateValue,endDateValue,freq){if(startDateValue==null||endDateValue==null){return new Period(Period.Type.MAXIMUM,1,Frequency.DAY);}
if(freq==null){freq=Frequency.DAY;}
var startDate=DateUtil.createDate(startDateValue);var endDate=DateUtil.createDate(endDateValue);var olderDate=endDateValue<startDateValue?endDate:startDate;var newerDate=endDateValue<startDateValue?startDate:endDate;var p=new Period(Period.Type.MAXIMUM,1,freq);p.forcedFrom=DateUtil.cloneDate(olderDate);p.forcedTo=DateUtil.cloneDate(newerDate);return p;};constructor.cloneOpenPeriod=function(openPeriodToClone){if(openPeriodToClone==null){return null;}
var d0=DateUtil.cloneDate(openPeriodToClone[0]);var d1=DateUtil.cloneDate(openPeriodToClone[1]);return[d0,d1];};},{HISTO_DEFAULT:"Period",INTRADAY_DEFAULT:"Period",type:{name:"Enum",arguments:["Period.Type"]},frequency:"Frequency",from:"Date",to:"Date",forcedFrom:"Date",forcedTo:"Date",openPeriods:{name:"Array",arguments:[{name:"Array",arguments:["Date"]}]}},{});
var Formatter=function(){};Formatter=stjs.extend(Formatter,null,[],function(constructor,prototype){constructor.DataType=stjs.enumeration("NUMBER","DATE","STRING","OBJECT");constructor.getObjectXType=function(obj){if(obj==null){return Formatter.DataType.OBJECT;}
if((typeof obj)=="number"){return Formatter.DataType.NUMBER;}else if((typeof obj)=="string"){return Formatter.DataType.STRING;}else if((typeof obj)=="object"&&stjs.isInstanceOf(obj.constructor,Date)){return Formatter.DataType.DATE;}else{return Formatter.DataType.OBJECT;}};prototype.type=null;prototype.getFormat=function(){};prototype.setFormat=function(format){};prototype.format=function(element){};prototype.formatValue=function(value){};prototype.toElement=function(value){};prototype.toValueInScale=function(value,scale){};prototype.nextValueInScale=function(value,scale){};prototype.getFormatterType=function(){return this.type;};prototype.formatValueInScale=function(value,scale){};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var StringFormatter=function(){Formatter.call(this);this.type=Formatter.DataType.STRING;};StringFormatter=stjs.extend(StringFormatter,Formatter,[],function(constructor,prototype){prototype.getFormat=function(){return null;};prototype.setFormat=function(format){};prototype.format=function(element){return element;};prototype.formatValue=function(value){return String.valueOf(value);};prototype.toElement=function(value){return String.valueOf(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return(Math.round(value/scale)*scale);};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.formatValue(value);};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var DateTimeFormatter=function(){Formatter.call(this);this.setFormat(DateTimeFormatter.FORMAT_DEFAULT);this.type=Formatter.DataType.DATE;};DateTimeFormatter=stjs.extend(DateTimeFormatter,Formatter,[],function(constructor,prototype){constructor.SEPARATOR_DATE="/";constructor.SEPARATOR_DATE_TIME=" ";constructor.SEPARATOR_TIME=":";constructor.SEPARATOR_INTERVAL=" - ";constructor.FORMAT_DAY="dd";constructor.FORMAT_MONTH_NUMBER="mm";constructor.FORMAT_MONTH_ABBR="mmm";constructor.FORMAT_YEAR_SHORT="yy";constructor.FORMAT_YEAR_FULL="yyyy";constructor.FORMAT_HOUR="HH";constructor.FORMAT_MINUTE="MM";constructor.FORMAT_DAY_MONTH=DateTimeFormatter.FORMAT_DAY+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_MONTH_NUMBER;constructor.FORMAT_MONTH_YEAR_SHORT=DateTimeFormatter.FORMAT_MONTH_ABBR+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_SHORT;constructor.FORMAT_MONTH_YEAR_FULL=DateTimeFormatter.FORMAT_MONTH_NUMBER+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_FULL;constructor.FORMAT_DATE=DateTimeFormatter.FORMAT_DAY+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_MONTH_NUMBER+DateTimeFormatter.SEPARATOR_DATE+DateTimeFormatter.FORMAT_YEAR_FULL;constructor.FORMAT_TIME=DateTimeFormatter.FORMAT_HOUR+DateTimeFormatter.SEPARATOR_TIME+DateTimeFormatter.FORMAT_MINUTE;constructor.FORMAT_TIME_HOUR=DateTimeFormatter.FORMAT_HOUR+DateTimeFormatter.SEPARATOR_TIME+"00";constructor.FORMAT_DAY_MONTH_TIME=DateTimeFormatter.FORMAT_DAY_MONTH+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME;constructor.FORMAT_DATE_TIME=DateTimeFormatter.FORMAT_DATE+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME;constructor.FORMAT_DATE_HOUR=DateTimeFormatter.FORMAT_DATE+DateTimeFormatter.SEPARATOR_DATE_TIME+DateTimeFormatter.FORMAT_TIME_HOUR;constructor.FORMAT_DEFAULT=DateTimeFormatter.FORMAT_DATE;constructor.MS_DAY=24*60*60*1000;constructor.MS_MONTH=30*DateTimeFormatter.MS_DAY;prototype.currentFormat=null;constructor.globalInstance=null;constructor.getGlobalInstance=function(){if(DateTimeFormatter.globalInstance==null){DateTimeFormatter.globalInstance=new DateTimeFormatter();}
return DateTimeFormatter.globalInstance;};prototype.setFormat=function(format){this.currentFormat=format;};prototype.getFormat=function(){return this.currentFormat;};prototype.format=function(date){if(this.currentFormat==null){return date.toUTCString();}
return dateFormat(date,this.currentFormat);};prototype.formatValue=function(value){if(value==null){return null;}
return this.format(this.toElement(value));};prototype.toElement=function(value){return new Date(parseInt(Math.round(value)));};prototype.toValueInScale=function(value,scale){return DateUtil.getDateValueInScale(value,scale);};prototype.nextValueInScale=function(value,scale){return DateUtil.getNextDateValueInScale(value,scale);};prototype.formatValueInScale=function(value,scale){return this.formatValue(this.toValueInScale(value,scale));};constructor.formatAs=function(date,format){var formatter=DateTimeFormatter.getGlobalInstance();formatter.setFormat(format);return formatter.format(date);};constructor.formatValueAs=function(value,format){var formatter=DateTimeFormatter.getGlobalInstance();formatter.setFormat(format);return formatter.format(formatter.toElement(value));};constructor.formatDateAs=function(middleDateValue,step,format){if(Frequency.DAY.getTimeValue()==step||Frequency.ALL.getTimeValue()==step||Frequency.MINUTE.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,format);}else if(Frequency.HOUR.getTimeValue()==step){var openDateFormat=DateTimeFormatter.FORMAT_TIME.equals(format)?DateTimeFormatter.FORMAT_TIME_HOUR:format;var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-stjs.trunc(step/2),openDateFormat);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+stjs.trunc(step/2),DateTimeFormatter.FORMAT_TIME_HOUR);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);}else if(Frequency.WEEK.getTimeValue()==step){var TWO_DAYS=DateTimeFormatter.MS_DAY*2;var WEDNESDAY=middleDateValue;var MONDAY=DateTimeFormatter.formatValueAs(WEDNESDAY-TWO_DAYS,format);var FRIDAY=DateTimeFormatter.formatValueAs(WEDNESDAY+TWO_DAYS,format);return DateTimeFormatter.startCloseDatesToInterval(MONDAY,FRIDAY);}else if(Frequency.MONTH.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);}else if(Frequency.QUARTER.getTimeValue()==step||Frequency.SEMESTER.getTimeValue()==step){var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-DateTimeFormatter.truncateToFullMonth(stjs.trunc(step/2)),DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+DateTimeFormatter.truncateToFullMonth(stjs.trunc(step/2)),DateTimeFormatter.FORMAT_MONTH_YEAR_FULL);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);}else if(Frequency.YEAR.getTimeValue()==step){return DateTimeFormatter.formatValueAs(middleDateValue,DateTimeFormatter.FORMAT_YEAR_FULL);}else if(format.contains(DateTimeFormatter.FORMAT_MINUTE)){return DateTimeFormatter.formatCustomIntradayDateAs(middleDateValue,step,format);}
return DateTimeFormatter.formatCustomDateAs(middleDateValue,step,format);};constructor.formatCustomIntradayDateAs=function(middleDateValue,step,format){var OPEN_DATE=DateTimeFormatter.formatValueAs(middleDateValue-stjs.trunc(step/2),format);var CLOSE_DATE=DateTimeFormatter.formatValueAs(middleDateValue+stjs.trunc(step/2),DateTimeFormatter.FORMAT_TIME);return DateTimeFormatter.startCloseDatesToInterval(OPEN_DATE,CLOSE_DATE);};constructor.truncateToFullMonth=function(dateValue){return Math.ceil(stjs.trunc(dateValue/DateTimeFormatter.MS_MONTH))*DateTimeFormatter.MS_MONTH;};constructor.startCloseDatesToInterval=function(openDate,closeDate){return openDate+DateTimeFormatter.SEPARATOR_INTERVAL+closeDate;};constructor.createPeriodFromDates=function(openDate,closeDate,format){if(DateTimeFormatter.areDatesEquals(openDate,closeDate,format)){var period=DateTimeFormatter.formatValueAs(openDate,format);if(DateTimeFormatter.FORMAT_DATE_TIME.equals(format)){return DateTimeFormatter.startCloseDatesToInterval(period,DateTimeFormatter.formatValueAs(closeDate,DateTimeFormatter.FORMAT_TIME));}
if(DateTimeFormatter.FORMAT_DATE.equals(format)){return period;}}
return DateTimeFormatter.startCloseDatesToInterval(DateTimeFormatter.formatValueAs(openDate,format),DateTimeFormatter.formatValueAs(closeDate,format));};constructor.areDatesEquals=function(date1,date2,format){if(format.contains(DateTimeFormatter.FORMAT_DATE)){var formattedDate1=DateTimeFormatter.formatValueAs(date1,DateTimeFormatter.FORMAT_DATE);var formattedDate2=DateTimeFormatter.formatValueAs(date2,DateTimeFormatter.FORMAT_DATE);return formattedDate1==formattedDate2;}
return false;};constructor.formatCustomDateAs=function(dateValue,frequencyInMilliseconds,dateFormat){var FREQUENCY_DAYS=stjs.trunc(stjs.trunc(frequencyInMilliseconds)/DateTimeFormatter.MS_DAY);var daysToSkip=stjs.trunc(FREQUENCY_DAYS/2);var openDateInMilliseconds=DateTimeFormatter.skipWorkingDays(dateValue,daysToSkip,true);var openDate=DateTimeFormatter.formatValueAs(openDateInMilliseconds,dateFormat);if(FREQUENCY_DAYS%2==0){daysToSkip--;}
var closeDateInMilliseconds=DateTimeFormatter.skipWorkingDays(dateValue,daysToSkip,false);var closeDate=DateTimeFormatter.formatValueAs(closeDateInMilliseconds,dateFormat);return DateTimeFormatter.startCloseDatesToInterval(openDate,closeDate);};constructor.skipWorkingDays=function(startingDateInMilliseconds,daysToSkip,decreasing){var resultDateInMilliseconds=startingDateInMilliseconds;var workingDayInMilliseconds=DateTimeFormatter.MS_DAY;if(decreasing){workingDayInMilliseconds*=-1;}
for(var i=0;i<daysToSkip;i++){resultDateInMilliseconds+=workingDayInMilliseconds;var nextDay=new Date(stjs.trunc(resultDateInMilliseconds));if(nextDay.getDay()==6||nextDay.getDay()==0){resultDateInMilliseconds+=workingDayInMilliseconds*2;}}
return resultDateInMilliseconds;};constructor.closeDateOfIntervalToLiteral=function(intervalRepresentation,literal){return intervalRepresentation.split(DateTimeFormatter.SEPARATOR_INTERVAL)[0]+DateTimeFormatter.SEPARATOR_INTERVAL+literal;};},{globalInstance:"DateTimeFormatter",type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var AbbreviateNumberFormatter=function(){Formatter.call(this);this.currentFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;this.type=Formatter.DataType.NUMBER;};AbbreviateNumberFormatter=stjs.extend(AbbreviateNumberFormatter,Formatter,[],function(constructor,prototype){constructor.ONE_THOUSAND=1000.0;constructor.TEN_THOUSAND=10000.0;constructor.ONE_HUNDRED_THOUSAND=100000.0;constructor.ONE_MILLION=1000000.0;constructor.ONE_BILLION=1.0E9;constructor.THOUSAND_SEPARATOR="'";constructor.THOUSAND_SUFFIX="K";constructor.MILLION_SUFFIX="M";constructor.BILLION_SUFFIX="B";constructor.NO_DECIMALS=0;constructor.EXACTLY_1_DECIMAL=1;constructor.EXACTLY_2_DECIMALS=2;constructor.EXACTLY_3_DECIMALS=3;constructor.EXACTLY_4_DECIMALS=4;constructor.EXACTLY_6_DECIMALS=6;prototype.currentFormat=0;prototype.getFormat=function(){return String.valueOf(this.currentFormat);};prototype.setFormat=function(currentFormat){var possibleFormat=parseInt(currentFormat);if(isNaN(possibleFormat)||possibleFormat<0){this.currentFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}else{this.currentFormat=possibleFormat;}};prototype.format=function(element){if(element==null){return null;}
return AbbreviateNumberFormatter.rawToFixedFormatted(element,this.currentFormat);};prototype.toElement=function(value){return value;};prototype.formatValue=function(value){return this.format(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return Math.round(value/scale)*scale;};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.format(this.toValueInScale(value,scale));};constructor.formatAs=function(value,format){var parsedFormat=parseInt(format);if(parsedFormat==null||isNaN(parsedFormat)||parsedFormat<0||parsedFormat>=20){parsedFormat=AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}
return AbbreviateNumberFormatter.rawToFixedFormatted(value,parsedFormat);};constructor.rawToFixedFormatted=function(value,format){if(value==null){return null;}
var absValue=Math.abs(value);if(absValue>=AbbreviateNumberFormatter.ONE_BILLION){return((value/AbbreviateNumberFormatter.ONE_BILLION)).toFixed(format)+AbbreviateNumberFormatter.BILLION_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_MILLION){return((value/AbbreviateNumberFormatter.ONE_MILLION)).toFixed(format)+AbbreviateNumberFormatter.MILLION_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_HUNDRED_THOUSAND){return((value/AbbreviateNumberFormatter.ONE_THOUSAND)).toFixed(format)+AbbreviateNumberFormatter.THOUSAND_SUFFIX;}else if(absValue>=AbbreviateNumberFormatter.ONE_THOUSAND){var valueString=(value).toFixed(format);if(valueString==null){return null;}
var decimalLength=valueString.indexOf(".");if(decimalLength==-1){decimalLength=valueString.length;}
var prefix=valueString.substring(0,decimalLength-3);var suffix=valueString.substring(decimalLength-3);return prefix+AbbreviateNumberFormatter.THOUSAND_SEPARATOR+suffix;}
return(value).toFixed(format);};constructor.isSuffixed=function(formattedValue){return formattedValue.endsWith(AbbreviateNumberFormatter.BILLION_SUFFIX)||formattedValue.endsWith(AbbreviateNumberFormatter.MILLION_SUFFIX)||formattedValue.endsWith(AbbreviateNumberFormatter.THOUSAND_SUFFIX);};constructor.separatedToSuffixedThousands=function(currentValue){return currentValue.substring(0,currentValue.length-4)+AbbreviateNumberFormatter.THOUSAND_SUFFIX;};constructor.getDecimalPlacesString=function(value){return String.valueOf(AbbreviateNumberFormatter.getDecimalPlaces(value));};constructor.getDecimalPlaces=function(value){if(value==null){return AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}
var valueString=value.toString();var digitsAfterDot=valueString.substring(valueString.lastIndexOf(".")+1).length;if(digitsAfterDot<=0||digitsAfterDot==1){return AbbreviateNumberFormatter.EXACTLY_2_DECIMALS;}else if(digitsAfterDot>AbbreviateNumberFormatter.EXACTLY_6_DECIMALS){return AbbreviateNumberFormatter.EXACTLY_6_DECIMALS;}
return digitsAfterDot;};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var ThousandsSeparatorNumberFormatter=function(){Formatter.call(this);};ThousandsSeparatorNumberFormatter=stjs.extend(ThousandsSeparatorNumberFormatter,Formatter,[],function(constructor,prototype){constructor.EMPTY_VALUE="-";prototype.getFormat=function(){return null;};prototype.setFormat=function(format){};prototype.format=function(element){return this.formatValue(element);};prototype.formatValue=function(value){if(value==null||value%1!=0||isNaN(value)){return ThousandsSeparatorNumberFormatter.EMPTY_VALUE;}
return ThousandsSeparatorNumberFormatter.insertSeparators((value).toFixed(0),AbbreviateNumberFormatter.THOUSAND_SEPARATOR);};prototype.toElement=function(value){return value;};prototype.toValueInScale=function(value,scale){return value;};prototype.nextValueInScale=function(value,scale){return value;};prototype.formatValueInScale=function(value,scale){return this.formatValue(value);};constructor.insertSeparators=function(str,separator){var numericString=str;var sign="";if(str.contains("-")){sign="-";numericString=numericString.substring(1,numericString.length);}
var numbersContainer=[];var length=numericString.length;while(length>3){length-=3;numbersContainer.unshift(numericString.substring(length));numericString=numericString.substring(0,length);}
numbersContainer.unshift(numericString);return sign+numbersContainer.join(separator);};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var InvalidDateFormat=function(){Exception.call(this,InvalidDateFormat.MESSAGE);};InvalidDateFormat=stjs.extend(InvalidDateFormat,Exception,[],function(constructor,prototype){constructor.MESSAGE="Error: Invalid date format!";},{},{});
var PercentNumberFormatter=function(){Formatter.call(this);this.currentFormat=PercentNumberFormatter.EXACTLY_2_DECIMALS;this.type=Formatter.DataType.NUMBER;};PercentNumberFormatter=stjs.extend(PercentNumberFormatter,Formatter,[],function(constructor,prototype){constructor.EXACTLY_2_DECIMALS=2;constructor.NO_DECIMALS=0;prototype.currentFormat=0;prototype.getFormat=function(){return String.valueOf(this.currentFormat);};prototype.setFormat=function(currentFormat){var possibleFormat=parseInt(currentFormat);if(isNaN(possibleFormat)||possibleFormat<0){this.currentFormat=PercentNumberFormatter.EXACTLY_2_DECIMALS;}else{this.currentFormat=possibleFormat;}};prototype.format=function(element){if(element==null){return null;}else{var d=((element).toFixed(this.currentFormat));if(d==0){d=((0).toFixed(this.currentFormat));}
return d+"%";}};prototype.toElement=function(value){return value;};prototype.formatValue=function(value){return this.format(value);};prototype.toValueInScale=function(value,scale){if(scale==null||scale==0){return value;}
return(Math.round(value/scale)*scale);};prototype.nextValueInScale=function(value,scale){return value+scale;};prototype.formatValueInScale=function(value,scale){return this.format(this.toValueInScale(value,scale));};constructor.formatAs=function(element,format){var formatValue=parseInt(format);if(formatValue==null||isNaN(formatValue)||formatValue<0){formatValue=PercentNumberFormatter.EXACTLY_2_DECIMALS;}
if(element==null){return null;}else{return(element).toFixed(formatValue)+"%";}};},{type:{name:"Enum",arguments:["Formatter.DataType"]}},{});
var DateUtil=function(){};DateUtil=stjs.extend(DateUtil,null,[],function(constructor,prototype){constructor.WORK_WEEK_2_WEEK_RATIO=7.0/5.0;constructor.MS_MILISECONS=1;constructor.MS_SECOND=1000;constructor.MS_MINUTE=60*DateUtil.MS_SECOND;constructor.MS_FIVE_MINUTES=5*DateUtil.MS_MINUTE;constructor.MS_TEN_MINUTES=10*DateUtil.MS_MINUTE;constructor.MS_FIFTEEN_MINUTES=15*DateUtil.MS_MINUTE;constructor.MS_HOUR=60*DateUtil.MS_MINUTE;constructor.MS_TWO_HOURS=2*DateUtil.MS_HOUR;constructor.MS_FOUR_HOURS=4*DateUtil.MS_HOUR;constructor.MS_DAY_24H=24*DateUtil.MS_HOUR;constructor.MS_WEEK=7*DateUtil.MS_DAY_24H;constructor.MS_MONTH=30*DateUtil.MS_DAY_24H;constructor.MS_YEAR=365*DateUtil.MS_DAY_24H;constructor.FORMATS="formats";constructor.STEPS="steps";constructor.INTRADAY_BASIC_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_FIVE_MINUTES,DateUtil.MS_TEN_MINUTES,DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.HISTO_BASIC_STEPS=[DateUtil.MS_DAY_24H,DateUtil.MS_WEEK,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.INTRADAY_MINUTE_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_MINUTE_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_HOUR];constructor.INTRADAY_FIVE_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_FIVE_MINUTES_STEPS=[DateUtil.MS_FIVE_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_TEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_TEN_MINUTES_STEPS=[DateUtil.MS_TEN_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_FIFTEEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_FIFTEEN_MINUTES_STEPS=[DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR];constructor.INTRADAY_1HOUR_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_1HOUR_FULL_STEPS=[DateUtil.MS_HOUR];constructor.INTRADAY_1HOUR_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_1HOUR_SHORT_STEPS=[DateUtil.MS_HOUR];constructor.INTRADAY_2HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_2HOURS_FULL_STEPS=[DateUtil.MS_TWO_HOURS];constructor.INTRADAY_2HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_2HOURS_SHORT_STEPS=[DateUtil.MS_TWO_HOURS];constructor.INTRADAY_4HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME];constructor.INTRADAY_4HOURS_FULL_STEPS=[DateUtil.MS_FOUR_HOURS];constructor.INTRADAY_4HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR];constructor.INTRADAY_4HOURS_SHORT_STEPS=[DateUtil.MS_FOUR_HOURS];constructor.MULTI_INTRADAY_MINUTE_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_MINUTE_STEPS=[DateUtil.MS_MINUTE,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_FIVE_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_FIVE_MINUTES_STEPS=[DateUtil.MS_FIVE_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_TEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_TEN_MINUTES_STEPS=[DateUtil.MS_TEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS=[DateTimeFormatter.FORMAT_MINUTE,DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS=[DateUtil.MS_FIFTEEN_MINUTES,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_1HOUR_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_1HOUR_FULL_STEPS=[DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_1HOUR_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_1HOUR_SHORT_STEPS=[DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_2HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_2HOURS_FULL_STEPS=[DateUtil.MS_TWO_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_2HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_2HOURS_SHORT_STEPS=[DateUtil.MS_TWO_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_4HOURS_FULL_FORMATS=[DateTimeFormatter.FORMAT_TIME,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_4HOURS_FULL_STEPS=[DateUtil.MS_FOUR_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_4HOURS_SHORT_FORMATS=[DateTimeFormatter.FORMAT_HOUR,DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_4HOURS_SHORT_STEPS=[DateUtil.MS_FOUR_HOURS,DateUtil.MS_DAY_24H];constructor.MULTI_INTRADAY_DAY_FORMATS=[DateTimeFormatter.FORMAT_DAY_MONTH];constructor.MULTI_INTRADAY_DAY_STEPS=[DateUtil.MS_DAY_24H];constructor.HISTO_DAY_FORMATS=[DateTimeFormatter.FORMAT_DAY,DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_MONTH_YEAR_SHORT];constructor.HISTO_DAY_STEPS=[DateUtil.MS_DAY_24H,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_WEEK_FORMATS=[DateTimeFormatter.FORMAT_DAY,DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_MONTH_YEAR_SHORT];constructor.HISTO_WEEK_STEPS=[DateUtil.MS_WEEK,DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_MONTH1_FORMATS=[DateTimeFormatter.FORMAT_MONTH_ABBR,DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_MONTH1_STEPS=[DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_MONTH2_FORMATS=[DateTimeFormatter.FORMAT_MONTH_NUMBER,DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_MONTH2_STEPS=[DateUtil.MS_MONTH,DateUtil.MS_YEAR];constructor.HISTO_YEAR_FORMATS=[DateTimeFormatter.FORMAT_YEAR_FULL];constructor.HISTO_YEAR_STEPS=[DateUtil.MS_YEAR];constructor.getDateAfter=function(date,value,step){if(date==null){date=new Date();}
var time=date.getTime();return new Date(value*step+time);};constructor.getTimeAfter=function(date,value,step){if(date==null){date=new Date();}
var time=date.getTime();return new Date(value*step+time);};constructor.setXAxisFormatsAndSteps=function(period,formats,steps){if(period==null||!period.isIntraday()){DateUtil.setHistoXAxisFormatsAndSteps(period,formats,steps);}else if(DateUtil.isSameDay(period.getFrom(),period.getTo())){DateUtil.setIntradayXAxisFormatsAndSteps(period,formats,steps);}else{DateUtil.setMultiIntradayXAxisFormatsAndSteps(period,formats,steps);}};constructor.setXAxisFormatsAndStepsFromStepValue=function(currentStepValue,formats,steps){var i=0;while(currentStepValue>=DateUtil.HISTO_BASIC_STEPS[i]&&i<DateUtil.HISTO_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.HISTO_BASIC_STEPS[i];var currentSteps=null;if(basciStep==DateUtil.MS_DAY_24H){formats.push(DateUtil.HISTO_DAY_FORMATS,DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_WEEK_STEPS,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_WEEK){formats.push(DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_MONTH){formats.push(DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_YEAR];steps.push(currentSteps,currentSteps,DateUtil.HISTO_YEAR_STEPS);}else{formats.push(DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setHistoXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.HISTO_BASIC_STEPS[i]&&i<DateUtil.HISTO_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.HISTO_BASIC_STEPS[i];var currentSteps=null;if(basciStep==DateUtil.MS_DAY_24H){formats.push(DateUtil.HISTO_DAY_FORMATS,DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_WEEK_STEPS,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_WEEK){formats.push(DateUtil.HISTO_WEEK_FORMATS,DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_MONTH,DateUtil.MS_YEAR];steps.push(currentSteps,DateUtil.HISTO_MONTH1_STEPS,DateUtil.HISTO_MONTH2_STEPS,DateUtil.HISTO_YEAR_STEPS);}else if(basciStep==DateUtil.MS_MONTH){formats.push(DateUtil.HISTO_MONTH1_FORMATS,DateUtil.HISTO_MONTH2_FORMATS,DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_YEAR];steps.push(currentSteps,currentSteps,DateUtil.HISTO_YEAR_STEPS);}else{formats.push(DateUtil.HISTO_YEAR_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setMultiIntradayXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.INTRADAY_BASIC_STEPS[i]&&i<DateUtil.INTRADAY_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.INTRADAY_BASIC_STEPS[i];var currentSteps=null;currentStepValue=currentStepValue<0?DateUtil.MS_MINUTE:currentStepValue;if(basciStep==DateUtil.MS_MINUTE&&currentStepValue==DateUtil.MS_MINUTE){formats.push(DateUtil.MULTI_INTRADAY_MINUTE_FORMATS,DateUtil.MULTI_INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_FIVE_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_FIVE_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_TEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_TEN_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_TEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep<=DateUtil.MS_FIFTEEN_MINUTES){formats.push(DateUtil.MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR,DateUtil.MS_DAY_24H];steps.push(currentSteps,DateUtil.MULTI_INTRADAY_1HOUR_FULL_STEPS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else if(basciStep==DateUtil.MS_HOUR){formats.push(DateUtil.MULTI_INTRADAY_1HOUR_FULL_FORMATS,DateUtil.MULTI_INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_FORMATS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_FORMATS,DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_DAY_24H];steps.push(currentSteps,currentSteps,DateUtil.MULTI_INTRADAY_2HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_2HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_FULL_STEPS,DateUtil.MULTI_INTRADAY_4HOURS_SHORT_STEPS,DateUtil.MULTI_INTRADAY_DAY_STEPS);}else{formats.push(DateUtil.MULTI_INTRADAY_DAY_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps);}};constructor.setIntradayXAxisFormatsAndSteps=function(period,formats,steps){var currentStepValue=period.getFrequency().getTimeValue();var i=0;while(currentStepValue>=DateUtil.INTRADAY_BASIC_STEPS[i]&&i<DateUtil.INTRADAY_BASIC_STEPS.length){i++;}
i--;if(i<0){i=0;}
var basciStep=DateUtil.INTRADAY_BASIC_STEPS[i];var currentSteps=null;currentStepValue=currentStepValue<0?DateUtil.MS_MINUTE:currentStepValue;if(basciStep==DateUtil.MS_MINUTE&&currentStepValue==DateUtil.MS_MINUTE){formats.push(DateUtil.INTRADAY_MINUTE_FORMATS,DateUtil.INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_FIVE_MINUTES_STEPS,DateUtil.INTRADAY_TEN_MINUTES_STEPS,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_FIVE_MINUTES){formats.push(DateUtil.INTRADAY_FIVE_MINUTES_FORMATS,DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_TEN_MINUTES_STEPS,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_TEN_MINUTES){formats.push(DateUtil.INTRADAY_TEN_MINUTES_FORMATS,DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_FIFTEEN_MINUTES_STEPS,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else if(basciStep<=DateUtil.MS_FIFTEEN_MINUTES){formats.push(DateUtil.INTRADAY_FIFTEEN_MINUTES_FORMATS,DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue,DateUtil.MS_HOUR];steps.push(currentSteps,DateUtil.INTRADAY_1HOUR_FULL_STEPS,DateUtil.INTRADAY_1HOUR_SHORT_STEPS,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}else{formats.push(DateUtil.INTRADAY_1HOUR_FULL_FORMATS,DateUtil.INTRADAY_1HOUR_SHORT_FORMATS,DateUtil.INTRADAY_2HOURS_FULL_FORMATS,DateUtil.INTRADAY_2HOURS_SHORT_FORMATS,DateUtil.INTRADAY_4HOURS_FULL_FORMATS,DateUtil.INTRADAY_4HOURS_SHORT_FORMATS);currentSteps=[currentStepValue];steps.push(currentSteps,currentSteps,DateUtil.INTRADAY_2HOURS_FULL_STEPS,DateUtil.INTRADAY_2HOURS_SHORT_STEPS,DateUtil.INTRADAY_4HOURS_FULL_STEPS,DateUtil.INTRADAY_4HOURS_SHORT_STEPS);}};constructor.isSameDay=function(date1,date2){if(date1==null||date2==null){return false;}
var sameYear=date1.getFullYear()==date2.getFullYear();var sameMonth=date1.getMonth()==date2.getMonth();var sameDay=date1.getDate()==date2.getDate();return sameDay&&sameMonth&&sameYear;};constructor.getDateValueInScale=function(currentDateTime,scale){if(currentDateTime==null||isNaN(currentDateTime)){return null;}
var roundedDate=new Date(Math.round(currentDateTime));if(scale==null||scale<=DateUtil.MS_MILISECONS){return roundedDate.getTime();}
roundedDate.setMilliseconds(0);if(scale<=DateUtil.MS_SECOND){return roundedDate.getTime();}
roundedDate.setSeconds(0);if(scale<=DateUtil.MS_MINUTE){return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIVE_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/5.0)*5));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
if(scale<=DateUtil.MS_TEN_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/10.0)*10));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIFTEEN_MINUTES){var minutes=stjs.trunc((Math.floor(roundedDate.getMinutes()/15.0)*15));roundedDate.setMinutes(stjs.trunc(minutes));return roundedDate.getTime();}
roundedDate.setMinutes(0);if(scale<=DateUtil.MS_FOUR_HOURS){return roundedDate.getTime();}
roundedDate.setHours(0);if(scale<=DateUtil.MS_WEEK){return roundedDate.getTime();}
roundedDate.setDate(1);if(scale<=DateUtil.MS_MONTH){return roundedDate.getTime();}
if(scale<DateUtil.MS_YEAR){var monthScale=stjs.trunc(Math.round(scale/DateUtil.MS_MONTH));var months=stjs.trunc(Math.floor(roundedDate.getMonth()/monthScale))*monthScale;roundedDate.setMonth(months);return roundedDate.getTime();}
roundedDate.setMonth(0);return roundedDate.getTime();};constructor.getNextDateValueInScale=function(currentDateTime,scale){if(currentDateTime==null||isNaN(currentDateTime)){return null;}
var roundedDate=new Date(Math.round(currentDateTime));if(scale==null){return roundedDate.getTime();}
if(scale<=DateUtil.MS_MILISECONS){roundedDate.setMilliseconds(roundedDate.getMilliseconds()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_SECOND){roundedDate.setSeconds(roundedDate.getSeconds()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_MINUTE){roundedDate.setMinutes(roundedDate.getMinutes()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIVE_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+5);return roundedDate.getTime();}
if(scale<=DateUtil.MS_TEN_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+10);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FIFTEEN_MINUTES){roundedDate.setMinutes(roundedDate.getMinutes()+15);return roundedDate.getTime();}
if(scale<=DateUtil.MS_HOUR){roundedDate.setHours(roundedDate.getHours()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_TWO_HOURS){roundedDate.setHours(roundedDate.getHours()+2);return roundedDate.getTime();}
if(scale<=DateUtil.MS_FOUR_HOURS){roundedDate.setHours(roundedDate.getHours()+4);return roundedDate.getTime();}
if(scale<=DateUtil.MS_DAY_24H){roundedDate.setDate(roundedDate.getDate()+1);return roundedDate.getTime();}
if(scale<=DateUtil.MS_WEEK){roundedDate.setDate(roundedDate.getDate()+7);return roundedDate.getTime();}
if(scale<=DateUtil.MS_MONTH){roundedDate.setMonth(roundedDate.getMonth()+1);return roundedDate.getTime();}
if(scale<DateUtil.MS_YEAR){var monthsToAdd=stjs.trunc(Math.round(scale/DateUtil.MS_MONTH));roundedDate.setMonth(roundedDate.getMonth()+monthsToAdd);}else{var yearsToAdd=stjs.trunc(Math.round(scale/DateUtil.MS_YEAR));roundedDate.setFullYear(roundedDate.getFullYear()+yearsToAdd);}
return roundedDate.getTime();};constructor.cloneDate=function(date){if(date==null){return null;}
return new Date(date.getTime());};constructor.createDate=function(dateTime){if(dateTime==null){return null;}
return new Date(dateTime);};constructor.minutesSince=function(startXValue,xValue){if(startXValue==null||xValue==null||isNaN(startXValue)||isNaN(xValue)){return null;}
return(xValue-startXValue)/DateUtil.MS_MINUTE;};},{INTRADAY_BASIC_STEPS:{name:"Array",arguments:[null]},HISTO_BASIC_STEPS:{name:"Array",arguments:[null]},INTRADAY_MINUTE_FORMATS:{name:"Array",arguments:[null]},INTRADAY_MINUTE_STEPS:{name:"Array",arguments:[null]},INTRADAY_FIVE_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_FIVE_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_TEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_TEN_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_FIFTEEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},INTRADAY_FIFTEEN_MINUTES_STEPS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_1HOUR_SHORT_STEPS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_2HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_FULL_STEPS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},INTRADAY_4HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_MINUTE_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_MINUTE_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIVE_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIVE_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_TEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_TEN_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIFTEEN_MINUTES_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_FIFTEEN_MINUTES_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_1HOUR_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_2HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_FULL_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_FULL_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_SHORT_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_4HOURS_SHORT_STEPS:{name:"Array",arguments:[null]},MULTI_INTRADAY_DAY_FORMATS:{name:"Array",arguments:[null]},MULTI_INTRADAY_DAY_STEPS:{name:"Array",arguments:[null]},HISTO_DAY_FORMATS:{name:"Array",arguments:[null]},HISTO_DAY_STEPS:{name:"Array",arguments:[null]},HISTO_WEEK_FORMATS:{name:"Array",arguments:[null]},HISTO_WEEK_STEPS:{name:"Array",arguments:[null]},HISTO_MONTH1_FORMATS:{name:"Array",arguments:[null]},HISTO_MONTH1_STEPS:{name:"Array",arguments:[null]},HISTO_MONTH2_FORMATS:{name:"Array",arguments:[null]},HISTO_MONTH2_STEPS:{name:"Array",arguments:[null]},HISTO_YEAR_FORMATS:{name:"Array",arguments:[null]},HISTO_YEAR_STEPS:{name:"Array",arguments:[null]}},{});
var ChartView=function(){};ChartView=stjs.extend(ChartView,null,[],function(constructor,prototype){constructor.AreaType=stjs.enumeration("AXIS","GRAPH","TITLE","LEGEND","TOOLTIP","CUSTOM");prototype.implementation=null;prototype.areas=null;prototype.width=0;prototype.height=0;prototype.layout=null;prototype.styleModel=null;prototype.interactionAllowed=false;prototype.animationId=0;prototype.animationStartTime=0.0;prototype.animationCallback=null;prototype.animationEndCallback=null;prototype.parentElement=null;prototype.init=function(width,height,parentDiv){};prototype.clear=function(){};prototype.clearDisplay=function(){};prototype.render=function(){};prototype.renderAnimation=function(animationEndCallback){};prototype.renderFrame=function(ratio){};prototype.refreshLayout=function(){};prototype.showHighlight=function(){};prototype.clearHighlight=function(){};prototype.onResize=function(){};prototype.resize=function(width,height){};prototype.showLoadingIndicator=function(){};prototype.hideLoadingIndicator=function(loadingId){};prototype.addLayer=function(width,height,canvasWrapperElement,zIndex){};prototype.addAdditionalLayer=function(layerId,zIndex){};prototype.putLayer=function(layerId,layer){};prototype.removeLayer=function(layerId){};prototype.getLayer=function(layerId){};prototype.clearLayer=function(layerId){};prototype.renderLayer=function(layerId){};prototype.getGroundLayer=function(){};prototype.getMainLayer=function(){};prototype.getOverlayLayer=function(){};prototype.isValid=function(){};prototype.moveTo=function(newParentElement){};prototype.getLabelWidth=function(text,font,fontSize,bold){};prototype.getTextWidth=function(text,font,fontSize,bold){};prototype.getTextWidthFull=function(text,fontFamily,fontSize,fontStyle){};prototype.getClosestRectAtPosition2D=function(x,y){};prototype.getShapesAtPosition=function(x,y,maxDistance){};prototype.getClosestShapesAtPosition=function(x,y){};prototype.getImplementation=function(){return this.implementation;};prototype.getArea=function(areaId){return this.areas[areaId];};prototype.canInteract=function(){return this.interactionAllowed;};prototype.getStyleModel=function(){return this.styleModel;};prototype.getAreas=function(){return this.areas;};prototype.getLayout=function(){return this.layout;};constructor.createView=function(implementation,options,parentDiv){if(implementation==ChartOption.Implementation.CANVAS){return new CanvasChartView(options,parentDiv);}
return null;};prototype.findElementById=function(id){};prototype.isInside=function(offsetX,offsetY){};prototype.getAreaFromPosition=function(offsetX,offsetY){for(var id in this.areas){var area=this.areas[id];if(area!=null&&area.isInside(offsetX,offsetY)){return area;}}
return null;};prototype.getParentElement=function(){return this.parentElement;};prototype.setZoomAreaStartPos=function(offsetX,offsetY){};prototype.setCurrentZoomAreaPos=function(offsetX,offsetY){};},{implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var AbstractChartView=function(options,parentElement){ChartView.call(this);this.parentElement=parentElement;this.wrapperElement=$(window.document.createElement("div"));this.wrapperElement.addClass(AbstractChartView.CHART_WRAPPER_CSS_CLASS);this.wrapperElement.css("position","relative");if(parentElement!=null){parentElement.append(this.wrapperElement);this.width=parentElement.width();this.height=parentElement.height();}else{this.width=0;this.height=0;}
this.styleModel=options.getStyleModel();if(this.styleModel==null){this.styleModel=new DefaultStyleModel();}
this.styleModel.init(options);this.init(this.width,this.height,this.wrapperElement);this.layout=options.getLayout();if(this.layout==null){this.layout=new DefaultLayout();}
this.layout.init(this.styleModel);this.refreshLayout();this.animationId=0;};AbstractChartView=stjs.extend(AbstractChartView,ChartView,[],function(constructor,prototype){constructor.CHART_WRAPPER_CSS_CLASS="chart-wrapper-element";prototype.wrapperElement=null;prototype.areasByTypes=null;prototype.moveTo=function(newParentElement){if(this.parentElement!=null){this.parentElement.empty();}
this.wrapperElement.empty();this.parentElement=newParentElement;if(this.parentElement!=null){this.parentElement.append(this.wrapperElement);this.width=this.parentElement.width();this.height=this.parentElement.height();}else{this.width=0;this.height=0;}
this.init(this.width,this.height,this.wrapperElement);this.refreshLayout();};prototype.setupAreasByTypes=function(areas){var areasByTypes={};var typeArray=(ChartView.AreaType.values());for(var i in typeArray){if(!(typeArray).hasOwnProperty(i))
continue;var emptyArray=[];areasByTypes[typeArray[i].toString()]=emptyArray;}
for(var areaId in areas){var area=areas[areaId];var currentAreasWithType=areasByTypes[area.getAreaType().toString()];currentAreasWithType.push(area);}
return areasByTypes;};prototype.onResize=function(){if(this.parentElement!=null){this.width=this.parentElement.width();this.height=this.parentElement.height();}else{this.width=0;this.height=0;}
this.resize(this.width,this.height);};prototype.isValid=function(){return this.getArea(DefaultLayout.GRAPH_AREA)!=null;};prototype.refreshLayout=function(){this.layout.refresh(this,this.width,this.height);this.areas=this.layout.getAreas();this.areasByTypes=this.setupAreasByTypes(this.areas);};prototype.getArea=function(areaId){if(this.areas==null){return null;}
return this.areas[areaId];};prototype.findElementById=function(id){if(this.areas==null||id==null){return null;}
for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){var element=area.getElement(id);if(element!=null){return element;}}}
return null;};prototype.isInside=function(offsetX,offsetY){if(offsetX==null||offsetY==null||isNaN(offsetX)||isNaN(offsetY)){return false;}else if(offsetX>=0&&offsetY>=0&&offsetX<this.width&&offsetY<this.height){return true;}else{return false;}};prototype.getShapesAtPosition=function(x,y,maxDistance){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());var res=[];for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)){var shape=element;var distance=shape.calDistance(x,y);if(maxDistance<distance){res.push(shape);}}}
return res;}
return null;};prototype.getClosestRectAtPosition2D=function(x,y){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());if(elements==null){return null;}
var res=null;var minDistance=Double.POSITIVE_INFINITY;for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)&&stjs.isInstanceOf(element.constructor,CanvasRect)){var shape=element;var previousShape=null;var distanceX=shape.calDistance(x,y);if(minDistance>distanceX){minDistance=distanceX;res=shape;}
if((shape.calDistance(x,y)==minDistance)&&shape.calDistanceY(y)<res.calDistanceY(y)){res=shape;}}}
return res;}
return null;};prototype.getClosestShapesAtPosition=function(x,y){if(this.isInside(x,y)){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var elements=graphArea.getElementsByLayer(this.getMainLayer().getId());if(elements==null){return null;}
var res=null;var minDistance=Double.POSITIVE_INFINITY;for(var i=0;i<elements.length;i++){var element=elements[i];if(stjs.isInstanceOf(element.constructor,Shape)){var shape=element;var distance=shape.calDistance(x,y);if(minDistance>distance){minDistance=distance;res=shape;}}}
return res;}
return null;};},{wrapperElement:"SqwJQuery",areasByTypes:{name:"Map",arguments:[null,{name:"Array",arguments:["Area"]}]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var CanvasChartView=function(options,parentDiv){AbstractChartView.call(this,options,parentDiv);this.implementation=ChartOption.Implementation.CANVAS;this.loadingId=0;this.layerCounter=0;this.loadingIndicator=LoadingIndicator.getInstance();this.zoomAreaColor=options.getZoomAreaColor();this.zoomAreaColorGradientParam=options.getZoomAreaColorGradientParam();};CanvasChartView=stjs.extend(CanvasChartView,AbstractChartView,[],function(constructor,prototype){constructor.LABELS_MARGIN=4;prototype.layers=null;prototype.orderedLayers=null;prototype.groundLayerId=null;prototype.mainLayerId=null;prototype.overlayLayerId=null;prototype.loadingId=0;prototype.loadingIndicator=null;prototype.layerCounter=0;prototype.zoomAreaColor=null;prototype.zoomAreaColorGradientParam=null;prototype.zoomArea=null;prototype.zoomAreaStartPos=null;prototype.zoomAreaEndPos=null;prototype.init=function(width,height,wrapperElement){this.layers={};this.orderedLayers=[];this.groundLayerId=this.addLayer(width,height,wrapperElement,0);this.mainLayerId=this.addLayer(width,height,wrapperElement,1);this.overlayLayerId=this.addLayer(width,height,wrapperElement,2);};prototype.clear=function(){this.interactionAllowed=false;this.animationId++;for(var layerId in this.layers){this.clearLayer(layerId);}};prototype.clearDisplay=function(){this.interactionAllowed=false;for(var layerId in this.layers){var layer=this.layers[layerId];if(layer!=null){layer.clear();}}};prototype.clearLayer=function(layerId){var layer=this.getLayer(layerId);if(layer!=null){layer.clear();}
for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){area.clearElementsInLayer(layerId);}}};prototype.renderLayer=function(layerId){var layer=this.getLayer(layerId);for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){this.clipLayerToArea(layer,area);area.renderLayer(layer);this.unclipLayer(layer);}}};prototype.resize=function(width,height){this.width=width;this.height=height;for(var layerId in this.layers){var layer=this.getLayer(layerId);if(layer!=null){layer.setHeight(height);layer.setWidth(width);}}
this.refreshLayout();};prototype.render=function(){this.renderFrame(null);};prototype.setupRenderingRatio=function(layer,ratio){var graphArea=this.getArea(DefaultLayout.GRAPH_AREA);var bounds=graphArea.getAreaBound();var context=layer.getCanvasRenderingContext2D();var startX=stjs.trunc(bounds.getLeft());var width=stjs.trunc(Math.round(ratio*bounds.getOuterWidth(true)));context.save();context.beginPath();context.rect(startX,0,width,layer.getHeight());context.clip();};prototype.clipLayerToArea=function(layer,area){var bounds=area.getAreaBound();var context=layer.getCanvasRenderingContext2D();var left=stjs.trunc(bounds.getLeft());var top=stjs.trunc(bounds.getTop());var width=stjs.trunc(bounds.getOuterWidth(true));var height=stjs.trunc(bounds.getOuterHeight(true));context.save();context.beginPath();context.rect(left,top,width,height);context.clip();};prototype.unclipLayer=function(layer){var context=layer.getCanvasRenderingContext2D();context.restore();};prototype.renderAnimation=function(animationEndCallback){var self=this;var animationTime=this.styleModel.getGlobalStyle().getAnimationTime();this.animationId++;var currentAnimationId=this.animationId;if(this.styleModel.getGlobalStyle().getAnimationTime()<=0){this.clearDisplay();this.renderFrame(null);if(animationEndCallback!=null){animationEndCallback();}
return;}
var animationCallback=function(){if(currentAnimationId!=self.animationId){return;}
var now=(new Date()).getTime();var ratio=(now-self.animationStartTime)/animationTime;if(ratio>=1){self.clearDisplay();self.renderFrame(null);if(animationEndCallback!=null){animationEndCallback();}}else{self.clearDisplay();self.renderFrame(ratio);window.requestAnimationFrame(animationCallback);}};this.animationStartTime=(new Date()).getTime();window.requestAnimationFrame(animationCallback);};prototype.renderFrame=function(ratio){var layersCount=this.orderedLayers!=null?this.orderedLayers.length:0;var restoreContextNeeded=false;for(var i=0;i<layersCount;i++){var layer=this.layers[this.orderedLayers[i]];if(ratio!=null&&layer!=null&&layer.getId()==this.mainLayerId&&ratio>0&&ratio<1.0){this.setupRenderingRatio(layer,ratio);restoreContextNeeded=true;}
this.renderLayer(this.orderedLayers[i]);if(restoreContextNeeded){restoreContextNeeded=false;layer.getCanvasRenderingContext2D().restore();}}};prototype.showHighlight=function(){var overlayLayer=this.getOverlayLayer();this.createZoomArea(overlayLayer);for(var areaId in this.areas){var area=this.areas[areaId];if(area!=null){this.clipLayerToArea(overlayLayer,area);area.renderLayer(overlayLayer);this.unclipLayer(overlayLayer);}}};prototype.createZoomArea=function(overlayLayer){if(this.zoomArea!=null&&this.zoomArea.getAreaBound()!=null&&this.zoomAreaStartPos!=null&&this.zoomAreaEndPos!=null){var bounds=this.zoomArea.getAreaBound();var x=stjs.trunc(Math.round(this.zoomAreaStartPos));var areaWidth=stjs.trunc(Math.round(this.zoomAreaEndPos-this.zoomAreaStartPos));var rect=ChartElementFactory.createRect(overlayLayer,x,stjs.trunc(bounds.getTop()),areaWidth,stjs.trunc(bounds.getOuterHeight(true)));rect.setFillColor(this.zoomAreaColor);rect.setFillColorGradientParam(this.zoomAreaColorGradientParam);this.zoomArea.addElement(rect);}};prototype.isInsideGraph=function(offsetX,offsetY){if(offsetX==null||offsetY==null||isNaN(offsetX)||isNaN(offsetY)){return false;}else{var graphs=this.areasByTypes[ChartView.AreaType.GRAPH.toString()];for(var i in graphs){if(!(graphs).hasOwnProperty(i))
continue;var currentGraph=graphs[i];if(currentGraph!=null){if(currentGraph.isInside(offsetX,offsetY)){return true;}}}
return false;}};prototype.clearHighlight=function(){this.clearLayer(this.overlayLayerId);};prototype.showLoadingIndicator=function(){this.loadingId++;var currentLoadingId=this.loadingId;LoadingIndicator.getLoadingImage(this.getStartLoadingAnimationCallback(currentLoadingId));return currentLoadingId;};prototype.hideLoadingIndicator=function(currentLoadingId){if(this.loadingId==currentLoadingId){this.loadingId++;this.clearHighlight();}};prototype.getStartLoadingAnimationCallback=function(currentLoadingId){var self=this;return function(p1){if(currentLoadingId==self.loadingId){self.startLoadingAnimation(currentLoadingId,p1);}};};prototype.startLoadingAnimation=function(currentLoadingId,loadingImage){var self=this;var animationStartTime=(new Date()).getTime();var LOADING_CYCLE_TIME=1000;var animationCallback=function(){if(currentLoadingId==self.loadingId){self.clearHighlight();var now=(new Date()).getTime();var ratio=(now-animationStartTime)/LOADING_CYCLE_TIME;if(ratio>=1){ratio=ratio-Math.floor(ratio);}
self.getOverlayLayer().drawRotatedImage(loadingImage,Math.PI*2.0*ratio);window.requestAnimationFrame(animationCallback);}};window.requestAnimationFrame(animationCallback);};prototype.addLayer=function(width,height,wrapperElement,zIndex){var layer=new CanvasLayer(width,height);layer.setzIndex(zIndex);layer.attachTo(wrapperElement);var layerId=layer.getId();this.layers[layerId]=layer;this.addLayerToOrdered(layer);return layerId;};prototype.addAdditionalLayer=function(layerId,zIndex){var layer=new CanvasLayer(this.width,this.height);layer.setzIndex(zIndex);layer.attachTo(this.wrapperElement);layer.setId(layerId);this.layers[layerId]=layer;this.addLayerToOrdered(layer);return layer;};prototype.addLayerToOrdered=function(layer){if(layer==null){return;}
var layerId=layer.getId();var zIndex=layer.getZIndex();var currentCount=this.orderedLayers.length;for(var i=0;i<currentCount;i++){var currentLayerId=this.orderedLayers[i];if(currentLayerId!=null&&zIndex<this.layers[currentLayerId].getZIndex()){this.orderedLayers.splice(i,0,layerId);return;}}
this.orderedLayers.push(layerId);};prototype.removeLayerFromOrderer=function(layer){if(layer==null){return;}
var layerId=layer.getId();var currentCount=this.orderedLayers.length;for(var i=0;i<currentCount;i++){var currentLayerId=this.orderedLayers[i];if(currentLayerId==layerId){this.orderedLayers.splice(i,1);return;}}};prototype.removeLayer=function(layerId){this.clearLayer(layerId);this.removeLayerFromOrderer(this.layers[layerId]);delete this.layers[layerId];};prototype.getLayer=function(layerId){return this.layers[layerId];};prototype.putLayer=function(layerId,layer){this.clearLayer(layerId);this.removeLayerFromOrderer(this.layers[layerId]);this.layers[layerId]=layer;this.addLayerToOrdered(layer);};prototype.getGroundLayer=function(){return this.getLayer(this.groundLayerId);};prototype.getMainLayer=function(){return this.getLayer(this.mainLayerId);};prototype.getOverlayLayer=function(){return this.getLayer(this.overlayLayerId);};prototype.getTextWidth=function(text,font,fontSize,bold){return stjs.trunc(Math.ceil(this.getMainLayer().computeTextWidth(text,font,fontSize,bold)));};prototype.getLabelWidth=function(text,font,fontSize,bold){return this.getTextWidth(text,font,fontSize,bold)+2*CanvasChartView.LABELS_MARGIN;};prototype.getTextWidthFull=function(text,fontFamily,fontSize,fontStyle){return this.getMainLayer().computeTextWidthFull(text,fontFamily,fontSize,fontStyle);};prototype.setZoomAreaStartPos=function(offsetX,offsetY){this.zoomArea=this.getAreaFromPosition(offsetX,offsetY);this.zoomAreaStartPos=offsetX;};prototype.setCurrentZoomAreaPos=function(offsetX,offsetY){this.zoomAreaEndPos=offsetX;};},{layers:{name:"Map",arguments:[null,"CanvasLayer"]},orderedLayers:{name:"Array",arguments:[null]},loadingIndicator:"LoadingIndicator",zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},zoomArea:"Area",wrapperElement:"SqwJQuery",areasByTypes:{name:"Map",arguments:[null,{name:"Array",arguments:["Area"]}]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},areas:{name:"Map",arguments:[null,"Area"]},layout:"Layout",styleModel:"StyleModel",animationCallback:"Callback0",animationEndCallback:"Callback0",parentElement:"SqwJQuery"},{});
var AggregationStrategy=stjs.enumeration("FIRST","LAST","MEDIAN","AVERAGE","MIN","MAX","SUM","NONE","FIRST_LAST","MIN_MAX");
var ColorStrategy=function(positiveColor,negativeColor){this.positiveColor=positiveColor;this.negativeColor=negativeColor;};ColorStrategy=stjs.extend(ColorStrategy,null,[],function(constructor,prototype){prototype.positiveColor=null;prototype.negativeColor=null;constructor.GREEN_RED=new ColorStrategy(ChartColor.greenOld,ChartColor.redOld);constructor.GREEN_RED_GRADIENT=new ColorStrategy(ChartColor.greenGradient,ChartColor.redGradient);constructor.BLUE_ORANGE=new ColorStrategy(ChartColor.blue,ChartColor.orange);prototype.getColor=function(){return this.getPositiveColor();};prototype.getPositiveColor=function(){return this.positiveColor;};prototype.getNegativeColor=function(){return this.negativeColor;};},{positiveColor:"ChartColor",negativeColor:"ChartColor",GREEN_RED:"ColorStrategy",GREEN_RED_GRADIENT:"ColorStrategy",BLUE_ORANGE:"ColorStrategy"},{});
var AreaBound=function(left,top,width,height){this.left=left;this.top=top;this.width=width;this.height=height;this.visible=true;this.setPadding(0);this.setMargin(0);this.setBorder(0);this.setBorderColor(ChartColor.black);};AreaBound=stjs.extend(AreaBound,null,[],function(constructor,prototype){prototype.left=0.0;prototype.top=0.0;prototype.width=0.0;prototype.height=0.0;prototype.paddingLeft=0.0;prototype.paddingRight=0.0;prototype.paddingTop=0.0;prototype.paddingBottom=0.0;prototype.marginLeft=0.0;prototype.marginRight=0.0;prototype.marginTop=0.0;prototype.marginBottom=0.0;prototype.borderLeft=0.0;prototype.borderRight=0.0;prototype.borderTop=0.0;prototype.borderBottom=0.0;prototype.borderLeftColor=null;prototype.borderRightColor=null;prototype.borderTopColor=null;prototype.borderBottomColor=null;prototype.visible=false;prototype.setLeft=function(left){this.left=left;};prototype.setTop=function(top){this.top=top;};prototype.setWidth=function(width){this.width=width;};prototype.setHeight=function(height){this.height=height;};prototype.getPaddingLeft=function(){return this.paddingLeft;};prototype.setPaddingLeft=function(paddingLeft){this.paddingLeft=paddingLeft;};prototype.getPaddingRight=function(){return this.paddingRight;};prototype.setPaddingRight=function(paddingRight){this.paddingRight=paddingRight;};prototype.getPaddingTop=function(){return this.paddingTop;};prototype.setPaddingTop=function(paddingTop){this.paddingTop=paddingTop;};prototype.getPaddingBottom=function(){return this.paddingBottom;};prototype.setPaddingBottom=function(paddingBottom){this.paddingBottom=paddingBottom;};prototype.getMarginLeft=function(){return this.marginLeft;};prototype.setMarginLeft=function(marginLeft){this.marginLeft=marginLeft;};prototype.getMarginRight=function(){return this.marginRight;};prototype.setMarginRight=function(marginRight){this.marginRight=marginRight;};prototype.getMarginTop=function(){return this.marginTop;};prototype.setMarginTop=function(marginTop){this.marginTop=marginTop;};prototype.getMarginBottom=function(){return this.marginBottom;};prototype.setMarginBottom=function(marginBottom){this.marginBottom=marginBottom;};prototype.getBorderLeft=function(){return this.borderLeft;};prototype.setBorderLeft=function(borderLeft){this.borderLeft=borderLeft;};prototype.getBorderRight=function(){return this.borderRight;};prototype.setBorderRight=function(borderRight){this.borderRight=borderRight;};prototype.getBorderTop=function(){return this.borderTop;};prototype.setBorderTop=function(borderTop){this.borderTop=borderTop;};prototype.getBorderBottom=function(){return this.borderBottom;};prototype.setBorderBottom=function(borderBottom){this.borderBottom=borderBottom;};prototype.getBorderLeftColor=function(){return this.borderLeftColor;};prototype.setBorderLeftColor=function(borderLeftColor){this.borderLeftColor=borderLeftColor;};prototype.getBorderRightColor=function(){return this.borderRightColor;};prototype.setBorderRightColor=function(borderRightColor){this.borderRightColor=borderRightColor;};prototype.getBorderTopColor=function(){return this.borderTopColor;};prototype.setBorderTopColor=function(borderTopColor){this.borderTopColor=borderTopColor;};prototype.getBorderBottomColor=function(){return this.borderBottomColor;};prototype.setBorderBottomColor=function(borderBottomColor){this.borderBottomColor=borderBottomColor;};prototype.setPadding=function(globalPadding){this.paddingLeft=globalPadding;this.paddingRight=globalPadding;this.paddingTop=globalPadding;this.paddingBottom=globalPadding;};prototype.setPaddings=function(paddingLeft,paddingTop,paddingRight,paddingBottom){this.paddingLeft=paddingLeft;this.paddingTop=paddingTop;this.paddingRight=paddingRight;this.paddingBottom=paddingBottom;};prototype.setPaddingsFromArray=function(paddingsArray){if(paddingsArray==null){this.setPadding(0);}else{var left=paddingsArray[0]!=null?paddingsArray[0]:0.0;var top=paddingsArray[1]!=null?paddingsArray[1]:0.0;var right=paddingsArray[2]!=null?paddingsArray[2]:0.0;var bottom=paddingsArray[3]!=null?paddingsArray[3]:0.0;this.setPaddings(left,top,right,bottom);}};prototype.getPaddings=function(){var paddingsArray=[];paddingsArray.push(this.paddingLeft,this.paddingTop,this.paddingRight,this.paddingBottom);return paddingsArray;};prototype.setMargin=function(globalMargin){this.marginLeft=globalMargin;this.marginRight=globalMargin;this.marginTop=globalMargin;this.marginBottom=globalMargin;};prototype.setMargins=function(marginLeft,marginTop,marginRight,marginBottom){this.marginLeft=marginLeft;this.marginTop=marginTop;this.marginRight=marginRight;this.marginBottom=marginBottom;};prototype.setMarginsFromArray=function(marginsArray){if(marginsArray==null){this.setMargin(0);}else{var left=marginsArray[0]!=null?marginsArray[0]:0.0;var top=marginsArray[1]!=null?marginsArray[1]:0.0;var right=marginsArray[2]!=null?marginsArray[2]:0.0;var bottom=marginsArray[3]!=null?marginsArray[3]:0.0;this.setMargins(left,top,right,bottom);}};prototype.getMargins=function(){var marginsArray=[];marginsArray.push(this.marginLeft,this.marginTop,this.marginRight,this.marginBottom);return marginsArray;};prototype.setBorder=function(globalBorder){this.borderLeft=globalBorder;this.borderRight=globalBorder;this.borderTop=globalBorder;this.borderBottom=globalBorder;};prototype.setBorders=function(borderLeft,borderTop,borderRight,borderBottom){this.borderLeft=borderLeft;this.borderTop=borderTop;this.borderRight=borderRight;this.borderBottom=borderBottom;};prototype.setBordersFromArray=function(bordersArray){if(bordersArray==null){this.setBorder(0);}else{var left=bordersArray[0]!=null?bordersArray[0]:0.0;var top=bordersArray[1]!=null?bordersArray[1]:0.0;var right=bordersArray[2]!=null?bordersArray[2]:0.0;var bottom=bordersArray[3]!=null?bordersArray[3]:0.0;this.setBorders(left,top,right,bottom);}};prototype.getBorders=function(){var marginsArray=[];marginsArray.push(this.borderLeft,this.borderTop,this.borderRight,this.borderBottom);return marginsArray;};prototype.setBorderColor=function(globalBorderColor){this.borderLeftColor=globalBorderColor;this.borderRightColor=globalBorderColor;this.borderTopColor=globalBorderColor;this.borderBottomColor=globalBorderColor;};prototype.getLeft=function(){return this.left;};prototype.getTop=function(){return this.top;};prototype.getContentLeft=function(){return this.left+this.marginLeft+this.borderLeft+this.paddingLeft;};prototype.getInnerLeft=function(){return this.left+this.marginLeft+this.borderLeft;};prototype.getInnerRight=function(){return this.getInnerLeft()+this.getInnerWidth();};prototype.getRight=function(){return this.left+this.getOuterWidth(true);};prototype.getContentTop=function(){return this.top+this.marginTop+this.borderTop+this.paddingTop;};prototype.getInnerTop=function(){return this.top+this.marginTop+this.borderTop;};prototype.getInnerBottom=function(){return this.getInnerTop()+this.getInnerHeight();};prototype.getBottom=function(){return this.top+this.getOuterHeight(true);};prototype.getWidth=function(){return this.width;};prototype.getContentWidth=function(){return this.width;};prototype.getInnerWidth=function(){return this.width+this.paddingLeft+this.paddingRight;};prototype.getOuterWidth=function(includeMargin){var outerWidth=this.width+this.paddingLeft+this.paddingRight+this.borderLeft+this.borderRight;if(includeMargin){outerWidth+=(this.marginLeft+this.marginRight);}
return outerWidth;};prototype.getHeight=function(){return this.height;};prototype.getContentHeight=function(){return this.height;};prototype.getInnerHeight=function(){return this.height+this.paddingTop+this.paddingBottom;};prototype.getOuterHeight=function(includeMargin){var outerHeight=this.height+this.paddingTop+this.paddingBottom+this.borderTop+this.borderBottom;if(includeMargin){outerHeight+=(this.marginTop+this.marginBottom);}
return outerHeight;};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.getInnerLeft()&&y>=this.getInnerTop()&&x<(this.getInnerLeft()+this.getInnerWidth())&&y<(this.getInnerTop()+this.getInnerHeight())){return true;}else{return false;}};prototype.isXInside=function(x){if(x!=null&&x>=this.getInnerLeft()&&x<(this.getInnerLeft()+this.getInnerWidth())){return true;}else{return false;}};prototype.isYInside=function(y){if(y!=null&&y>=this.getInnerTop()&&y<(this.getInnerTop()+this.getInnerHeight())){return true;}else{return false;}};prototype.intersects=function(bound){if(bound==null){return false;}
return!(bound.left>(this.left+this.getOuterWidth(true))||(bound.left+bound.getOuterWidth(true))<this.left||bound.top>(this.top+this.getOuterHeight(true))||(bound.top+bound.getOuterHeight(true))<this.top);};prototype.isVisible=function(){return this.visible&&this.height>0&&this.width>0;};prototype.setVisible=function(visible){this.visible=visible;};prototype.reset=function(){this.left=0;this.top=0;this.width=0;this.height=0;this.visible=true;this.setPadding(0);this.setMargin(0);this.setBorder(0);this.setBorderColor(ChartColor.black);};prototype.getContentBordersLines=function(){var left=stjs.trunc(Math.round(this.getContentLeft()));var right=stjs.trunc(Math.round(this.getContentLeft()+this.width-1));var top=stjs.trunc(Math.round(this.getContentTop()));var bottom=stjs.trunc(Math.round(this.getContentTop()+this.height-1));var topLeft=new Point2D(left,top);var topRight=new Point2D(right,top);var bottomLeft=new Point2D(left,bottom);var bottomRight=new Point2D(right,bottom);var topLine=new Line2D(topLeft,topRight);var leftLine=new Line2D(topLeft,bottomLeft);var bottomLine=new Line2D(bottomLeft,bottomRight);var rightLine=new Line2D(topRight,bottomRight);return[topLine,leftLine,bottomLine,rightLine];};prototype.getInnerBordersLines=function(){var left=stjs.trunc(Math.round(this.getInnerLeft()));var right=stjs.trunc(Math.round(this.getInnerLeft()+this.getInnerWidth()-1));var top=stjs.trunc(Math.round(this.getInnerTop()));var bottom=stjs.trunc(Math.round(this.getInnerTop()+this.getInnerHeight()-1));var topLeft=new Point2D(left,top);var topRight=new Point2D(right,top);var bottomLeft=new Point2D(left,bottom);var bottomRight=new Point2D(right,bottom);var topLine=new Line2D(topLeft,topRight);var leftLine=new Line2D(topLeft,bottomLeft);var bottomLine=new Line2D(bottomLeft,bottomRight);var rightLine=new Line2D(topRight,bottomRight);return[topLine,leftLine,bottomLine,rightLine];};},{borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor"},{});
var Area=function(id,type,areaBound){this.id=id;this.areaBound=areaBound;this.areaType=type;this.elementsByLayer={};this.elementsById={};this.layers={};};Area=stjs.extend(Area,null,[],function(constructor,prototype){prototype.areaBound=null;prototype.id=null;prototype.areaType=null;prototype.elementsByLayer=null;prototype.elementsById=null;prototype.layers=null;prototype.setAreaBound=function(areaBound){this.areaBound=areaBound;};prototype.getAreaBound=function(){return this.areaBound;};prototype.getAreaType=function(){return this.areaType;};prototype.addElement=function(element){if(element==null){return;}
var layerId=element.getLayerId();var elementsInLayer=this.elementsByLayer[layerId];if(elementsInLayer==null){elementsInLayer=[];this.elementsByLayer[layerId]=elementsInLayer;}
elementsInLayer.push(element);this.elementsById[element.getId()]=element;};prototype.addElements=function(elements){for(var index in elements){if(!(elements).hasOwnProperty(index))
continue;this.addElement(elements[index]);}};prototype.isInside=function(x,y){if(x==null||y==null||isNaN(x)||isNaN(y)){return false;}else{return this.areaBound.isInside(x,y);}};prototype.renderLayer=function(layer){if(layer!=null){this.renderLayerById(layer.getId());}};prototype.render=function(){for(var layerId in this.elementsByLayer){this.renderLayerById(layerId);}};prototype.clearLayer=function(layer){if(layer!=null){layer.clearArea(this.areaBound);this.clearElementsInLayer(layer.getId());}};prototype.clear=function(){for(var layerId in this.layers){this.clearLayer(this.layers[layerId]);}
this.clearElements();};prototype.clearShape=function(layerId,shape){};prototype.clearElements=function(){this.elementsByLayer={};this.elementsById={};this.layers={};};prototype.clearElementsInLayer=function(layerId){var elementsInLayer=this.elementsByLayer[layerId];var elementsInLayerCount=elementsInLayer!=null?elementsInLayer.length:0;for(var i=0;i<elementsInLayerCount;i++){var currentElement=elementsInLayer[i];if(currentElement!=null){delete this.elementsById[currentElement.getId()];}}
delete this.elementsByLayer[layerId];delete this.layers[layerId];};prototype.renderLayerById=function(layerId){if(layerId==null||this.areaBound==null||!this.areaBound.isVisible()){return;}
var elementsToBeRendered=null;if(this.elementsByLayer!=null){elementsToBeRendered=this.elementsByLayer[layerId];}
var elementsCount=elementsToBeRendered!=null?elementsToBeRendered.length:0;for(var i=0;i<elementsCount;i++){var currentElement=elementsToBeRendered[i];if(currentElement!=null){currentElement.render();}}};prototype.getElement=function(id){if(this.elementsById==null){return null;}
return this.elementsById[id];};prototype.getElementsByLayer=function(layerId){return this.elementsByLayer[layerId];};prototype.isPointInside=function(currentPosition){if(currentPosition==null){return false;}
var x=currentPosition.getX();var y=currentPosition.getY();return this.isInside(x,y);};prototype.getId=function(){return this.id;};},{areaBound:"AreaBound",areaType:{name:"Enum",arguments:["ChartView.AreaType"]},elementsByLayer:{name:"Map",arguments:[null,{name:"Array",arguments:["sq.ChartElement"]}]},elementsById:{name:"Map",arguments:[null,"sq.ChartElement"]},layers:{name:"Map",arguments:[null,"Layer"]}},{});
var Layer=function(width,height){this.width=width;this.height=height;this.id=Layer.LAYER+new Date().getTime()+"_"+Math.round((Math.random()*100000));this.zIndex=0;};Layer=stjs.extend(Layer,null,[],function(constructor,prototype){constructor.LAYER="layer";prototype.id=null;prototype.zIndex=0;prototype.width=0;prototype.height=0;prototype.implementation=null;prototype.clear=function(){};prototype.clearArea=function(areaBound){};prototype.attachTo=function(element){};prototype.detach=function(){};prototype.drawRotatedImage=function(image,angle){};prototype.drawImage=function(image,x,y){};prototype.computeTextWidth=function(text,font,fontSize,bold){};prototype.computeTextWidthFull=function(text,fontFamily,fontSize,fontStyle){};prototype.getImplementation=function(){return this.implementation;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getZIndex=function(){return this.zIndex;};prototype.setzIndex=function(zIndex){this.zIndex=zIndex;};},{implementation:{name:"Enum",arguments:["ChartOption.Implementation"]}},{});
var CanvasLayer=function(width,height){Layer.call(this,width,height);this.implementation=ChartOption.Implementation.CANVAS;this.canvas=window.document.createElement("canvas");this.canvas.setAttribute("width",String.valueOf(width));this.canvas.setAttribute("height",String.valueOf(height));if(this.canvas.getContext){this.canvasContext=this.canvas.getContext("2d");}
$(this.canvas).addClass(CanvasLayer.CSS_CANVAS_CLASS);};CanvasLayer=stjs.extend(CanvasLayer,Layer,[],function(constructor,prototype){constructor.CSS_CANVAS_CLASS="chart-canvas-element";prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height);};prototype.attachTo=function(element){element.append(this.canvas);if(!this.canvas.getContext&&(typeof G_vmlCanvasManager)!="undefined"){this.canvas=G_vmlCanvasManager.initElement(this.canvas);this.canvasContext=this.canvas.getContext("2d");}};prototype.detach=function(){SQW.$(this.canvas).detach();};prototype.setWidth=function(width){Layer.prototype.setWidth.call(this,width);this.canvas.width=width;};prototype.setHeight=function(height){Layer.prototype.setHeight.call(this,height);this.canvas.height=height;};prototype.getCanvas=function(){return this.canvas;};prototype.getCanvasRenderingContext2D=function(){return this.canvasContext;};prototype.drawRotatedImage=function(image,angle){var context=this.getCanvasRenderingContext2D();var centerX=stjs.trunc(Math.round(this.getWidth()/2.0));var centerY=stjs.trunc(Math.round(this.getHeight()/2.0));context.save();context.translate(centerX,centerY);context.rotate(angle);this.drawImage(image,stjs.trunc(-Math.round(image.width/2.0)),stjs.trunc(-Math.round(image.height/2.0)));context.restore();};prototype.drawImage=function(image,x,y){if(image==null){return;}
var context=this.getCanvasRenderingContext2D();context.drawImage(image,x,y,image.width,image.height);};prototype.clearArea=function(areaBound){if(areaBound!=null){var left=stjs.trunc(Math.round(areaBound.getLeft()));var top=stjs.trunc(Math.round(areaBound.getTop()));var width=stjs.trunc(Math.round(areaBound.getOuterWidth(true)));var height=stjs.trunc(Math.round(areaBound.getOuterHeight(true)));this.canvasContext.clearRect(left,top,width,height);}};prototype.computeTextWidth=function(text,font,fontSize,bold){if(text==null){return 0;}
var option="";if(bold){option+="bold ";}
this.canvasContext.save();this.canvasContext.font=option+fontSize+"px "+font;var metrics=this.canvasContext.measureText(text);this.canvasContext.restore();return metrics.width;};prototype.computeTextWidthFull=function(text,fontFamily,fontSize,fontStyle){if(text==null){return 0;}
this.canvasContext.save();this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;var metrics=this.canvasContext.measureText(text);this.canvasContext.restore();return metrics.width;};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",implementation:{name:"Enum",arguments:["ChartOption.Implementation"]}},{});
var Layout=function(){this.areas={};};Layout=stjs.extend(Layout,null,[],function(constructor,prototype){constructor.Position=stjs.enumeration("LEFT","RIGHT","TOP","BOTTOM","CENTER","NONE");prototype.areas=null;prototype.currentWidth=0;prototype.currentHeight=0;prototype.getAreas=function(){return this.areas;};prototype.refresh=function(chartView,width,height){};prototype.init=function(styleModel){};prototype.updateTitleArea=function(newTitleHeight){};prototype.updateYAxis=function(){};},{areas:{name:"Map",arguments:[null,"Area"]}},{});
var DefaultLayout=function(){Layout.call(this);this.areasStyle={};this.areasBound={};this.titleHeight=null;this.currentFontSize=DefaultLayout.NORMAL_FONTS;};DefaultLayout=stjs.extend(DefaultLayout,Layout,[],function(constructor,prototype){constructor.DEFAULT_PADDING_PIXELS=3;constructor.TITLE_PADDING_BOTTOM=10;constructor.DEFAULT_LABEL_VALUE="55555";constructor.DEFAULT_PERCENT_LABEL_VALUE="-55.55%";constructor.NORMAL_FONTS="normal";constructor.SMALL_FONTS="small";constructor.MINIMUM_WIDTH_FOR_NORMAL_FONT=360;constructor.MINIMUM_HEIGHT_FOR_NORMAL_FONT=200;constructor.TITLE_AREA="titleAreaId";constructor.GRAPH_AREA="graphAreaId";constructor.X_AXIS_AREA="xAxisAreaId";constructor.Y1_AXIS_AREA="y1AxisAreaId";constructor.Y2_AXIS_AREA="y2AxisAreaId";constructor.LEGEND_AREA="legendAreaId";constructor.TOOLTIP_AREA="tooltipAreaId";prototype.areasStyle=null;prototype.areasBound=null;prototype.globalStyle=null;prototype.titleHeight=null;prototype.currentFontSize=null;prototype.init=function(styleModel){this.globalStyle=styleModel.getGlobalStyle();this.addArea(DefaultLayout.TITLE_AREA,ChartView.AreaType.TITLE,styleModel.getTitleStyle());this.addArea(DefaultLayout.Y1_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getY1AxisStyle());this.addArea(DefaultLayout.Y2_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getY2AxisStyle());this.addArea(DefaultLayout.X_AXIS_AREA,ChartView.AreaType.AXIS,styleModel.getXAxisStyle());this.addArea(DefaultLayout.GRAPH_AREA,ChartView.AreaType.GRAPH,styleModel.getGraphStyle());this.addArea(DefaultLayout.LEGEND_AREA,ChartView.AreaType.LEGEND,styleModel.getLegendStyle());this.addArea(DefaultLayout.TOOLTIP_AREA,ChartView.AreaType.TOOLTIP,styleModel.getTooltipStyle());};prototype.addArea=function(areaId,type,areaStyle){var bound=new AreaBound(0,0,0,0);var newArea=new Area(areaId,type,bound);this.areas[areaId]=newArea;this.areasStyle[areaId]=areaStyle;this.areasBound[areaId]=bound;};prototype.removeArea=function(areaId,areaStyle){delete this.areas[areaId];delete this.areasStyle[areaId];};prototype.updateTitleArea=function(newHeight){var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];var previousHeight=titleAreaBound.getHeight();if(newHeight>0){titleAreaBound.setHeight(newHeight);titleAreaBound.setVisible(true);}else{newHeight=0;titleAreaBound.setVisible(false);}
this.titleHeight=newHeight;var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var diff=newHeight-previousHeight;var newYStartPos=graphAreaBound.getTop()+diff;var newChartHeight=graphAreaBound.getHeight()-diff;graphAreaBound.setTop(newYStartPos);graphAreaBound.setHeight(newChartHeight);var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];y1AxisAreaBound.setTop(newYStartPos);y1AxisAreaBound.setHeight(newChartHeight);var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];y2AxisAreaBound.setTop(newYStartPos);y2AxisAreaBound.setHeight(newChartHeight);};prototype.updateYAxis=function(){var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var y1AreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];var y2AreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];var y1PreviousWidth=y1AreaBound.getWidth();var y2PreviousWidth=y2AreaBound.getWidth();var leftAxisNewWidth;var leftAxisPreviousWidth;var rightAxisNewWidth;var rightAxisPreviousWidth;var y1Left=true;var rightAxisOldLeft=0;var y1NewWidth=y1AxisStyle!=null?y1AxisStyle.getWidth(this.currentWidth):0;var y2NewWidth=y2AxisStyle!=null?y2AxisStyle.getWidth(this.currentWidth):0;var y1Pos=y1AxisStyle!=null?y1AxisStyle.getPosition():null;var y2Pos=y2AxisStyle!=null?y2AxisStyle.getPosition():null;if(y1Pos==null||y1Pos==Layout.Position.NONE||y1NewWidth==null||y1NewWidth<=0){y1NewWidth=0;y1AreaBound.setVisible(false);}else{y1AreaBound.setVisible(true);}
if(y2Pos==null||y2Pos==Layout.Position.NONE||y2NewWidth==null||y2NewWidth<=0){y2NewWidth=0;y2AreaBound.setVisible(false);}else{y2AreaBound.setVisible(true);}
if(y1Pos==Layout.Position.LEFT||y2Pos==Layout.Position.RIGHT){leftAxisNewWidth=y1NewWidth;leftAxisPreviousWidth=y1PreviousWidth;rightAxisNewWidth=y2NewWidth;rightAxisPreviousWidth=y2PreviousWidth;rightAxisOldLeft=y2AreaBound.getLeft();}else{rightAxisNewWidth=y1NewWidth;rightAxisPreviousWidth=y1PreviousWidth;leftAxisNewWidth=y2NewWidth;leftAxisPreviousWidth=y2PreviousWidth;y1Left=false;rightAxisOldLeft=y1AreaBound.getLeft();}
var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var leftAxisDiff=leftAxisNewWidth-leftAxisPreviousWidth;var newChartLeft=graphAreaBound.getLeft()+leftAxisDiff;var rightAxisDiff=rightAxisNewWidth-rightAxisPreviousWidth;var rightAxisNewLeft=rightAxisOldLeft-rightAxisDiff;var newChartWidth=graphAreaBound.getWidth()-leftAxisDiff-rightAxisDiff;graphAreaBound.setLeft(newChartLeft);graphAreaBound.setWidth(newChartWidth);var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];if(!y1Left){y1AxisAreaBound.setLeft(rightAxisNewLeft);}
y1AxisAreaBound.setWidth(y1NewWidth);var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];if(y1Left){y2AxisAreaBound.setLeft(rightAxisNewLeft);}
y2AxisAreaBound.setWidth(y2NewWidth);var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.setLeft(newChartLeft);titleAreaBound.setWidth(newChartWidth);var xAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAreaBound.setLeft(newChartLeft);xAreaBound.setWidth(newChartWidth);var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.setLeft(newChartLeft);legendAreaBound.setWidth(newChartWidth);};prototype.refresh=function(chartView,width,height){this.currentWidth=width;this.currentHeight=height;this.updateFontsSize(width,height);var chartXStartPos=0;var chartYStartPos=0;var chartWidth=width;var chartHeight=height;var titleHeight=0;var titleYStartPos=0;var xHeight=0;var xAxisYStartPos=0;var y1Width=0;var y1AxisXStartPos=0;var y2Width=0;var y2AxisXStartPos=0;var legendHeight=0;var legendYStartPos=0;var titlePaddingTop=0;var titlePaddingBottom=0;var xAxisPaddingTop=0;var xAxisPaddingBottom=0;var y1AxisPaddingLeft=0;var y1AxisPaddingRight=0;var y2AxisPaddingLeft=0;var y2AxisPaddingRight=0;var legendPaddingTop=0;var legendPaddingBottom=0;var globalMarginLeft=this.globalStyle.getMarginLeft(width);var globalMarginRight=this.globalStyle.getMarginRight(width);var globalMarginTop=this.globalStyle.getMarginTop(height);var globalMarginBottom=this.globalStyle.getMarginBottom(height);chartXStartPos+=globalMarginLeft;chartYStartPos+=globalMarginTop;chartWidth-=(globalMarginLeft+globalMarginRight);chartHeight-=(globalMarginTop+globalMarginBottom);var graphStyle=this.areasStyle[DefaultLayout.GRAPH_AREA];var titleStyle=this.areasStyle[DefaultLayout.TITLE_AREA];var legendStyle=this.areasStyle[DefaultLayout.LEGEND_AREA];var xAxisStyle=this.areasStyle[DefaultLayout.X_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var xAxisPosition=xAxisStyle.getPosition();var y1AxisPosition=y1AxisStyle.getPosition();var y2AxisPosition=y2AxisStyle.getPosition();if(titleStyle.isVisible()){titleHeight=this.titleHeight;if(this.titleHeight==null){titleHeight=titleStyle.getFontSize();if(titleStyle.isPopoverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,titleStyle.getZoomIconSize()));}}
titlePaddingTop=0;titlePaddingBottom=DefaultLayout.TITLE_PADDING_BOTTOM;var titleOuterHeight=(titleHeight+titlePaddingTop+titlePaddingBottom);titleYStartPos=chartYStartPos;chartHeight-=titleOuterHeight;chartYStartPos+=titleOuterHeight;}
if(legendStyle.isVisible()){legendHeight=legendStyle.getHeight(height);legendPaddingTop=legendStyle.getPaddingTop(height);legendPaddingBottom=legendStyle.getPaddingBottom(height);var legendOuterHeight=(legendHeight+legendPaddingTop+titlePaddingBottom);chartHeight-=legendOuterHeight;if(xAxisPosition==Layout.Position.TOP){legendYStartPos=chartYStartPos;chartYStartPos+=legendOuterHeight;}else if(xAxisPosition==Layout.Position.BOTTOM){legendYStartPos=chartYStartPos+chartHeight;}else{chartHeight+=legendOuterHeight;legendHeight=0;}}
if(xAxisPosition!=Layout.Position.NONE){xHeight=xAxisStyle.getFontSize();xAxisPaddingTop=xAxisStyle.getPaddingTop(chartHeight);xAxisPaddingBottom=xAxisStyle.getPaddingBottom(chartHeight);var xAxisOuterHeight=(xHeight+xAxisPaddingTop+xAxisPaddingBottom);var addSpaceForTicks=height>=DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT&&xAxisStyle.isShowAxisTicks();if(addSpaceForTicks){xAxisOuterHeight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartHeight-=xAxisOuterHeight;if(xAxisPosition==Layout.Position.TOP){var tmp=xAxisPaddingTop;xAxisPaddingTop=xAxisPaddingBottom;xAxisPaddingBottom=tmp;if(addSpaceForTicks){xAxisPaddingBottom+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
xAxisYStartPos=chartYStartPos;chartYStartPos+=xAxisOuterHeight;}else if(xAxisPosition==Layout.Position.BOTTOM){if(addSpaceForTicks){xAxisPaddingTop+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
xAxisYStartPos=chartYStartPos+chartHeight;}else{chartHeight+=xAxisOuterHeight;xHeight=0;}}
if(y1AxisPosition!=Layout.Position.NONE){var currentY1Width=y1AxisStyle.getWidth(width);if(currentY1Width==null){y1Width=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,y1AxisStyle.getFont(),y1AxisStyle.getFontSize(),false);}else{y1Width=currentY1Width;}
y1AxisPaddingLeft=DefaultLayout.DEFAULT_PADDING_PIXELS;y1AxisPaddingRight=DefaultLayout.DEFAULT_PADDING_PIXELS;var y1OuterWidth=y1Width+y1AxisPaddingLeft+y1AxisPaddingRight;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&y1AxisStyle.isShowAxisTicks();if(addSpaceForTicks){y1OuterWidth+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartWidth-=y1OuterWidth;if(y1AxisPosition==Layout.Position.LEFT){if(addSpaceForTicks){y1AxisPaddingRight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y1AxisXStartPos=chartXStartPos;chartXStartPos+=y1OuterWidth;}else if(y1AxisPosition==Layout.Position.RIGHT){if(addSpaceForTicks){y1AxisPaddingLeft+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y1AxisXStartPos=chartXStartPos+chartWidth;}else{chartWidth+=y1OuterWidth;y1Width=0;}}
if(y2AxisPosition!=Layout.Position.NONE&&y2AxisPosition!=y1AxisPosition){var currentY2Width=y2AxisStyle.getWidth(width);if(currentY2Width==null){y2Width=chartView.getLabelWidth(DefaultLayout.DEFAULT_PERCENT_LABEL_VALUE,y2AxisStyle.getFont(),y2AxisStyle.getFontSize(),false);}else{y2Width=currentY2Width;}
y2AxisPaddingLeft=DefaultLayout.DEFAULT_PADDING_PIXELS;y2AxisPaddingRight=DefaultLayout.DEFAULT_PADDING_PIXELS;var y2OuterWidth=y2Width+y2AxisPaddingLeft+y2AxisPaddingRight;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&y2AxisStyle.isShowAxisTicks();if(addSpaceForTicks){y2OuterWidth+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
chartWidth-=y2OuterWidth;if(y2AxisPosition==Layout.Position.LEFT){if(addSpaceForTicks){y2AxisPaddingRight+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y2AxisXStartPos=chartXStartPos;chartXStartPos+=y2OuterWidth;}else if(y2AxisPosition==Layout.Position.RIGHT){if(addSpaceForTicks){y2AxisPaddingLeft+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
y2AxisXStartPos=chartXStartPos+chartWidth;}else{chartWidth+=y2OuterWidth;y2Width=0;}}
var paddingLeft=graphStyle.getPaddingLeft(chartWidth);var paddingRight=graphStyle.getPaddingRight(chartWidth);var paddingTop=graphStyle.getPaddingTop(chartHeight);var paddingBottom=graphStyle.getPaddingBottom(chartHeight);chartWidth-=(paddingLeft+paddingRight);chartHeight-=(paddingTop+paddingBottom);var borderLeft=graphStyle.getBorderLeft();var borderRight=graphStyle.getBorderRight();var borderTop=graphStyle.getBorderTop();var borderBottom=graphStyle.getBorderBottom();chartWidth-=(borderLeft+borderRight);chartHeight-=(borderTop+borderBottom);var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];graphAreaBound.reset();graphAreaBound.setLeft(chartXStartPos);graphAreaBound.setTop(chartYStartPos);graphAreaBound.setWidth(chartWidth);graphAreaBound.setHeight(chartHeight);graphAreaBound.setPaddings(paddingLeft,paddingTop,paddingRight,paddingBottom);graphAreaBound.setMargins(globalMarginLeft,globalMarginTop,globalMarginRight,globalMarginBottom);graphAreaBound.setBorders(borderLeft,borderTop,borderRight,borderBottom);var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.reset();if(titleHeight>0){titleAreaBound.setLeft(chartXStartPos);titleAreaBound.setTop(titleYStartPos);titleAreaBound.setWidth(chartWidth);titleAreaBound.setHeight(titleHeight);titleAreaBound.setPaddingTop(titlePaddingTop);titleAreaBound.setPaddingBottom(titlePaddingBottom);titleAreaBound.setPaddingLeft(paddingLeft);titleAreaBound.setPaddingRight(paddingRight);titleAreaBound.setMarginLeft(borderLeft+globalMarginLeft);titleAreaBound.setMarginRight(borderRight+globalMarginRight);}
var xAxisAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAxisAreaBound.reset();if(xHeight>0){xAxisAreaBound.setLeft(chartXStartPos);xAxisAreaBound.setTop(xAxisYStartPos);xAxisAreaBound.setWidth(chartWidth);xAxisAreaBound.setHeight(xHeight);xAxisAreaBound.setPaddingTop(xAxisPaddingTop);xAxisAreaBound.setPaddingBottom(xAxisPaddingBottom);xAxisAreaBound.setPaddingLeft(paddingLeft);xAxisAreaBound.setPaddingRight(paddingRight);xAxisAreaBound.setMarginLeft(borderLeft+globalMarginLeft);xAxisAreaBound.setMarginRight(borderRight+globalMarginRight);}
var y1AxisAreaBound=this.areasBound[DefaultLayout.Y1_AXIS_AREA];y1AxisAreaBound.reset();y1AxisAreaBound.setLeft(y1AxisXStartPos);y1AxisAreaBound.setTop(chartYStartPos);y1AxisAreaBound.setWidth(y1Width);y1AxisAreaBound.setHeight(chartHeight);y1AxisAreaBound.setPaddingLeft(y1AxisPaddingLeft);y1AxisAreaBound.setPaddingRight(y1AxisPaddingRight);y1AxisAreaBound.setPaddingTop(paddingTop);y1AxisAreaBound.setPaddingBottom(paddingBottom);y1AxisAreaBound.setMarginTop(borderTop+globalMarginTop);y1AxisAreaBound.setMarginBottom(borderBottom+globalMarginBottom);if(y1Width<=0){y1AxisAreaBound.setVisible(false);}
var y2AxisAreaBound=this.areasBound[DefaultLayout.Y2_AXIS_AREA];y2AxisAreaBound.reset();y2AxisAreaBound.setLeft(y2AxisXStartPos);y2AxisAreaBound.setTop(chartYStartPos);y2AxisAreaBound.setWidth(y2Width);y2AxisAreaBound.setHeight(chartHeight);y2AxisAreaBound.setPaddingLeft(y2AxisPaddingLeft);y2AxisAreaBound.setPaddingRight(y2AxisPaddingRight);y2AxisAreaBound.setPaddingTop(paddingTop);y2AxisAreaBound.setPaddingBottom(paddingBottom);y2AxisAreaBound.setMarginTop(borderTop+globalMarginTop);y2AxisAreaBound.setMarginBottom(borderBottom+globalMarginBottom);if(y2Width<=0){y2AxisAreaBound.setVisible(false);}
var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.reset();if(legendHeight>0){legendAreaBound.setLeft(chartXStartPos);legendAreaBound.setTop(legendYStartPos);legendAreaBound.setWidth(chartWidth);legendAreaBound.setHeight(legendHeight);legendAreaBound.setPaddingTop(legendPaddingTop);legendAreaBound.setPaddingBottom(legendPaddingBottom);legendAreaBound.setPaddingLeft(paddingLeft);legendAreaBound.setPaddingRight(paddingRight);}};prototype.updateFontsSize=function(width,height){var titleStyle=this.areasStyle[DefaultLayout.TITLE_AREA];var xAxisStyle=this.areasStyle[DefaultLayout.X_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var legendStyle=this.areasStyle[DefaultLayout.LEGEND_AREA];if(width<DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT||height<DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT){if(this.currentFontSize!=DefaultLayout.SMALL_FONTS){this.currentFontSize=DefaultLayout.SMALL_FONTS;titleStyle.setFontSize(titleStyle.getFontSize()-1);titleStyle.setTitleFontSize(titleStyle.getTitleFontSize()-1);titleStyle.setValueFontSize(titleStyle.getValueFontSize()-1);titleStyle.setCopyrightFontSize(titleStyle.getCopyrightFontSize()-1);titleStyle.setZoomIconSize(titleStyle.getZoomIconSize());legendStyle.setFontSize(legendStyle.getFontSize()-1);legendStyle.setLabelsHeight(legendStyle.getLabelsHeight()-1);xAxisStyle.setFontSize(xAxisStyle.getFontSize()-1);xAxisStyle.setLabelsHeight(xAxisStyle.getLabelsHeight()-1);y1AxisStyle.setFontSize(y1AxisStyle.getFontSize()-1);y1AxisStyle.setLabelsHeight(y1AxisStyle.getLabelsHeight()-1);y2AxisStyle.setFontSize(y2AxisStyle.getFontSize()-1);y2AxisStyle.setLabelsHeight(y2AxisStyle.getLabelsHeight()-1);}}else{if(this.currentFontSize!=DefaultLayout.NORMAL_FONTS){this.currentFontSize=DefaultLayout.NORMAL_FONTS;titleStyle.setFontSize(titleStyle.getFontSize()+1);titleStyle.setTitleFontSize(titleStyle.getTitleFontSize()+1);titleStyle.setValueFontSize(titleStyle.getValueFontSize()+1);titleStyle.setCopyrightFontSize(titleStyle.getCopyrightFontSize()+1);titleStyle.setZoomIconSize(titleStyle.getZoomIconSize()+5);legendStyle.setFontSize(legendStyle.getFontSize()+1);legendStyle.setLabelsHeight(legendStyle.getLabelsHeight()+1);xAxisStyle.setFontSize(xAxisStyle.getFontSize()+1);xAxisStyle.setLabelsHeight(xAxisStyle.getLabelsHeight()+1);y1AxisStyle.setFontSize(y1AxisStyle.getFontSize()+1);y1AxisStyle.setLabelsHeight(y1AxisStyle.getLabelsHeight()+1);y2AxisStyle.setFontSize(y2AxisStyle.getFontSize()+1);y2AxisStyle.setLabelsHeight(y2AxisStyle.getLabelsHeight()+1);}}};},{areasStyle:{name:"Map",arguments:[null,"Style"]},areasBound:{name:"Map",arguments:[null,"AreaBound"]},globalStyle:"GlobalStyle",areas:{name:"Map",arguments:[null,"Area"]}},{});
stjs.ns("sq");sq.ChartElement=function(layer){this.id=this.createId();this.highlightMode=sq.ChartElement.HIGHLIGHT.NONE;this.hoverMode=sq.ChartElement.HOVER.NONE;this.layer=layer;};sq.ChartElement=stjs.extend(sq.ChartElement,null,[],function(constructor,prototype){constructor.ELEMENT_PREFIX="element";constructor.HIGHLIGHT=stjs.enumeration("NONE","CHANGE_COLOR","FISH_EYE","COLOR_FISH_EYE","CIRLCE");constructor.HOVER=stjs.enumeration("NONE","CHANGE_COLOR","FISH_EYE","COLOR_FISH_EYE","CIRCLE");prototype.layer=null;prototype.id=null;prototype.x=0;prototype.y=0;prototype.highlightMode=null;prototype.hoverMode=null;prototype.highlightColor=null;prototype.hoverColor=null;prototype.groupColor=null;prototype.highlightColorGradientParam=null;prototype.hoverColorGradientParam=null;prototype.groupColorGradientParam=null;prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){};prototype.copyFieldsTo=function(copyElement){if(copyElement==null){return;}
copyElement.highlightMode=this.highlightMode;copyElement.hoverMode=this.hoverMode;copyElement.highlightColor=this.highlightColor;copyElement.hoverColor=this.hoverColor;copyElement.groupColor=this.groupColor;if(this.highlightColorGradientParam!=null){copyElement.highlightColorGradientParam=SQW.$.extend([],this.highlightColorGradientParam);}
if(this.hoverColorGradientParam!=null){copyElement.hoverColorGradientParam=SQW.$.extend([],this.hoverColorGradientParam);}
if(this.groupColorGradientParam!=null){copyElement.groupColorGradientParam=SQW.$.extend([],this.groupColorGradientParam);}};prototype.getLayer=function(){return this.layer;};prototype.setLayer=function(layer){this.layer=layer;};prototype.getHighlightMode=function(){return this.highlightMode;};prototype.setHighlightMode=function(highlightMode){this.highlightMode=highlightMode;};prototype.getHoverMode=function(){return this.hoverMode;};prototype.setHoverMode=function(hoverMode){this.hoverMode=hoverMode;};prototype.getHighlightColor=function(){return this.highlightColor;};prototype.setHighlightColor=function(highlightColor){this.highlightColor=highlightColor;};prototype.getHoverColor=function(){return this.hoverColor;};prototype.setHoverColor=function(hoverColor){this.hoverColor=hoverColor;};prototype.getGroupColor=function(){return this.groupColor;};prototype.setGroupColor=function(groupColor){this.groupColor=groupColor;};prototype.getHighlightColorGradientParam=function(){return this.highlightColorGradientParam;};prototype.setHighlightColorGradientParam=function(highlightColorGradientParam){this.highlightColorGradientParam=highlightColorGradientParam;};prototype.getHoverColorGradientParam=function(){return this.hoverColorGradientParam;};prototype.setHoverColorGradientParam=function(hoverColorGradientParam){this.hoverColorGradientParam=hoverColorGradientParam;};prototype.getGroupColorGradientParam=function(){return this.groupColorGradientParam;};prototype.setGroupColorGradientParam=function(groupColorGradientParam){this.groupColorGradientParam=groupColorGradientParam;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.createId=function(){return sq.ChartElement.ELEMENT_PREFIX+new Date().getTime()+"_"+Math.round((Math.random()*100000));};prototype.isInside=function(offsetX,offsetY){};prototype.getLayerId=function(){return this.layer!=null?this.layer.getId():null;};prototype.getX=function(){return this.x;};prototype.setX=function(x){this.x=x;};prototype.getY=function(){return this.y;};prototype.setY=function(y){this.y=y;};},{highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ToolTipComponent=function(layer){sq.ChartElement.call(this,layer);this.data=[];this.formatter=new AbbreviateNumberFormatter();};ToolTipComponent=stjs.extend(ToolTipComponent,sq.ChartElement,[],function(constructor,prototype){constructor.ID="id";constructor.CLASS="class";constructor.NAME="name";constructor.VALUE="value";constructor.NAME_STYLE="name_style";constructor.VALUE_STYLE="value_style";constructor.ELEMENT_STYLE="element_style";constructor.CLASS_STYLE="class_style";prototype.longestValue=null;prototype.longestName=null;prototype.data=null;prototype.header=null;prototype.style=null;prototype.parent=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParam=null;prototype.formatter=null;prototype.fontFamily=null;prototype.fontSize=0;prototype.fontStyle=null;prototype.fontColor=null;prototype.width=0;prototype.height=0;prototype.ySpace=0;prototype.xSpace=0;prototype.nameWidth=0;prototype.valueWidth=0;prototype.init=function(layer,parent,x,y,width,height){this.layer=layer;this.parent=parent;this.x=x;this.y=y;this.width=width;this.height=height;this.backgroundColor=this.style.getBackgroundColor();this.backgroundColorGradientParam=this.style.getBackgroundColorGradientParams();};prototype.parseData=function(){if(this.parent==null){return;}
var res=[];var rawData=this.parent.getData();for(var key in rawData){var e=new ToolTipRow();e.setName(key);var value=rawData[key];var formattedValue=value.toString();if(stjs.isInstanceOf(value.constructor,Double)){formattedValue=this.formatter.format(value);}
e.setValue(formattedValue);res.push(e);}
this.setData(res);};prototype.configStyle=function(style){this.style=style;var nameStyle=this.style.getNameStyle();var valueStyle=this.style.getValueStyle();for(var i=0;i<this.data.length;i++){var e=this.data[i];e.setNameStyle(nameStyle);e.setValueStyle(valueStyle);}
if(this.header!=null){this.style.customeHeaderStyle(this.header);}
this.style.customElementStyle(this.data);};prototype.calFontStyle=function(style,fontStyles){if(style==null||fontStyles==null||fontStyles.length!=4){return;}
var defaultFontFamily=fontStyles[0];var defaultFontStyle=fontStyles[1];var defaultFontSize=fontStyles[2];var defaultFontColor=fontStyles[3];fontStyles[0]=style["fontFamily"]!=null?style["fontFamily"]:defaultFontFamily;fontStyles[1]=style["fontSize"]!=null?style["fontSize"]:defaultFontStyle;fontStyles[2]=style["fontStyle"]!=null?style["fontStyle"]:defaultFontSize;fontStyles[3]=style["fontColor"]!=null?style["fontColor"]:defaultFontColor;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getParent=function(){return this.parent;};prototype.setParent=function(parent){this.parent=parent;};prototype.getLongestValue=function(){return this.longestValue;};prototype.setLongestValue=function(longestValue){this.longestValue=longestValue;};prototype.getLongestName=function(){return this.longestName;};prototype.setLongestName=function(longestName){this.longestName=longestName;};prototype.getStyle=function(){return this.style;};prototype.setStyle=function(style){this.style=style;};prototype.getHeader=function(){return this.header;};prototype.setHeader=function(header){this.header=header;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParam=function(){return this.backgroundColorGradientParam;};prototype.setBackgroundColorGradientParam=function(backgroundColorGradientParam){this.backgroundColorGradientParam=backgroundColorGradientParam;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getySpace=function(){return this.ySpace;};prototype.setySpace=function(ySpace){this.ySpace=ySpace;};prototype.getxSpace=function(){return this.xSpace;};prototype.setxSpace=function(xSpace){this.xSpace=xSpace;};prototype.getNameWidth=function(){return this.nameWidth;};prototype.setNameWidth=function(nameWidth){this.nameWidth=nameWidth;};prototype.getValueWidth=function(){return this.valueWidth;};prototype.setValueWidth=function(valueWidth){this.valueWidth=valueWidth;};prototype.getFontFamily=function(){return this.fontFamily;};prototype.setFontFamily=function(fontFamily){this.fontFamily=fontFamily;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.getFontStyle=function(){return this.fontStyle;};prototype.setFontStyle=function(fontStyle){this.fontStyle=fontStyle;};prototype.getFontColor=function(){return this.fontColor;};prototype.setFontColor=function(fontColor){this.fontColor=fontColor;};},{data:{name:"Array",arguments:["ToolTipRow"]},header:"ToolTipRow",style:"ToolTipStyle",parent:"Shape",backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},formatter:"AbbreviateNumberFormatter",fontColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasToolTip=function(){ToolTipComponent.call(this,null);};CanvasToolTip=stjs.extend(CanvasToolTip,ToolTipComponent,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.init=function(layer,parent,x,y,width,height){ToolTipComponent.prototype.init.call(this,layer,parent,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};prototype.clear=function(){this.canvasContext.clearRect(this.x,this.y,this.width,this.height);};prototype.render=function(){var data=this.getData();if(data==null||data.length==0){return;}
this.canvasContext.save();this.canvasContext.beginPath();var previousFillStyle=this.canvasContext.fillStyle;if(this.backgroundColor!=null){this.backgroundColor.applyColorToFillStyle(this.canvasContext,this.backgroundColorGradientParam);this.canvasContext.fillRect(this.x,this.y,this.width,this.height);}
this.canvasContext.fillStyle=previousFillStyle;var fontFamily=this.getFontFamily();var fontSize=this.getFontSize();var fontStyle=this.getFontStyle();var fontColor=this.getFontColor();var fontStyles=[fontFamily,fontSize,fontStyle,fontColor];this.calFontStyle(this.style.getStyle(),fontStyles);var defaultFontFamily=fontStyles[0];var defaultFontSize=fontStyles[1];var defaultFontStyle=fontStyles[2];var defaultFontColor=fontStyles[3];this.canvasContext.translate(this.x,this.y+fontSize);defaultFontColor.applyColorToFillStyle(this.canvasContext,null);for(var i=0;i<data.length;i++){var te=data[i];this.calFontStyle(te.getNameStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;this.canvasContext.fillText(te.name,0,0,this.nameWidth);fontStyles=[defaultFontFamily,defaultFontSize,defaultFontStyle,defaultFontColor];this.calFontStyle(te.getValueStyle(),fontStyles);fontFamily=fontStyles[0];fontSize=fontStyles[1];fontStyle=fontStyles[2];this.canvasContext.font=fontStyle+" "+fontSize+"px "+fontFamily;this.canvasContext.fillText(te.value,this.xSpace,0,this.valueWidth);this.canvasContext.translate(0,this.ySpace);}
this.canvasContext.restore();};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){return null;};prototype.isInside=function(offsetX,offsetY){return false;};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",data:{name:"Array",arguments:["ToolTipRow"]},header:"ToolTipRow",style:"ToolTipStyle",parent:"Shape",backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},formatter:"AbbreviateNumberFormatter",fontColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ToolTipRow=function(){this.nameStyle={};this.valueStyle={};};ToolTipRow=stjs.extend(ToolTipRow,null,[],function(constructor,prototype){prototype.id=null;prototype.name=null;prototype.value=null;prototype.nameStyle=null;prototype.valueStyle=null;prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getValue=function(){return this.value;};prototype.setValue=function(value){this.value=value;};prototype.getNameStyle=function(){return this.nameStyle;};prototype.setNameStyle=function(nameStyle){this.nameStyle=nameStyle;};prototype.getValueStyle=function(){return this.valueStyle;};prototype.setValueStyle=function(valueStyle){this.valueStyle=valueStyle;};},{nameStyle:{name:"Map",arguments:[null,"Object"]},valueStyle:{name:"Map",arguments:[null,"Object"]}},{});
var Label=function(layer,value,text,x,y,width,height){sq.ChartElement.call(this,layer);this.value=value;this.text=text;this.x=x;this.y=y;this.width=width;this.height=height;this.bold=false;this.color=ChartColor.black;this.font="Arial";this.fontSize=12;this.align=Label.ALIGN_LEFT;this.baseline=null;this.backgroundColor=ChartColor.transparent;};Label=stjs.extend(Label,sq.ChartElement,[],function(constructor,prototype){constructor.ALIGN_LEFT="left";constructor.ALIGN_CENTER="center";constructor.ALIGN_RIGHT="right";constructor.BASELINE_TOP="top";constructor.BASELINE_MIDDLE="middle";constructor.BASELINE_BOTTOM="bottom";prototype.value=null;prototype.fontSize=0;prototype.font=null;prototype.bold=false;prototype.text=null;prototype.color=null;prototype.textColor=null;prototype.colorGradientParam=null;prototype.backgroundColor=null;prototype.backgroundColorGradientParam=null;prototype.width=0;prototype.height=0;prototype.lineHeight=0;prototype.align=null;prototype.baseline=null;prototype.toString=function(){return this.text;};prototype.getValue=function(){return this.value;};prototype.setValue=function(value){this.value=value;};prototype.setFormattedValue=function(formattedValue){this.text=formattedValue;};prototype.isBold=function(){return this.bold;};prototype.getAlign=function(){return this.align;};prototype.setAlign=function(align){this.align=align;};prototype.getBaseline=function(){return this.baseline;};prototype.setBaseline=function(baseline){this.baseline=baseline;};prototype.getFont=function(){return this.font;};prototype.setFont=function(font){this.font=font;};prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getColorGradientParam=function(){return this.colorGradientParam;};prototype.setColorGradientParam=function(colorGradientParam){this.colorGradientParam=colorGradientParam;};prototype.getFontSize=function(){return this.fontSize;};prototype.setFontSize=function(fontSize){this.fontSize=fontSize;};prototype.setBold=function(bold){this.bold=bold;};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getLineHeight=function(){return this.lineHeight;};prototype.setLineHeight=function(lineHeight){this.lineHeight=lineHeight;};prototype.getText=function(){return this.text;};prototype.setText=function(text){this.text=text;};prototype.getBackgroundColor=function(){return this.backgroundColor;};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.getBackgroundColorGradientParam=function(){return this.backgroundColorGradientParam;};prototype.setBackgroundColorGradientParam=function(backgroundColorGradientParam){this.backgroundColorGradientParam=backgroundColorGradientParam;};prototype.getLeftPos=function(){if(this.align==Label.ALIGN_LEFT){return this.x;}else if(this.align==Label.ALIGN_CENTER){return this.x-stjs.trunc(Math.round(this.width/2.0));}else if(this.align==Label.ALIGN_RIGHT){return this.x-this.width;}else{return this.x;}};prototype.getTopPos=function(){if(this.baseline==Label.BASELINE_TOP){return this.y;}else if(this.baseline==Label.BASELINE_MIDDLE){return this.y-stjs.trunc(Math.round(this.height/2.0));}else if(this.baseline==Label.BASELINE_BOTTOM){return this.y-this.height;}else{return this.y-this.fontSize;}};prototype.copyTo=function(layer){};prototype.copyFieldsTo=function(copyElement){var otherLabel=copyElement;sq.ChartElement.prototype.copyFieldsTo.call(this,otherLabel);otherLabel.value=this.value;otherLabel.text=this.text;otherLabel.x=this.x;otherLabel.y=this.y;otherLabel.width=this.width;otherLabel.height=this.height;otherLabel.bold=this.bold;otherLabel.color=this.color;if(this.colorGradientParam!=null){otherLabel.colorGradientParam=SQW.$.extend([],this.colorGradientParam);}
otherLabel.font=this.font;otherLabel.fontSize=this.fontSize;otherLabel.align=this.align;otherLabel.baseline=this.baseline;otherLabel.backgroundColor=this.backgroundColor;if(this.backgroundColorGradientParam!=null){otherLabel.backgroundColorGradientParam=SQW.$.extend([],this.colorGradientParam);}};},{color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasLabel=function(layer,value,text,x,y,width,height){Label.call(this,layer,value,text,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasLabel=stjs.extend(CanvasLabel,Label,[],function(constructor,prototype){constructor.BOLD_OPTION="bold ";prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.clearRect(this.x,this.y,this.width,this.height);};prototype.render=function(){if(this.text==null){return;}
this.canvasContext.save();this.canvasContext.beginPath();var previousFillStyle=this.canvasContext.fillStyle;if(this.backgroundColor!=null){this.backgroundColor.applyColorToFillStyle(this.canvasContext,this.backgroundColorGradientParam);this.canvasContext.fillRect(this.getLeftPos(),this.getTopPos(),this.width,this.height);}
this.canvasContext.fillStyle=previousFillStyle;if(this.color!=null){this.color.applyColorToFillStyle(this.canvasContext,this.colorGradientParam);}
if(this.align!=null){this.canvasContext.textAlign=this.align;}
if(this.baseline!=null){this.canvasContext.textBaseline=this.baseline;}
this.canvasContext.beginPath();if(this.textColor!=null){this.textColor.applyColorToFillStyle(this.canvasContext,null);}
this.canvasContext.font=this.getFontParam();if(this.text.contains(InteractiveTextArea.CUSTOM_NEWLINE_SYMBOL)){this.fillMultilineText();}else{this.canvasContext.fillText(this.text,this.x,this.y,this.width);}
this.canvasContext.restore();};prototype.fillMultilineText=function(){var lines=(this.text).split(InteractiveTextArea.CUSTOM_NEWLINE_SYMBOL);var textTopPosition=stjs.trunc(Math.round(this.y-this.height/2.0+this.lineHeight/2.0))+1;for(var i=0;i<lines.length;i++){this.canvasContext.fillText(lines[i],this.x,textTopPosition+(i*this.lineHeight),this.width);}};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:this.canvasContext.save();if(this.highlightColor!=null){this.highlightColor.applyColorToFillStyle(this.canvasContext,this.highlightColorGradientParam);}
if(this.align!=null){this.canvasContext.textAlign=this.align;}
if(this.baseline!=null){this.canvasContext.textBaseline=this.baseline;}
this.canvasContext.font=this.getFontParam();this.canvasContext.fillText(this.text,this.x,this.y,this.width);this.canvasContext.restore();break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){this.clear();};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.getFontParam=function(){var option="";if(this.bold){option+=CanvasLabel.BOLD_OPTION;}
return option+this.fontSize+"px "+this.font;};prototype.copyTo=function(layer){var copy=new CanvasLabel(layer,this.value,this.text,this.x,this.y,this.width,this.height);this.copyFieldsTo(copy);return copy;};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var EditableCanvasLabel=function(layer,value,text,x,y,width,height){CanvasLabel.call(this,layer,value,text,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();this.borderColor=ChartColor.black;};EditableCanvasLabel=stjs.extend(EditableCanvasLabel,CanvasLabel,[],function(constructor,prototype){constructor.SELECTION_INDICATOR_SIZE=5;constructor.SELECTION_INDICATOR_SPACE=2;constructor.REFERENCE_POINT_SIZE=2;constructor.BORDER_WIDTH=1;constructor.HALF_PIXEL_CANVAS_START=0.5;prototype.hovered=false;prototype.selected=false;prototype.borderColor=null;prototype.clear=function(){CanvasLabel.prototype.clear.call(this);};prototype.render=function(){CanvasLabel.prototype.render.call(this);if(this.hovered){this.drawSelection(0.3);}else if(this.selected){this.drawSelection(1.0);}};prototype.drawSelection=function(alpha){var leftPos=this.getLeftPos()+EditableCanvasLabel.HALF_PIXEL_CANVAS_START;var topPos=this.getTopPos()-EditableCanvasLabel.HALF_PIXEL_CANVAS_START;this.drawSelectionIndicators(leftPos,topPos,EditableCanvasLabel.SELECTION_INDICATOR_SIZE,alpha);this.drawSpaceBeforeSelectionIndicators(leftPos,topPos,EditableCanvasLabel.SELECTION_INDICATOR_SPACE);this.drawReferencePoint(leftPos+stjs.trunc(this.width/2),topPos+stjs.trunc(this.height/2),EditableCanvasLabel.REFERENCE_POINT_SIZE,alpha);};prototype.drawSelectionIndicators=function(leftPos,topPos,size,alpha){this.canvasContext.beginPath();this.canvasContext.strokeStyle=this.getBorderColor().getChartColorWithAlpha(alpha).getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,this.width,this.height,size);this.canvasContext.stroke();};prototype.drawSpaceBeforeSelectionIndicators=function(leftPos,topPos,size){this.canvasContext.beginPath();this.canvasContext.strokeStyle=ChartColor.white.getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,this.width,this.height,EditableCanvasLabel.SELECTION_INDICATOR_SPACE);this.canvasContext.stroke();};prototype.drawReferencePoint=function(leftPos,topPos,size,alpha){this.canvasContext.beginPath();this.canvasContext.strokeStyle=this.getBorderColor().getChartColorWithAlpha(alpha).getFlatColor();this.canvasContext.lineWidth=EditableCanvasLabel.BORDER_WIDTH;this.drawCrossLines(leftPos,topPos,0,0,size);this.canvasContext.stroke();};prototype.drawCrossLines=function(leftPos,topPos,width,height,size){this.drawLine(leftPos,topPos,0,-size);this.drawLine(leftPos,topPos,-size,0);this.drawLine(leftPos+width,topPos,0,-size);this.drawLine(leftPos+width,topPos,size,0);this.drawLine(leftPos,topPos+height,0,size);this.drawLine(leftPos,topPos+height,-size,0);this.drawLine(leftPos+width,topPos+height,size,0);this.drawLine(leftPos+width,topPos+height,0,size);};prototype.drawLine=function(startingPositionX,startingPositionY,offsetX,offsetY){this.canvasContext.moveTo(startingPositionX,startingPositionY);this.canvasContext.lineTo(startingPositionX+offsetX,startingPositionY+offsetY);};prototype.getBorderColor=function(){return this.borderColor;};prototype.setBorderColor=function(borderColor){this.borderColor=borderColor;};prototype.setHovered=function(hovered){this.hovered=hovered;};prototype.setSelected=function(selected){this.selected=selected;};},{borderColor:"ChartColor",canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",color:"ChartColor",textColor:"ChartColor",colorGradientParam:{name:"Array",arguments:[null]},backgroundColor:"ChartColor",backgroundColorGradientParam:{name:"Array",arguments:[null]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var LoadingIndicator=function(){this.loaded=false;this.pending=[];this.loadingImage=window.document.createElement("img");this.loadingImage.width=LoadingIndicator.WIDTH;this.loadingImage.height=LoadingIndicator.HEIGHT;this.loadingImage.onload=LoadingIndicator.getOnLoadCallback();this.loadingImage.src=LoadingIndicator.IMAGE_SRC;};LoadingIndicator=stjs.extend(LoadingIndicator,null,[],function(constructor,prototype){constructor.WIDTH=26;constructor.HEIGHT=26;constructor.IMAGE_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94FDA86ESKTXoEAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAE4ElEQVRIx52WTYhfVxnGf79z73xn0qRJP0wRm4A2NCIVBLXgUkRQcCMIFtpKcW4KXRgVFXfiQhCKLuxMrG5EFyJid4J2a0FQUIgftVGINMFpJNpMJjOZ+d/zuLj3P5kMcZMDF+7HOed53+d9nvNe+06SCKIEIImllJTVymQF1SahVQ4BS8AEuJ5kV+2BSZKoAA5bRBU1SbDvbJKgkgQAtSaZUQ8Dp5KcVE8BRwKLwvIIeBX4O/C7JH9pz/PW7uehlAERKEAF4mSFMqIGoD0Pfef9hFPIu4D7kiyo88BiYIlkCTikLgNHkhxW/5Tkl03T/NyX+r6eLSWJSQagvrMkSSklzs1Rt7cfAd5JcgydAw4lmW56OMmyugTMT68ki8ARdUZ9Dfh6Wa1X+84GqEmyR91I2YNJTgBLygK4lOS+kYZ1YF3dTTKvvhv4AHAmyTwwX0pZzpDtH5N07Xku991Al31nAQIsJ3mHujjcs6QU9eJkUv82+/IglBtPw8KCqpTVmnq2vBc4l+RMkuUhSO9XX0nyfK3ZUCijCNpxQsbog/wXeLWs1tebxjJZgb7ThQX3VNV3NmW1Xiir9XPqL9SJg/RqrfU08OjM90GlDNJmflQISRrgGsnvy/Hjt8YaMko3I8jefd9Z+s5SVuu3IC8DW0DUP6v/GgPHvrMFDgMLwCFgLskb6q1RmtNgsrdoVO+oVgGT9KOHnlSX1b/u7tZLbTsE2O7zzVT3l9XtMTvU7KP0jlFrnZp0cCdJs8ZvxmTpO23WkskKOFmhVQ8BS6N6Lrfn2e5XJOy5myR7hj6Y2YERh1Snx0MLpPX2bKd09d34zJ0ABze+G/D4zrEUS8Buko32QDT96OT9deD/jbt8myLPAg8DO0l2VNoD0Tlmxj2OqWgC9PtrWw5wu6X2Bym5R8D9e9OOvtgGNoB+38R7R9EmyQywM2WrqJNSyrbaqzRrg6RzZ9GT2zYiZFidWZifhdkEhkstSQ5DyqgkaAul1moSm7WQZLnvPAUstmvTRjZ2RRhXjRUQ3TmZ8v7PxOPPKF9QPmySWeABaKrOCsv42LHevhuy6DtPAF9N8gRwUfhSc55rffcQ8pzkJOHbhNcDDGU+Q8p/rpm3trCegPyM6lOPw2RBZjdkbgtOXWPylc0yrUeSJ5O8oL5P/Xjgh3m+OdqsrSMfQj+iPsrgX0MBLs2Sq9+hvPRINo5/LPGpJ8BjQKVAbW9Oqhdv0Tw+ND2AUspV9cpYkh31dK31p/Vs+aBrnwy8p4ZdEihNA5jmxR3K976RScfRpX//+qPJ5EFSAzXUXaTecPGbE9jBSSft2kD9ZIUvA+fUXXWj1roFbImvycwrsb6RTLbVOsr3WJLHlIdJcxNzI+SGsImuM//Cetl+Nsl3q303uLNZGzLrO88leVadS/K2ujl1OLCpro/vS5JN8LpyHdhMsqluMNteZufTb5brP+nztaepP/jRbVPtA3xR/SLwW3UBmBl/r24CN9VmDGJH3FF7aYs0MzKzhc0/yo1n/lmy1qf9MVz4LOYod5x10/7erOVX9Wz5Q5IzwKeA02MH3h3r1wBtkjlhB3JFFi7o8rqrV27UlQfUCS5+Al49Qtqh8Xm3E7kMpnU8IBeAk8DJ8dfrFrARckl8E7glD+1WtjDbYD/20Iyifpv/AduF5ayNsaqtAAAAAElFTkSuQmCC";constructor.instance=null;prototype.loaded=false;prototype.loadingImage=null;prototype.pending=null;constructor.getOnLoadCallback=function(){return function(p1){LoadingIndicator.getInstance().loaded=true;var pendingCallback=LoadingIndicator.getInstance().pending.pop();while(pendingCallback!=null){pendingCallback(LoadingIndicator.getInstance().loadingImage);pendingCallback=LoadingIndicator.getInstance().pending.pop();}};};constructor.getInstance=function(){if(LoadingIndicator.instance==null){LoadingIndicator.instance=new LoadingIndicator();}
return LoadingIndicator.instance;};constructor.getLoadingImage=function(callback){if(!LoadingIndicator.getInstance().loaded){LoadingIndicator.getInstance().pending.push(callback);}else{callback(LoadingIndicator.getInstance().loadingImage);}};},{instance:"LoadingIndicator",loadingImage:"Image",pending:{name:"Array",arguments:[{name:"Callback1",arguments:["Image"]}]}},{});
var ChartIcon=function(layer,x,y,width,height,iconType){sq.ChartElement.call(this,layer);this.x=x;this.y=y;this.width=width;this.height=height;this.iconType=iconType;};ChartIcon=stjs.extend(ChartIcon,sq.ChartElement,[],function(constructor,prototype){constructor.ENLARGE_ICON="enlargeIcon";prototype.iconType=null;prototype.width=0;prototype.height=0;prototype.backgroundColor=null;prototype.copyTo=function(layer){};prototype.setBackgroundColor=function(backgroundColor){this.backgroundColor=backgroundColor;};prototype.setId=function(id){this.id=id;};prototype.getIconType=function(){return this.iconType;};prototype.setIconType=function(iconType){this.iconType=iconType;};},{backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasIcon=function(layer,x,y,width,height,iconType){ChartIcon.call(this,layer,x,y,width,height,iconType);this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasIcon=stjs.extend(CanvasIcon,ChartIcon,[],function(constructor,prototype){prototype.canvasContext=null;constructor.IMAGES_ROOT="/sqw-components/images/chart/";prototype.drawImage=function(imageName,x,y){var image=window.document.createElement("img");image.width=this.width;image.height=this.height;image.src=this.getContextPath()+CanvasIcon.IMAGES_ROOT+imageName;var that=this;image.onload=function(e){that.canvasContext.drawImage(image,x,y);};};prototype.getContextPath=function(){return window.location.pathname.substring(0,window.location.pathname.indexOf("/",2));};prototype.clear=function(){this.canvasContext.save();this.canvasContext.transform(1,0,0,1,0.5,0.5);this.canvasContext.clearRect(this.x,this.y,this.width,this.height);this.canvasContext.restore();};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){this.render();};prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};prototype.copyTo=function(layer){var copy=CanvasIcon.createIcon(layer,this.x,this.y,this.width,this.height,this.iconType);this.copyFieldsTo(copy);return copy;};constructor.createIcon=function(layer,x,y,width,height,iconType){if(iconType==ChartIcon.ENLARGE_ICON){return new CanvasEnlargeIcon(layer,x,y,width,height);}
return null;};},{canvasContext:"CanvasRenderingContext2D",backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasEnlargeIcon=function(layer,x,y,width,height){CanvasIcon.call(this,layer,x,y,width,height,ChartIcon.ENLARGE_ICON);this.drawImage(CanvasEnlargeIcon.ICON_NAME,x,y);};CanvasEnlargeIcon=stjs.extend(CanvasEnlargeIcon,CanvasIcon,[],function(constructor,prototype){constructor.ICON_NAME="enlarge.png";},{canvasContext:"CanvasRenderingContext2D",backgroundColor:"ChartColor",highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Shape=function(layer,x,y){sq.ChartElement.call(this,layer);this.x=x;this.y=y;this.fillColor=ChartColor.black;this.strokeColor=ChartColor.black;this.highlightColor=ChartColor.orange;this.hoverColor=ChartColor.orange;this.groupColor=ChartColor.black;};Shape=stjs.extend(Shape,sq.ChartElement,[],function(constructor,prototype){prototype.width=0;prototype.height=0;prototype.fillShape=false;prototype.strokeShape=false;prototype.highlighted=false;prototype.grouped=false;prototype.fillColor=null;prototype.strokeColor=null;prototype.fillColorGradientParam=null;prototype.strokeColorGradientParam=null;prototype.data=null;prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.customRender=function(){};prototype.reset=function(){this.clear();this.render();};prototype.getWidth=function(){return this.width;};prototype.setWidth=function(width){this.width=width;};prototype.getHeight=function(){return this.height;};prototype.setHeight=function(height){this.height=height;};prototype.getData=function(){return this.data;};prototype.setData=function(data){this.data=data;};prototype.getHighlightMode=function(){return this.highlightMode;};prototype.setHighlightMode=function(highlightMode){this.highlightMode=highlightMode;};prototype.getHoverMode=function(){return this.hoverMode;};prototype.setHoverMode=function(hoverMode){this.hoverMode=hoverMode;};prototype.isFillShape=function(){return this.fillShape;};prototype.setFillShape=function(fillShape){this.fillShape=fillShape;};prototype.isStrokeShape=function(){return this.strokeShape;};prototype.setStrokeShape=function(strokeShape){this.strokeShape=strokeShape;};prototype.getFillColor=function(){return this.fillColor;};prototype.setFillColor=function(fillColor){this.fillColor=fillColor;};prototype.getStrokeColor=function(){return this.strokeColor;};prototype.setStrokeColor=function(strokeColor){this.strokeColor=strokeColor;};prototype.getFillColorGradientParam=function(){return this.fillColorGradientParam;};prototype.setFillColorGradientParam=function(fillColorGradientParam){this.fillColorGradientParam=fillColorGradientParam;};prototype.getStrokeColorGradientParam=function(){return this.strokeColorGradientParam;};prototype.setStrokeColorGradientParam=function(strokeColorGradientParam){this.strokeColorGradientParam=strokeColorGradientParam;};prototype.getHighlightColorGradientParam=function(){return this.highlightColorGradientParam;};prototype.setHighlightColorGradientParam=function(highlightColorGradientParam){this.highlightColorGradientParam=highlightColorGradientParam;};prototype.getHoverColorGradientParam=function(){return this.hoverColorGradientParam;};prototype.setHoverColorGradientParam=function(hoverColorGradientParam){this.hoverColorGradientParam=hoverColorGradientParam;};prototype.isHighlighted=function(){return this.highlighted;};prototype.setHighlighted=function(highlighted){this.highlighted=highlighted;this.data["highlighted"]=highlighted;};prototype.isGrouped=function(){return this.grouped;};prototype.setGrouped=function(grouped){this.grouped=grouped;this.data["grouped"]=grouped;};prototype.calDistance=function(x,y){var currentPoint=new Point2D(x,y);var currentShapePoint=new Point2D(this.x,this.y);return currentPoint.distanceTo(currentShapePoint);};prototype.calDistanceY=function(y){var currentPoint=new Point2D(0,y);var currentShapePoint=new Point2D(0,this.y+this.height);return currentPoint.distanceTo(currentShapePoint);};},{fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Line=function(layer,x1,y1,x2,y2,width){Shape.call(this,layer,x1,y1);this.startPoint=new Point2D(x1,y1);this.endPoint=new Point2D(x2,y2);this.width=width;this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.dashValues=Line.DEFAULT_DASH_VALUES;};Line=stjs.extend(Line,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.startPoint=null;prototype.endPoint=null;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.getStartPoint=function(){return this.startPoint;};prototype.getEndPoint=function(){return this.endPoint;};prototype.setStartPoint=function(start){if(start==null){this.startPoint=null;}else{this.startPoint=start.getClone();}};prototype.setEndPoint=function(end){if(end==null){this.endPoint=null;}else{this.endPoint=end.getClone();}};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isInside=function(x,y){return false;};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},startPoint:"Point2D",endPoint:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Rect=function(layer,x,y,width,height){Shape.call(this,layer,x,y);this.width=width;this.height=height;this.fillShape=true;this.strokeShape=false;this.lineWidth=1;};Rect=stjs.extend(Rect,Shape,[],function(constructor,prototype){prototype.highlightRectWidth=0;prototype.hoverRectWidth=0;prototype.groupRectWidth=0;prototype.lineWidth=0;prototype.isInside=function(x,y){if(x!=null&&y!=null&&x>=this.x&&y>=this.y&&x<(this.x+this.width)&&y<(this.y+this.height)){return true;}else{return false;}};prototype.getHighlightRectWidth=function(){return this.highlightRectWidth;};prototype.setHighlightRectWidth=function(highlightRectWidth){this.highlightRectWidth=highlightRectWidth;};prototype.getHoverRectWidth=function(){return this.hoverRectWidth;};prototype.setHoverRectWidth=function(hoverRectWidth){this.hoverRectWidth=hoverRectWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getGroupRectWidth=function(){return this.groupRectWidth;};prototype.setGroupRectWidth=function(groupRectWidth){this.groupRectWidth=groupRectWidth;};},{fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Circle=function(layer,x,y,radius){Shape.call(this,layer,x,y);this.radius=radius;this.radiusSquare=radius*radius;this.width=stjs.trunc(Math.round(2*radius));this.height=this.width;this.startAngle=0.0;this.endAngle=2*Math.PI;this.strokeShape=true;this.fillShape=false;this.lineWidth=1;};Circle=stjs.extend(Circle,Shape,[],function(constructor,prototype){prototype.radius=0.0;prototype.radiusSquare=0.0;prototype.startAngle=0.0;prototype.endAngle=0.0;prototype.bounds=null;prototype.lineWidth=0;prototype.getRadius=function(){return this.radius;};prototype.setRadius=function(radius){this.radius=radius;this.radiusSquare=radius*radius;this.width=stjs.trunc(Math.round(2*radius));this.height=this.width;};prototype.setWidth=function(width){this.width=width;this.height=width;this.radius=width/2.0;this.radiusSquare=this.radius*this.radius;};prototype.setHeight=function(height){this.width=height;this.height=height;this.radius=height/2.0;this.radiusSquare=this.radius*this.radius;};prototype.getStartAngle=function(){return this.startAngle;};prototype.setStartAngle=function(startAngle){this.startAngle=startAngle;};prototype.getEndAngle=function(){return this.endAngle;};prototype.setEndAngle=function(endAngle){this.endAngle=endAngle;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.getBounds=function(){return this.bounds;};prototype.setBounds=function(bounds){this.bounds=bounds;};prototype.isInside=function(x,y){if(x==null||y==null){return false;}else{var diffXSquare=this.x-x;diffXSquare=diffXSquare*diffXSquare;var diffYSquare=this.y-y;diffYSquare=diffYSquare*diffYSquare;if((diffXSquare+diffYSquare)<=this.radiusSquare){return true;}else{return false;}}};},{bounds:"AreaBound",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Path=function(layer,width){Shape.call(this,layer,-1,-1);this.points=[];this.width=width;this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.closePath=false;this.dashValues=Path.DEFAULT_DASH_VALUES;};Path=stjs.extend(Path,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.points=null;prototype.closePath=false;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.pushPoint=function(x,y){this.points.push(new Point2D(x,y));};prototype.popPoint=function(){this.points.pop();};prototype.getStartPoint=function(){return this.points[0];};prototype.getEndPoint=function(){return this.points[this.points.length-1];};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isClosePath=function(){return this.closePath;};prototype.setClosePath=function(closePath){this.closePath=closePath;};prototype.getX=function(){if(this.points==null||this.points.length<=0){return null;}else{var fistPoint=this.points[0];return fistPoint!=null?fistPoint.getX():null;}};prototype.getY=function(){if(this.points==null||this.points.length<=0){return null;}else{var fistPoint=this.points[0];return fistPoint!=null?fistPoint.getY():null;}};prototype.isInside=function(x,y){return false;};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},points:{name:"Array",arguments:["Point2D"]},dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Polygon=function(layer,x,y,width){Shape.call(this,layer,x,y);this.points=[new Point2D(x,y)];this.width=width;this.strokeShape=true;this.fillShape=false;};Polygon=stjs.extend(Polygon,Shape,[],function(constructor,prototype){prototype.points=null;prototype.pushPoint=function(x,y){this.points.push(new Point2D(x,y));};prototype.popPoint=function(){this.points.pop();};prototype.isInside=function(x,y){return false;};},{points:{name:"Array",arguments:["Point2D"]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var TriangleShape=function(layer,x1,y1,x2,y2,x3,y3){Shape.call(this,layer,x1,y1);this.p1=new Point2D(x1,y1);this.p2=new Point2D(x2,y2);this.p3=new Point2D(x3,y3);this.lineDashOffset=0;this.strokeShape=true;this.fillShape=false;this.dashed=false;this.dashValues=TriangleShape.DEFAULT_DASH_VALUES;};TriangleShape=stjs.extend(TriangleShape,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.p1=null;prototype.p2=null;prototype.p3=null;prototype.dashed=false;prototype.lineDashOffset=0;prototype.dashValues=null;prototype.dashStyle=null;prototype.getP1=function(){return this.p1;};prototype.getP2=function(){return this.p2;};prototype.getP3=function(){return this.p3;};prototype.setP1=function(p1){if(p1==null){this.p1=null;}else{this.p1=p1.getClone();}};prototype.setP2=function(p2){if(p2==null){this.p2=null;}else{this.p2=p2.getClone();}};prototype.setP3=function(p3){if(p3==null){this.p3=null;}else{this.p3=p3.getClone();}};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getDashValues=function(){return this.dashValues;};prototype.setDashValues=function(dashValues){this.dashValues=dashValues;};prototype.getDashStyle=function(){return this.dashStyle;};prototype.setDashStyle=function(dashStyle){this.dashStyle=dashStyle;};prototype.isInside=function(x,y){return MathUtil.isPointInsideTriangle(new Point2D(x,y),this.p1,this.p2,this.p3);};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},p1:"Point2D",p2:"Point2D",p3:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var Ellipse=function(layer,x,y,radiusX,radiusY){Shape.call(this,layer,x,y);this.radiusX=radiusX;this.radiusY=radiusY;this.radiusXSquare=radiusX*radiusX;this.radiusYSquare=radiusY*radiusY;this.width=stjs.trunc(Math.round(2*radiusX));this.height=stjs.trunc(Math.round(2*radiusY));this.startAngle=0.0;this.endAngle=2*Math.PI;this.strokeShape=true;this.fillShape=false;this.lineWidth=1;this.dashValues=Ellipse.DEFAULT_DASH_VALUES;};Ellipse=stjs.extend(Ellipse,Shape,[],function(constructor,prototype){constructor.DEFAULT_DASH_VALUES=[5,4];prototype.radiusX=0.0;prototype.radiusY=0.0;prototype.radiusXSquare=0.0;prototype.radiusYSquare=0.0;prototype.startAngle=0.0;prototype.endAngle=0.0;prototype.bounds=null;prototype.dashValues=null;prototype.dashed=false;prototype.lineWidth=0;prototype.getRadiusX=function(){return this.radiusX;};prototype.getRadiusY=function(){return this.radiusY;};prototype.setRadiusX=function(radiusX){this.radiusX=radiusX;this.radiusXSquare=radiusX*radiusX;this.width=stjs.trunc(Math.round(2*radiusX));};prototype.setRadiusY=function(radiusY){this.radiusY=radiusY;this.radiusYSquare=radiusY*radiusY;this.height=stjs.trunc(Math.round(2*radiusY));};prototype.setWidth=function(width){this.width=width;this.radiusX=width/2.0;this.radiusXSquare=this.radiusX*this.radiusX;};prototype.setHeight=function(height){this.height=height;this.radiusY=height/2.0;this.radiusYSquare=this.radiusY*this.radiusY;};prototype.getStartAngle=function(){return this.startAngle;};prototype.setStartAngle=function(startAngle){this.startAngle=startAngle;};prototype.getEndAngle=function(){return this.endAngle;};prototype.setEndAngle=function(endAngle){this.endAngle=endAngle;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.isDashed=function(){return this.dashed;};prototype.setDashed=function(dashed){this.dashed=dashed;};prototype.getBounds=function(){return this.bounds;};prototype.setBounds=function(bounds){this.bounds=bounds;};prototype.isInside=function(x,y){if(x==null||y==null||this.radiusXSquare==0||this.radiusYSquare==0){return false;}else{var diffXSquare=this.x-x;diffXSquare=diffXSquare*diffXSquare;diffXSquare/=this.radiusXSquare;var diffYSquare=this.y-y;diffYSquare=diffYSquare*diffYSquare;diffYSquare/=this.radiusYSquare;if((diffXSquare+diffYSquare)<=1){return true;}else{return false;}}};},{DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},bounds:"AreaBound",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasLine=function(layer,x1,y1,x2,y2,width){Line.call(this,layer,x1,y1,x2,y2,width);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasLine=stjs.extend(CanvasLine,Line,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.lineTo(this.endPoint.getX(),this.endPoint.getY());if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderDashLine();}};prototype.renderDashLine=function(){if(this.dashValues!=null&&this.dashValues[0]!=null){var dashLength=this.dashValues[0];var gapLength=this.dashValues[1];if(gapLength==null){gapLength=dashLength;}
var dx=(this.endPoint.getX()-this.startPoint.getX());var dy=(this.endPoint.getY()-this.startPoint.getY());var length=stjs.trunc(Math.round(this.endPoint.distanceTo(this.startPoint)));var rotation=Math.atan2(dy,dx);this.canvasContext.save();this.canvasContext.translate(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.rotate(rotation);if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(0,0);var draw=true;var x=0;while(length>x){if(draw){x+=dashLength;x=x<length?x:length;this.canvasContext.lineTo(x,0);}else{x+=gapLength;x=x<length?x:length;this.canvasContext.moveTo(x,0);}
draw=!draw;}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){var offsetX=0.0;var offsetY=0.0;if(this.startPoint.getY()!=this.endPoint.getY()){offsetX=0.5;}
if(this.startPoint.getX()!=this.endPoint.getX()){offsetY=0.5;}
this.canvasContext.transform(1,0,0,1,offsetX,offsetY);}
this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.startPoint.getX(),this.startPoint.getY());this.canvasContext.lineTo(this.endPoint.getX(),this.endPoint.getY());if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},startPoint:"Point2D",endPoint:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasRect=function(layer,x,y,width,height){Rect.call(this,layer,x,y,width,height);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasRect=stjs.extend(CanvasRect,Rect,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){if(this.isHighlighted()){this.canvasContext.clearRect(this.x,this.y,this.highlightRectWidth,this.height);}else{this.canvasContext.clearRect(this.x,this.y,this.width,this.height);}};prototype.render=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.isHighlighted()){this.renderWithColors(this.highlightColor,this.highlightColor,this.highlightRectWidth);}else if(this.isGrouped()){this.renderWithColors(this.groupColor,this.groupColor,this.groupRectWidth);}else{this.renderWithColors(this.fillColor,this.strokeColor,this.width);}
this.customRender();this.canvasContext.restore();};prototype.renderWithColors=function(fillColorToUse,strokeColorToUse,widthToUse){if(this.fillShape&&fillColorToUse!=null){fillColorToUse.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fillRect(this.x,this.y,widthToUse,this.height);}
if(this.strokeShape&&strokeColorToUse!=null){this.canvasContext.lineWidth=this.lineWidth;if(this.lineWidth%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
strokeColorToUse.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.strokeRect(this.x,this.y,widthToUse,this.height);}};prototype.highlight=function(){if(this.isHighlighted()){return;}
this.clear();switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:this.data[ChartConstant.HIGHLIGHT_COLOR]=this.highlightColor.getFlatColor();break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:this.data[ChartConstant.HIGHLIGHT_WIDTH]=this.highlightRectWidth;break;case sq.ChartElement.HIGHLIGHT.NONE:break;case sq.ChartElement.HIGHLIGHT.COLOR_FISH_EYE:this.data[ChartConstant.HIGHLIGHT_COLOR]=this.highlightColor.getFlatColor();this.data[ChartConstant.HIGHLIGHT_WIDTH]=this.highlightRectWidth;break;default:break;}
this.setHighlighted(true);this.render();};prototype.clearHighlight=function(){this.clear();this.setHighlighted(false);this.render();};prototype.hover=function(){if(this.isHighlighted()){return;}
var tmp=this.fillColor;var tmpW=this.width;switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:if(this.isGrouped()){this.groupColor=this.hoverColor;this.render();this.groupColor=tmp;}else{this.fillColor=this.hoverColor;this.render();this.fillColor=tmp;}
break;case sq.ChartElement.HOVER.FISH_EYE:if(this.isGrouped()){this.width=this.groupRectWidth+2;this.render();this.width=this.groupRectWidth;}else{this.width=this.hoverRectWidth;this.render();this.width=tmpW;}
break;case sq.ChartElement.HOVER.NONE:break;case sq.ChartElement.HOVER.COLOR_FISH_EYE:if(this.isGrouped()){this.groupColor=this.hoverColor;this.width=this.groupRectWidth+2;this.render();this.width=this.groupRectWidth;this.groupColor=tmp;}else{this.fillColor=this.hoverColor;this.width=this.hoverRectWidth;this.render();this.width=tmpW;this.fillColor=tmp;}
break;case sq.ChartElement.HOVER.CIRCLE:this.createCircleHighlight();break;default:break;}};prototype.createCircleHighlight=function(){var circleHighlight=ChartElementFactory.createCircle(this.layer,this.x,this.y,6);circleHighlight.setStrokeColor(this.hoverColor);circleHighlight.setLineWidth(2);circleHighlight.render();};prototype.copyTo=function(layer){var clone=new CanvasRect(layer,this.x,this.y,this.width,this.height);clone.setId(this.id);clone.setData(this.data);clone.setFillColor(this.fillColor);clone.setFillColorGradientParam(this.fillColorGradientParam);clone.setFillShape(this.fillShape);clone.setHighlightColor(this.highlightColor);clone.setHighlightColorGradientParam(this.highlightColorGradientParam);clone.setHighlightMode(this.highlightMode);clone.setHoverColor(this.hoverColor);clone.setHoverMode(this.hoverMode);clone.setStrokeColor(this.strokeColor);clone.setStrokeShape(this.strokeShape);clone.setHighlightRectWidth(this.highlightRectWidth);clone.setHoverRectWidth(this.hoverRectWidth);clone.setGroupRectWidth(this.groupRectWidth);clone.setHighlighted(this.highlighted);clone.setGrouped(this.grouped);return clone;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasCircle=function(layer,x,y,radius){Circle.call(this,layer,x,y,radius);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasCircle=stjs.extend(CanvasCircle,Circle,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,false);if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.lineWidth=this.lineWidth;this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();this.canvasContext.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,false);if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",bounds:"AreaBound",fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasPath=function(layer,width){Path.call(this,layer,width);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasPath=stjs.extend(CanvasPath,Path,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;if(pointCount>0){var firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
for(var i=1;i<pointCount;i++){var currentPoint=this.points[i];this.canvasContext.lineTo(currentPoint.getX(),currentPoint.getY());}
if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed){if(this.dashValues==null){this.dashValues=Path.DEFAULT_DASH_VALUES;}
this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderDashPath();}};prototype.renderDashLine=function(startPoint,endPoint,dashLength,gapLength){var dx=(endPoint.getX()-startPoint.getX());var dy=(endPoint.getY()-startPoint.getY());var length=stjs.trunc(Math.round(endPoint.distanceTo(startPoint)));var rotation=Math.atan2(dy,dx);this.canvasContext.save();this.canvasContext.translate(startPoint.getX(),startPoint.getY());this.canvasContext.rotate(rotation);this.canvasContext.moveTo(0,0);var draw=true;var x=0;while(length>x){if(draw){x+=dashLength;x=x<length?x:length;this.canvasContext.lineTo(x,0);}else{x+=gapLength;x=x<length?x:length;this.canvasContext.moveTo(x,0);}
draw=!draw;}
this.canvasContext.restore();};prototype.renderDashPath=function(){if(this.dashValues!=null&&this.dashValues[0]!=null){var dashLength=this.dashValues[0];var gapLength=this.dashValues[1];if(gapLength==null){gapLength=dashLength;}
this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;var firstPoint=null;if(pointCount>0){firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
var previousPoint=firstPoint;var currentPoint=null;for(var i=1;i<pointCount;i++){currentPoint=this.points[i];this.renderDashLine(previousPoint,currentPoint,dashLength,gapLength);previousPoint=currentPoint;}
if(this.closePath&&firstPoint!=null){this.renderDashLine(currentPoint,firstPoint,dashLength,gapLength);}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();if(this.width%2!=0){this.canvasContext.transform(1,0,0,1,0.5,0.5);}
this.canvasContext.lineWidth=this.width;var pointCount=this.points.length;if(pointCount>0){var firstPoint=this.points[0];this.canvasContext.moveTo(firstPoint.getX(),firstPoint.getY());}
for(var i=1;i<pointCount;i++){var currentPoint=this.points[i];this.canvasContext.lineTo(currentPoint.getX(),currentPoint.getY());}
if(this.closePath){this.canvasContext.closePath();}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},points:{name:"Array",arguments:["Point2D"]},dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasPolygon=function(layer,x,y,width){Polygon.call(this,layer,x,y,width);};CanvasPolygon=stjs.extend(CanvasPolygon,Polygon,[],function(constructor,prototype){prototype.clear=function(){};prototype.render=function(){};prototype.highlight=function(){};prototype.clearHighlight=function(){};prototype.hover=function(){};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{points:{name:"Array",arguments:["Point2D"]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasTriangle=function(layer,x1,y1,x2,y2,x3,y3){TriangleShape.call(this,layer,x1,y1,x2,y2,x3,y3);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasTriangle=stjs.extend(CanvasTriangle,TriangleShape,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.p1.getX(),this.p1.getY());this.canvasContext.lineTo(this.p2.getX(),this.p2.getY());this.canvasContext.lineTo(this.p3.getX(),this.p3.getY());this.canvasContext.closePath();if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){this.canvasContext.save();this.canvasContext.beginPath();this.canvasContext.lineWidth=this.width;this.canvasContext.moveTo(this.p1.getX(),this.p1.getY());this.canvasContext.lineTo(this.p2.getX(),this.p2.getY());this.canvasContext.lineTo(this.p3.getX(),this.p3.getY());this.canvasContext.closePath();if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},p1:"Point2D",p2:"Point2D",p3:"Point2D",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var CanvasEllipse=function(layer,x,y,radiusX,radiusY){Ellipse.call(this,layer,x,y,radiusX,radiusY);this.canvas=layer.getCanvas();this.canvasContext=layer.getCanvasRenderingContext2D();};CanvasEllipse=stjs.extend(CanvasEllipse,Ellipse,[],function(constructor,prototype){prototype.canvas=null;prototype.canvasContext=null;prototype.clear=function(){this.canvasContext.save();this.canvasContext.globalCompositeOperation="destination-out";this.canvasContext.beginPath();this.canvasContext.translate(stjs.trunc(Math.round(this.x-this.radiusX)),stjs.trunc(Math.round(this.y-this.radiusY)));this.canvasContext.scale(this.radiusX,this.radiusY);this.canvasContext.arc(1,1,1,this.startAngle,this.endAngle,false);if(this.fillShape){this.canvasContext.fill();}
if(this.strokeShape){this.canvasContext.lineWidth=this.lineWidth;this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.render=function(){if(this.dashed&&this.dashValues!=null){this.renderDashed();}else{this.renderNormal();}};prototype.renderDashed=function(){if(this.canvasContext.setLineDash){this.canvasContext.save();this.canvasContext.setLineDash(this.dashValues);this.renderNormal();this.canvasContext.restore();}else{this.renderNormal();}};prototype.renderNormal=function(){if(this.canvasContext.ellipse){this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();try{this.canvasContext.ellipse(this.x,this.y,Math.abs(this.radiusX),Math.abs(this.radiusY),0,0,Math.PI*2);}catch(e){this.canvasContext.restore();this.renderEllipse();return;}
if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();}else{this.renderEllipse();}};prototype.renderEllipse=function(){var kappa=0.5522848;var ox=this.radiusX*kappa;var oy=this.radiusY*kappa;var xCenter=this.x;var yCenter=this.y;var xLeft=stjs.trunc(Math.round(this.x-this.radiusX));var yTop=stjs.trunc(Math.round(this.y-this.radiusY));var xRight=stjs.trunc(Math.round(this.x+this.radiusX));var yBottom=stjs.trunc(Math.round(this.y+this.radiusY));var yIntermTop=stjs.trunc(Math.round(yCenter-oy));var xIntermLeft=stjs.trunc(Math.round(xCenter-ox));var yIntermBottom=stjs.trunc(Math.round(yCenter+oy));var xIntermRight=stjs.trunc(Math.round(xCenter+ox));this.canvasContext.save();if(this.bounds!=null){var boundsX=stjs.trunc(Math.round(this.bounds.getLeft()));var boundsY=stjs.trunc(Math.round(this.bounds.getTop()));var boundsWidth=stjs.trunc(Math.round(this.bounds.getOuterWidth(true)));var boundsHeight=stjs.trunc(Math.round(this.bounds.getOuterHeight(true)));this.canvasContext.beginPath();this.canvasContext.rect(boundsX,boundsY,boundsWidth,boundsHeight);this.canvasContext.clip();}
this.canvasContext.beginPath();this.canvasContext.moveTo(xLeft,this.y);this.canvasContext.bezierCurveTo(xLeft,yIntermTop,xIntermLeft,yTop,xCenter,yTop);this.canvasContext.bezierCurveTo(xIntermRight,yTop,xRight,yIntermTop,xRight,yCenter);this.canvasContext.bezierCurveTo(xRight,yIntermBottom,xIntermRight,yBottom,xCenter,yBottom);this.canvasContext.bezierCurveTo(xIntermLeft,yBottom,xLeft,yIntermBottom,xLeft,yCenter);if(this.fillShape&&this.fillColor!=null){this.fillColor.applyColorToFillStyle(this.canvasContext,this.fillColorGradientParam);this.canvasContext.fill();}
if(this.strokeShape&&this.strokeColor!=null){this.canvasContext.lineWidth=this.lineWidth;this.strokeColor.applyColorToStrokeStyle(this.canvasContext,this.strokeColorGradientParam);this.canvasContext.stroke();}
this.canvasContext.restore();};prototype.highlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.clearHighlight=function(){switch(this.highlightMode){case sq.ChartElement.HIGHLIGHT.CHANGE_COLOR:break;case sq.ChartElement.HIGHLIGHT.FISH_EYE:break;case sq.ChartElement.HIGHLIGHT.NONE:default:break;}};prototype.hover=function(){switch(this.hoverMode){case sq.ChartElement.HOVER.CHANGE_COLOR:break;case sq.ChartElement.HOVER.FISH_EYE:break;case sq.ChartElement.HOVER.NONE:default:break;}};prototype.copyTo=function(layer){return null;};prototype.customRender=function(){};},{canvas:"Canvas",canvasContext:"CanvasRenderingContext2D",DEFAULT_DASH_VALUES:{name:"Array",arguments:[null]},bounds:"AreaBound",dashValues:{name:"Array",arguments:[null]},fillColor:"ChartColor",strokeColor:"ChartColor",fillColorGradientParam:{name:"Array",arguments:[null]},strokeColorGradientParam:{name:"Array",arguments:[null]},data:{name:"Map",arguments:[null,"Object"]},highlightMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},hoverMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},highlightColor:"ChartColor",hoverColor:"ChartColor",groupColor:"ChartColor",highlightColorGradientParam:{name:"Array",arguments:[null]},hoverColorGradientParam:{name:"Array",arguments:[null]},groupColorGradientParam:{name:"Array",arguments:[null]}},{});
var ChartElementFactory=function(){};ChartElementFactory=stjs.extend(ChartElementFactory,null,[],function(constructor,prototype){constructor.createCircle=function(layer,x,y,radius){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasCircle(layer,x,y,radius);}
return null;};constructor.createLine=function(layer,x1,y1,x2,y2,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasLine(layer,x1,y1,x2,y2,width);}
return null;};constructor.createTriangle=function(layer,x1,y1,x2,y2,x3,y3){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasTriangle(layer,x1,y1,x2,y2,x3,y3);}
return null;};constructor.createSimpleIsocelesTriangle=function(layer,baseLineCenterX,baseLineY,baseLineWidth,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){var x1=baseLineCenterX;var y1=baseLineY+height;var halfWidth=baseLineWidth/2.0;var x2=stjs.trunc(Math.round(baseLineCenterX-halfWidth));var y2=baseLineY;var x3=stjs.trunc(Math.round(baseLineCenterX+halfWidth));var y3=baseLineY;return new CanvasTriangle(layer,x1,y1,x2,y2,x3,y3);}
return null;};constructor.createPath=function(layer,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasPath(layer,width);}
return null;};constructor.createPolygon=function(layer,x,y,width){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasPolygon(layer,x,y,width);}
return null;};constructor.createRect=function(layer,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasRect(layer,x,y,width,height);}
return null;};constructor.createLabel=function(layer,value,formattedValue,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasLabel(layer,value,formattedValue,x,y,width,height);}
return null;};constructor.createDrawTextLabel=function(layer,value,formattedValue,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new EditableCanvasLabel(layer,value,formattedValue,x,y,width,height);}
return null;};constructor.createToolTip=function(layer,parent,x,y,width,height){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){var tooltip=new CanvasToolTip();tooltip.init(layer,parent,x,y,width,height);}
return null;};constructor.createIcon=function(layer,x,y,width,height,iconType){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return CanvasIcon.createIcon(layer,x,y,width,height,iconType);}
return null;};constructor.createEllipse=function(layer,x,y,radiusX,radiusY){if(layer.getImplementation()==ChartOption.Implementation.CANVAS){return new CanvasEllipse(layer,x,y,radiusX,radiusY);}
return null;};},{},{});
var InteractiveShape=function(){this.id="iShape_"+new Date().getTime()+"_"+Math.round((Math.random()*1000));this.pointsValues=[];this.anchorPoints=[];this.complete=false;this.textColor=ChartColor.black;this.strokeColor=ChartColor.black;this.fillColor=ChartColor.transparent;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.fontSize=12;this.lineWidth=1;this.isCurrentLogScale=false;};InteractiveShape=stjs.extend(InteractiveShape,null,[],function(constructor,prototype){constructor.INSIDE_DISTANCE_MAX=5;constructor.ANCHOR_POINT_RADIUS=4;constructor.SOLID_LINE_STYLE="solid";constructor.NO_LINE_STYLE="none";constructor.LEGACY_FONT_PREFIX="Dialog-PLAIN-";constructor.ZERO_PAD="000000";prototype.pointsValues=null;prototype.anchorPoints=null;prototype.npoints=0;prototype.id=null;prototype.associatedAreaId=null;prototype.yAxisAreaId=null;prototype.complete=false;prototype.isCurrentLogScale=false;prototype.groupId=null;prototype.currentPosition=null;prototype.currentContext=null;prototype.contextXRange=null;prototype.contextAbsoluteStart=null;prototype.contextYRange=null;prototype.contextWidth=0.0;prototype.contextHeight=0.0;prototype.contextFreq=null;prototype.contextUpdated=false;prototype.contextLength=0;prototype.lineStyle=null;prototype.lineWidth=0;prototype.fontSize=0;prototype.textColor=null;prototype.strokeColor=null;prototype.fillColor=null;prototype.transformAnchorId=null;prototype.transformOriginX=null;prototype.transformOriginY=null;prototype.isContextUpdated=function(){return this.contextUpdated;};prototype.getShapes=function(layer,view,data,context){if(!this.isCurrentContext(data,context,view)){this.updateContext(data,context,view);}
var translatedPoints=this.getExtendedAnchorPointsTranslated(context,view);var translatedElements=this.getElementsFromPoints(translatedPoints,view,layer,context);if(translatedElements!=null){return translatedElements;}
var mainPoints=this.getExtendedAnchorPoints(context,view);return this.getElementsFromPoints(mainPoints,view,layer,context);};prototype.getAnchorPoints=function(layer,view,chartData,context){if(!this.isCurrentContext(chartData,context,view)){this.updateContext(chartData,context,view);}
var points=this.getExtendedAnchorPointsTranslated(context,view);if(points==null){points=this.getExtendedAnchorPoints(context,view);}
if(points!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var left=stjs.trunc(graphBounds.getContentLeft());var top=stjs.trunc(graphBounds.getContentTop());for(var index in points){if(!(points).hasOwnProperty(index))
continue;var point=points[index];if(point!=null){var anchor=ChartElementFactory.createCircle(layer,left+point.getX(),top+point.getY(),InteractiveShape.ANCHOR_POINT_RADIUS);anchor.setFillShape(true);anchor.setFillColor(ChartColor.white);shapes.push(anchor);}}
return shapes;}
return null;};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()){return false;}else if(this.anchorPoints.length>=this.npoints){return true;}
var context=chart.getEngineModel().getContext();var areaBound=currentArea.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-areaBound.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-areaBound.getContentTop()));if(this.anchorPoints.length==0){this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();if(chart.getChartData()!=null){this.isCurrentLogScale=chart.getChartData().isLogScale();}else{this.isCurrentLogScale=false;}}
if(localXPosition>this.contextWidth){return false;}else if(localXPosition<0){return false;}
this.addPointValue(chart.getChartData(),context,localXPosition,localYPosition);this.anchorPoints.push(this.getUniquePointIn(new Point2D(localXPosition,localYPosition),this.anchorPoints));this.complete=this.anchorPoints.length>=this.npoints;return this.complete;};prototype.addPointValue=function(data,context,localXPosition,localYPosition){if((this.groupId!="intraday"&&this.groupId!="histo")||this.contextWidth<=0||this.contextHeight<=0||this.contextXRange==null||this.contextYRange==null||data==null){return;}
var mainSerie=data.getMainSerie();var freq=null;var currentLength=0;if(mainSerie!=null){currentLength=mainSerie.getLength();var mainSerieF=mainSerie;if(mainSerie.getPeriod&&mainSerieF.getPeriod()!=null){freq=mainSerieF.getPeriod().getFrequency();}}
if(freq==null||freq.isLive()){freq=Frequency.MINUTE;}
if(this.pointsValues.length==0){this.currentContext=context;this.contextFreq=freq;this.contextLength=currentLength;this.contextAbsoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);}
this.setPointValue(this.pointsValues.length,data,context,localXPosition,localYPosition);};prototype.setPointValue=function(i,data,context,localXPosition,localYPosition){if((this.groupId!="intraday"&&this.groupId!="histo")||this.contextWidth<=0||this.contextHeight<=0||this.contextXRange==null||this.contextYRange==null||data==null){return;}
var yValue=context.getYValueFromYPosition(localYPosition,this.contextHeight,this.yAxisAreaId,this.associatedAreaId==DefaultLayout.GRAPH_AREA);var xValue=InteractiveShape.getXValueFromXPosition(data,context,new Double(localXPosition),this.contextWidth,this.groupId);this.pointsValues[i]=new Point2Df(xValue,yValue);};constructor.getXValueFromXPosition=function(data,context,localXPosition,contextWidth,groupId){var mainSerie=data.getMainSerie();var freq=null;if(mainSerie!=null){var mainSerieF=mainSerie;if(mainSerie.getPeriod&&mainSerieF.getPeriod()!=null){freq=mainSerieF.getPeriod().getFrequency();}}
var contextXRange=context.getRange(Serie.X);var rangeStart=contextXRange!=null?contextXRange[0]:0.0;var xValue=localXPosition/contextWidth*data.getCurrentXSpaceSize(contextXRange);xValue=data.xSpace2NormalizedXValueNegative(xValue);xValue=rangeStart!=null?xValue+rangeStart:xValue;var serie=data.getMainSerie();if(serie.isIntraday()&&groupId=="intraday"){if(freq.isLive()){freq=Frequency.MINUTE;}
var absoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);var absoluteEnd=(data.getExtremums()!=null?data.getExtremums()[1]:0);var absoluteRange=[absoluteStart,absoluteEnd];var rangeValue=(rangeStart-absoluteStart)/freq.getTimeValue();var rangePoint=new Point2Df(rangeValue,0.0);var rangeXPosition=InteractiveShape.getXPositionFromXValue(data,context,absoluteRange,freq,rangePoint,groupId,contextWidth,absoluteStart);xValue=rangeXPosition/contextWidth*data.getCurrentXSpaceSize(absoluteRange);xValue+=localXPosition/contextWidth*data.getCurrentXSpaceSize(contextXRange);xValue=data.xSpace2NormalizedXValueNegative(xValue);xValue-=absoluteStart;xValue/=freq.getTimeValue();}
return xValue;};prototype.getElementsFromPoints=function(points,view,layer,context){};prototype.getPointsInContext=function(points,context,view){if(points!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var boundsTranslation=new Vector2D(graphBounds.getContentLeft(),graphBounds.getContentTop());var pointsInContext=[];var pointsCount=points.length;for(var i=0;i<pointsCount;i++){pointsInContext.push(points[i].add(boundsTranslation));}
return pointsInContext;}
return null;};prototype.getLinesInContext=function(points,context,view){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext.length>1){var pOrigin=pointsInContext[0];var p1=pOrigin;var p2=null;var pointsCount=pointsInContext.length;var lines=[];for(var i=1;i<pointsCount;i++){p2=pointsInContext[i];lines.push(new Line2D(p1,p2));p1=p2;}
if(pointsInContext.length>2){lines.push(new Line2D(p2,pOrigin));}
return lines;}
return null;};prototype.getExtendedAnchorPoints=function(context,view){if(context==null||view==null||this.anchorPoints.length==0||(this.anchorPoints.length==1&&context.getCurrentPosition()==null&&this.npoints>1)||view.getArea(this.associatedAreaId)==null){return null;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var anchorPointsClone=[];var anchorPointsOrigin=this.anchorPoints;for(var index in anchorPointsOrigin){if(!(anchorPointsOrigin).hasOwnProperty(index))
continue;var point=anchorPointsOrigin[index];if(point!=null){anchorPointsClone.push(point.getClone());}}
if(anchorPointsOrigin.length<this.npoints){var currentPosition=context.getCurrentPosition();var localXPosition=stjs.trunc(Math.round(currentPosition.getX()-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(currentPosition.getY()-graphBounds.getContentTop()));currentPosition=new Point2D(localXPosition,localYPosition);currentPosition=this.getUniquePointIn(currentPosition,anchorPointsClone);anchorPointsClone.push(currentPosition);}
return anchorPointsClone;};prototype.getExtendedAnchorPointsTranslated=function(context,view){var translation=this.getTranslation(context);if(translation!=null&&translation.dot(translation)>0){var points=this.getExtendedAnchorPoints(context,view);if(points!=null){var anchorPointsTranslated=[];var pointsCount=points.length;for(var i=0;i<pointsCount;i++){var point=points[i];if(this.transformAnchorId==-1||this.transformAnchorId==i){point=point.add(translation);}
anchorPointsTranslated.push(point);}
return anchorPointsTranslated;}}
return null;};prototype.getUniquePointIn=function(point,points){if(ArrayUtil.containsSameObject(points,point)){var uniqueX=point.getX()+1;var y=point.getY();var uniquePoint=new Point2D(uniqueX,y);while(ArrayUtil.containsSameObject(points,uniquePoint)){uniqueX++;uniquePoint=new Point2D(uniqueX,y);}
return uniquePoint;}
return point;};prototype.isCurrentContext=function(data,context,view){if(data==null||context==null||view==null||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var width=graphBounds.getContentWidth();var height=graphBounds.getContentHeight();var xRange=context.getRange(Serie.X);var yRange=context.getRange(this.yAxisAreaId);if(xRange==null||yRange==null||this.contextXRange==null||this.contextYRange==null){return false;}
var result=width==this.contextWidth&&height==this.contextHeight&&(this.isCurrentLogScale==data.isLogScale())&&ArrayUtil.isSameArray(xRange,this.contextXRange)&&ArrayUtil.isSameArray(yRange,this.contextYRange);this.contextUpdated=!result;return result;};prototype.updateContext=function(data,context,view){if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var areaBound=area.getAreaBound();this.anchorPoints=this.getAnchorPointsInContext(data,context,view);this.currentContext=context;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();this.contextAbsoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:null);};prototype.getAssociatedAreaId=function(){return this.associatedAreaId;};prototype.setAssociatedAreaId=function(associatedAreaId){this.associatedAreaId=associatedAreaId;};prototype.isComplete=function(){return this.complete;};prototype.updatePosition=function(currentPosition){this.currentPosition=currentPosition;};prototype.setOriginTransform=function(anchor,offsetX,offsetY){this.transformAnchorId=anchor;this.transformOriginX=offsetX;this.transformOriginY=offsetY;};prototype.setEndTransform=function(offsetX,offsetY){if(this.transformAnchorId==null||this.transformOriginX==null||this.transformOriginY==null){this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;return;}
var data=this.currentContext!=null?this.currentContext.getData():null;var translation=new Vector2D(offsetX-this.transformOriginX,offsetY-this.transformOriginY);if(this.transformAnchorId<=-1){var pointsCount=this.anchorPoints.length;for(var i=0;i<pointsCount;i++){var currentPoint=this.anchorPoints[i];if(currentPoint!=null){var translatedPoint=currentPoint.add(translation);this.anchorPoints[i]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(i,data,this.currentContext,localXPosition,localYPosition);}}}else{var changedAnchor=this.anchorPoints[this.transformAnchorId];if(changedAnchor!=null){var translatedPoint=changedAnchor.add(translation);this.anchorPoints[this.transformAnchorId]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(this.transformAnchorId,data,this.currentContext,localXPosition,localYPosition);}}
this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;};prototype.validXPos=function(localXPosition){if(this.groupId=="intraday"){if(localXPosition<0){localXPosition=0;}else if(localXPosition>this.contextWidth){localXPosition=stjs.trunc(this.contextWidth);}}
return localXPosition;};prototype.getLineStyle=function(){return this.lineStyle;};prototype.setLineStyle=function(lineStyle){this.lineStyle=lineStyle;};prototype.getLineWidth=function(){return this.lineWidth;};prototype.setLineWidth=function(lineWidth){this.lineWidth=lineWidth;};prototype.getStrokeColor=function(){return this.strokeColor;};prototype.setStrokeColor=function(strokeColor){this.strokeColor=strokeColor;};prototype.getFillColor=function(){return this.fillColor;};prototype.setFillColor=function(fillColor){this.fillColor=fillColor;};prototype.serialize=function(){};prototype.unserializeFromXML=function(currentFigure){this.complete=true;this.groupId=XMLUtil.getValue(currentFigure,"group");this.applyStyle(XMLUtil.getNode(currentFigure,"style"));return this.initShapeFromXML(currentFigure);};prototype.initShapeFromXML=function(currentFigure){var itemNodes=XMLUtil.getChildNodes(currentFigure,"points");if(itemNodes!=null&&itemNodes.length==this.npoints){var currentValues=[];for(var i=0;i<this.npoints;i++){var currentItem=itemNodes[i];if(currentItem!=null){var p1Values=(currentItem.textContent).split(",");var p1X=parseFloat(p1Values[0]);var p1Y=parseFloat(p1Values[1]);if(p1X!=null&&p1Y!=null&&!isNaN(p1X)&&!isNaN(p1Y)){currentValues.push(new Point2Df(p1X,p1Y));}else{return false;}}else{return false;}}
this.pointsValues=currentValues;return true;}
return false;};prototype.getShapeName=function(){};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){};prototype.getAnchorPointsInContext=function(data,context,view){if(context==null||view==null){return null;}else if(this.anchorPoints==null||this.anchorPoints.length==0){if(this.pointsValues!=null&&this.pointsValues.length>0){this.initAnchorPointsFromPointsValues(data,context,view);}else{return null;}}else if(this.groupId=="intraday"||this.groupId=="histo"){this.updatePointsValues(data,context,view);this.initAnchorPointsFromPointsValues(data,context,view);}
var pointsInContext=[];var pointsCount=this.anchorPoints.length;for(var i=0;i<pointsCount;i++){var currentPoint=this.getPointInContext(this.anchorPoints[i],context,view);pointsInContext.push(currentPoint);}
return pointsInContext;};constructor.computeFreq=function(context,mainSerie){var freq=null;if(mainSerie!=null){var mainSerieF=mainSerie;if(mainSerie.getPeriod&&mainSerieF.getPeriod()!=null){freq=mainSerieF.getPeriod().getFrequency();}}
if(freq==null||freq.isLive()){freq=Frequency.MINUTE;}
return freq;};prototype.updatePointsValues=function(data,newContext,newView){if(this.contextFreq==null||newContext==null){return false;}
var ratio=1.0;var translation=0.0;var mainSerie=(newContext.getData()!=null?newContext.getData().getMainSerie():null);var newFreq=InteractiveShape.computeFreq(newContext,mainSerie);var newLength=0;if(mainSerie!=null){newLength=mainSerie.getLength();}
if(newFreq==null||this.contextLength<=0||newLength<=0){return false;}
if(newFreq.isLive()){newFreq=Frequency.MINUTE;}
var periodChange=false;var periodChangeIntraday=false;if(this.groupId=="histo"){if(newFreq.getTimeValue()==this.contextFreq.getTimeValue()&&newLength==this.contextLength){return true;}else if(newFreq.getTimeValue()==this.contextFreq.getTimeValue()){periodChange=true;}
if(periodChange){translation=(newLength-this.contextLength);}else{ratio=newLength/this.contextLength;}}else if(this.groupId=="intraday"){var serie=data.getMainSerie();ratio=this.contextFreq.getTimeValue()/newFreq.getTimeValue();if(serie.isIntraday()&&this.contextAbsoluteStart!=0&&this.contextAbsoluteStart!=data.getExtremums()[0]){periodChangeIntraday=true;}}
for(var index in this.pointsValues){if(!(this.pointsValues).hasOwnProperty(index))
continue;var currentValue=this.pointsValues[index];if(currentValue!=null){var xValue=currentValue.getX();if(this.groupId=="intraday"&&periodChangeIntraday){xValue=this.updateValue(data,newContext,currentValue);}
var xValueUpdated=xValue*ratio+translation;this.pointsValues[index]=new Point2Df(xValueUpdated,currentValue.getY());}}
this.currentContext=newContext;this.contextFreq=newFreq;this.contextLength=newLength;return true;};prototype.updateValue=function(data,newContext,currentValue){var xPos;var contextXRange=this.currentContext.getRange(Serie.X);xPos=InteractiveShape.getXPositionFromXValue(data,this.currentContext,contextXRange,this.contextFreq,currentValue,this.groupId,this.contextWidth,this.contextAbsoluteStart);var xValue=InteractiveShape.getXValueFromXPosition(data,newContext,xPos,this.contextWidth,this.groupId);return xValue;};prototype.initAnchorPointsFromPointsValues=function(data,context,view){if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var areaBounds=area.getAreaBound();var width=areaBounds.getContentWidth();var height=areaBounds.getContentHeight();if(width<=0||height<=0){return;}
this.anchorPoints=[];this.currentContext=context;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=width;this.contextHeight=height;this.isCurrentLogScale=data.isLogScale();this.contextLength=0;var mainSerie=(context.getData()!=null?context.getData().getMainSerie():null);if(mainSerie!=null){this.contextLength=mainSerie.getLength();}
var freq=InteractiveShape.computeFreq(context,mainSerie);this.contextFreq=freq;var xPos=0.0;var absoluteStart=(data.getExtremums()!=null?data.getExtremums()[0]:0);for(var index in this.pointsValues){if(!(this.pointsValues).hasOwnProperty(index))
continue;var currentValue=this.pointsValues[index];if(currentValue!=null){var contextXRange=context.getRange(Serie.X);xPos=InteractiveShape.getXPositionFromXValue(data,context,contextXRange,freq,currentValue,this.groupId,this.contextWidth,absoluteStart);var yPos=context.getPositionFromYValue(currentValue.getY(),height,this.yAxisAreaId,this.associatedAreaId==DefaultLayout.GRAPH_AREA);if(xPos!=null&&yPos!=null){var x=stjs.trunc(Math.round(xPos));var y=stjs.trunc(Math.round(yPos));this.anchorPoints.push(new Point2D(x,y));}}}};constructor.getXPositionFromXValue=function(data,context,contextXRange,freq,currentValue,groupId,contextWidth,absoluteStart){var xPos=0.0;var rangeStart=contextXRange!=null?contextXRange[0]:0.0;var xValue=currentValue.getX();var serie=data.getMainSerie();if(serie!=null&&serie.isIntraday()&&groupId=="intraday"){xValue=xValue*freq.getTimeValue();var xValueInSpace=xValue+absoluteStart;xValueInSpace-=data.normalizeXSpaceNight(xValueInSpace);rangeStart-=data.normalizeXSpaceNight(rangeStart);var newValue=xValueInSpace-rangeStart;xPos=newValue*contextWidth/data.getCurrentXSpaceSize(contextXRange);}else if(groupId=="histo"){xPos=context.getPositionFromXSpaceValue(xValue,contextWidth);}
return xPos;};prototype.getPointInContext=function(point,context,view){if(context==null||view==null||point==null||view.getArea(this.associatedAreaId)==null){return null;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var width=graphBounds.getContentWidth();var height=graphBounds.getContentHeight();var x1PositionInContext=this.getXPositionInContext(context,point.getX(),width);var y1PositionInContext=this.getYPositionInContext(context,point.getY(),height);if(x1PositionInContext==null||y1PositionInContext==null||isNaN(x1PositionInContext)||isNaN(y1PositionInContext)){return null;}
return new Point2D(stjs.trunc(Math.round(x1PositionInContext)),stjs.trunc(Math.round(y1PositionInContext)));};prototype.getXPositionInContext=function(context,x,width){if(context==null||width<=0||this.contextWidth<=0||context.getRange(Serie.X)==null){return null;}
var xRange=context.getRange(Serie.X);if(xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]||this.contextXRange==null){return null;}
var widthRatio=width/this.contextWidth;var newValueLength=(xRange[1]-xRange[0]);var originalLength=(this.contextXRange[1]-this.contextXRange[0]);var pixelPerValue=width/newValueLength;var translationValue=(this.contextXRange[0]-xRange[0])*pixelPerValue;var scaledValue=x*widthRatio*originalLength/newValueLength;return scaledValue+translationValue;};prototype.getYPositionInContext=function(context,y,height){if(context==null||height<=0||this.contextHeight<=0||context.getRange(this.yAxisAreaId)==null){return null;}
var yRange=context.getRange(this.yAxisAreaId);if(yRange==null||yRange[0]==null||yRange[1]==null||yRange[0]==yRange[1]||this.contextYRange==null){return null;}
var heightRatio=height/this.contextHeight;var newValueLength=(yRange[1]-yRange[0]);var originalLength=(this.contextYRange[1]-this.contextYRange[0]);var pixelPerValue=height/newValueLength;var translationValue=(yRange[1]-this.contextYRange[1])*pixelPerValue;var scaledValue=y*heightRatio*originalLength/newValueLength;return scaledValue+translationValue;};prototype.projectLineOnBounds=function(baseline,graphBounds){if(baseline==null){return null;}
var borders=graphBounds.getInnerBordersLines();var firstPoint=null;for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(firstPoint==null){firstPoint=intersection;}else if(!firstPoint.equals(intersection)){var p1Dist=firstPoint.distanceSquared(baseline.getP1());var p2Dist=firstPoint.distanceSquared(baseline.getP2());if(p1Dist<p2Dist){return new Line2D(firstPoint,intersection);}
return new Line2D(intersection,firstPoint);}}}}
return null;};prototype.clipLineInViewport=function(baseline,graphBounds){if(baseline==null||graphBounds==null){return null;}
var borders=graphBounds.getInnerBordersLines();var topLine=borders[0];var leftLine=borders[1];var bottomLine=borders[2];var rightLine=borders[3];var p1Segment=baseline.getP1();var p2Segment=baseline.getP2();var pointInside=p2Segment;var pointInsideIsP1=false;if(graphBounds.isInside(p1Segment.getX(),p1Segment.getY())&&graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return baseline;}else if(!graphBounds.isInside(p1Segment.getX(),p1Segment.getY())&&!graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){var top=topLine.getP1().getY();var left=leftLine.getP1().getX();var bottom=bottomLine.getP1().getY();var right=rightLine.getP1().getX();if((p1Segment.getX()<=left&&p2Segment.getX()<=left)||(p1Segment.getX()>=right&&p2Segment.getX()>=right)||(p1Segment.getY()<=top&&p2Segment.getY()<=top)||(p1Segment.getY()>=bottom&&p2Segment.getY()>=bottom)){return null;}
return this.projectLineOnBounds(baseline,graphBounds);}else if(graphBounds.isInside(p1Segment.getX(),p1Segment.getY())){pointInside=p1Segment;pointInsideIsP1=true;}
for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(Point2D.isPointBetween(intersection,p1Segment,p2Segment)){if(pointInsideIsP1){return new Line2D(pointInside,intersection);}
return new Line2D(intersection,pointInside);}}}}
return null;};prototype.clipAndProjectLine=function(baseline,graphBounds){if(baseline==null||graphBounds==null){return null;}
var borders=graphBounds.getInnerBordersLines();var p1Segment=baseline.getP1();var p2Segment=baseline.getP2();if(!graphBounds.isInside(p1Segment.getX(),p1Segment.getY())){if(graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return this.projectLineOnBounds(baseline,graphBounds);}else if(graphBounds.isXInside(p1Segment.getX())){if(borders[0].dist(p2Segment)<borders[0].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}else if(graphBounds.isYInside(p1Segment.getY())){if(borders[1].dist(p2Segment)<borders[1].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}else{if(borders[0].dist(p2Segment)<borders[0].dist(p1Segment)&&borders[1].dist(p2Segment)<borders[1].dist(p1Segment)){return this.projectLineOnBounds(baseline,graphBounds);}
return null;}}else if(!graphBounds.isInside(p2Segment.getX(),p2Segment.getY())){return this.clipLineInViewport(baseline,graphBounds);}
for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(baseline);if(intersection!=null&&graphBounds.isInside(intersection.getX(),intersection.getY())){if(Point2D.isPointBetween(p2Segment,p1Segment,intersection)){return new Line2D(p1Segment,intersection);}}}}
return null;};prototype.getTranslation=function(context){if(this.transformOriginX==null||this.transformOriginY==null||context==null||context.getCurrentPosition()==null){return null;}
var currentPosition=context.getCurrentPosition();return new Vector2D(currentPosition.getX()-this.transformOriginX,currentPosition.getY()-this.transformOriginY);};prototype.isMoving=function(context){return this.getTranslation(context)!=null;};prototype.getStyleString=function(){var content=XMLUtil.createNodeString("font",InteractiveShape.LEGACY_FONT_PREFIX+this.fontSize);if(this.textColor!=null){var cssHex=this.textColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("foreground",cssHex);}else{content+=XMLUtil.createNodeString("foreground","0x0");}}
if(this.fillColor!=null&&!this.fillColor.isTransparent()){var cssHex=this.fillColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("background",cssHex);}else{content+=XMLUtil.createNodeString("background","0x0");}}
if(this.strokeColor!=null&&!this.strokeColor.isTransparent()){var cssHex=this.strokeColor.toHex();if(cssHex!=null){cssHex=cssHex.replaceFirst("#","0x");content+=XMLUtil.createNodeString("border",this.lineStyle+" "+this.lineWidth+" "+cssHex);}else{content+=XMLUtil.createNodeString("border",this.lineStyle+" "+this.lineWidth+" "+"0x0");}}
return XMLUtil.createNodeString("style",content);};prototype.applyStyle=function(styleNode){var fontValue=XMLUtil.getValue(styleNode,"font");var foregroundValue=XMLUtil.getValue(styleNode,"foreground");var backgroundValue=XMLUtil.getValue(styleNode,"background");var borderValue=XMLUtil.getValue(styleNode,"border");if(fontValue!=null){var parsedValue=parseInt(fontValue.replaceFirst(InteractiveShape.LEGACY_FONT_PREFIX,""));if(parsedValue!=null&&!isNaN(parsedValue)){this.fontSize=parsedValue;}else{this.fontSize=12;}}else{this.fontSize=12;}
if(foregroundValue!=null&&!(foregroundValue==Color.TRANSPARENT)){var cssHex=foregroundValue.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.textColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.textColor=ChartColor.black;}}else{this.textColor=ChartColor.transparent;}
if(backgroundValue!=null&&!(backgroundValue==Color.TRANSPARENT)){var cssHex=backgroundValue.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.fillColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.fillColor=null;}}else{this.fillColor=ChartColor.transparent;}
if(borderValue!=null){var borderValues=(borderValue).split(" ");var borderStyle=borderValues[0];var borderWidth=borderValues[1];var borderColor=borderValues[2];if(borderStyle!=null){this.lineStyle=borderStyle;}else{this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;}
var bw=parseInt(borderWidth);if(bw!=null&&!isNaN(bw)){this.lineWidth=bw;}else{this.lineWidth=1;}
if(borderColor!=null){var cssHex=borderColor.replaceFirst("0x","");if(cssHex!=null){cssHex="#"+InteractiveShape.ZERO_PAD.substring(0,InteractiveShape.ZERO_PAD.length-cssHex.length)+cssHex;this.strokeColor=new ChartColor(ChartColor.ColorType.SIMPLE,[cssHex],null);}else{this.strokeColor=ChartColor.black;}}else{this.strokeColor=ChartColor.black;}}else{this.strokeColor=ChartColor.black;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.lineWidth=1;}};prototype.getGroupId=function(){return this.groupId;};prototype.setGroupId=function(groupId){this.groupId=groupId;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getTextColor=function(){return this.textColor;};prototype.setFontSize=function(textSize){this.fontSize=textSize;};prototype.getFontSize=function(){return this.fontSize;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Utils=function(){};Utils=stjs.extend(Utils,null,[],null,{},{});
var InfiniteLine=function(areaId,yAxisId){InteractiveShape.call(this);this.associatedAreaId=areaId;this.yAxisAreaId=yAxisId;this.anchorPoints=[];this.npoints=2;this.closePath=false;};InfiniteLine=stjs.extend(InfiniteLine,InteractiveShape,[],function(constructor,prototype){constructor.NAME="line";constructor.NPOINTS_ID="-3";prototype.closePath=false;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null){var color=null;var isDash=null;var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var pathShape=ChartElementFactory.createPath(layer,this.lineWidth);var previousP2=null;for(var index in lines){if(!(lines).hasOwnProperty(index))
continue;var line=lines[index];var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){var p1=croppedLine2D.getP1();var p2=croppedLine2D.getP2();if(p1.equals(previousP2)){pathShape.pushPoint(p2.getX(),p2.getY());}else{pathShape.pushPoint(p1.getX(),p1.getY());pathShape.pushPoint(p2.getX(),p2.getY());}
previousP2=p2;}}
pathShape.setClosePath(this.closePath);if(InteractiveShape.NO_LINE_STYLE.equals(this.lineStyle)){color=this.strokeColor.constructor.transparent;isDash=false;}else{color=this.strokeColor;isDash=!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle);}
pathShape.setDashed(isDash);pathShape.setStrokeColor(color);pathShape.setDashStyle(this.lineStyle);pathShape.setFillColor(this.fillColor);pathShape.setFillShape(this.fillColor!=null);pathShape.setStrokeShape(this.strokeColor!=null);shapes.push(pathShape);return shapes;}else{return null;}};prototype.applyModification=function(line,bounds){return this.projectLineOnBounds(line,bounds);};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(x,y);var line=new Line2D(this.anchorPoints[0],this.anchorPoints[1]);return line.dist(point)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.serialize=function(){var content="";var pointsId=this.getNPointsId();if(pointsId!=null){content=XMLUtil.createNodeString("npoints",pointsId);}
content+=XMLUtil.createNodeString("group",this.groupId)+InfiniteLine.getStringFromArray("points",this.pointsValues)+this.getStyleString();return XMLUtil.createNodeString(this.getShapeName(),content);};constructor.getStringFromArray=function(name,list){var values="";for(var index in list){if(!(list).hasOwnProperty(index))
continue;var value=list[index];if(value!=null&&value.getX()!=null&&value.getY()!=null){values+=XMLUtil.createNodeString("item",(value.getX()).toFixed(4)+","+(value.getY()).toFixed(4));}else{values+="<item/>";}}
return XMLUtil.createNodeString(name,values);};prototype.getShapeName=function(){return InfiniteLine.NAME;};prototype.getNPointsId=function(){return InfiniteLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Segment=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);};Segment=stjs.extend(Segment,InfiniteLine,[],function(constructor,prototype){prototype.applyModification=function(line,bounds){return line;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(x,y);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];var line=new Line2D(p1,p2);return line.distFromSegment(point)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InfiniteVerticalLine=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.npoints=1;};InfiniteVerticalLine=stjs.extend(InfiniteVerticalLine,InfiniteLine,[],function(constructor,prototype){constructor.NPOINTS_ID="-1";prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=pointsInContext[0];var p2=new Point2D(p1.getX(),p1.getY()+1);var line=new Line2D(p1,p2);var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var croppedLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLineElement.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));croppedLineElement.setDashStyle(this.lineStyle);croppedLineElement.setStrokeColor(this.strokeColor);croppedLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLineElement);}
return shapes;}else{return null;}};prototype.getYPositionInContext=function(context,localYPosition,height){return localYPosition;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var anchorX=this.anchorPoints[0].getX();return Math.abs(x-anchorX)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return InfiniteVerticalLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InfiniteHorizontalLine=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.npoints=1;};InfiniteHorizontalLine=stjs.extend(InfiniteHorizontalLine,InfiniteLine,[],function(constructor,prototype){constructor.NPOINTS_ID="-2";prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=pointsInContext[0];var p2=new Point2D(p1.getX()+1,p1.getY());var line=new Line2D(p1,p2);var croppedLine2D=this.applyModification(line,graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var croppedLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLineElement.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));croppedLineElement.setDashStyle(this.lineStyle);croppedLineElement.setStrokeColor(this.strokeColor);croppedLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLineElement);}
return shapes;}else{return null;}};prototype.getXPositionInContext=function(context,localXPosition,width){return localXPosition;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var anchorY=this.anchorPoints[0].getY();return Math.abs(y-anchorY)<=InteractiveShape.INSIDE_DISTANCE_MAX;};prototype.getNPointsId=function(){return InfiniteHorizontalLine.NPOINTS_ID;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Triangle=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.npoints=3;this.closePath=true;};Triangle=stjs.extend(Triangle,Segment,[],function(constructor,prototype){prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);return MathUtil.isPointInsideTriangle(point,this.anchorPoints[0],this.anchorPoints[1],this.anchorPoints[2]);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Quadrilateral=function(areaId,yAxisId){Triangle.call(this,areaId,yAxisId);this.npoints=4;};Quadrilateral=stjs.extend(Quadrilateral,Triangle,[],function(constructor,prototype){prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);return MathUtil.isPointInPolygon(point,this.anchorPoints);};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var Rectangle=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.npoints=2;this.closePath=true;};Rectangle=stjs.extend(Rectangle,Segment,[],function(constructor,prototype){constructor.NAME="rectangle";prototype.getExtendedAnchorPoints=function(context,view){if(context==null||view==null||this.anchorPoints.length==0||(this.anchorPoints.length==1&&context.getCurrentPosition()==null)||view.getArea(this.associatedAreaId)==null){return null;}
if(this.anchorPoints.length>1){return this.getPointsFromCorners(this.anchorPoints[0],this.anchorPoints[1]);}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var corner0=this.anchorPoints[0];var currentPosition=context.getCurrentPosition();var localXPosition=stjs.trunc(Math.round(currentPosition.getX()-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(currentPosition.getY()-graphBounds.getContentTop()));var corner1=new Point2D(localXPosition,localYPosition);return this.getPointsFromCorners(corner0,corner1);};prototype.getExtendedAnchorPointsTranslated=function(context,view){if(this.transformAnchorId==null||this.anchorPoints.length<this.npoints){return null;}
var translation=this.getTranslation(context);var corner0Translation=this.getCorner0Translation(translation);var corner1Translation=this.getCorner1Translation(translation);if((corner0Translation==null||corner0Translation.dot(corner0Translation)==0)&&(corner1Translation==null||corner1Translation.dot(corner1Translation)==0)){return null;}
var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];if(corner0Translation!=null){corner0=corner0.add(corner0Translation);}
if(corner1Translation!=null){corner1=corner1.add(corner1Translation);}
return this.getPointsFromCorners(corner0,corner1);};prototype.setEndTransform=function(offsetX,offsetY){if(this.transformAnchorId==null||this.transformOriginX==null||this.transformOriginY==null||this.anchorPoints.length<this.npoints){return;}
var translation=new Vector2D(offsetX-this.transformOriginX,offsetY-this.transformOriginY);var corner0Translation=this.getCorner0Translation(translation);var corner1Translation=this.getCorner1Translation(translation);var noCorner0Translation=corner0Translation==null||corner0Translation.dot(corner0Translation)==0;var noCorner1Translation=corner1Translation==null||corner1Translation.dot(corner1Translation)==0;if(noCorner0Translation&&noCorner1Translation){this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;return;}
var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];var data=this.currentContext!=null?this.currentContext.getData():null;if(!noCorner0Translation){var translatedPoint=corner0.add(corner0Translation);this.anchorPoints[0]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(0,data,this.currentContext,localXPosition,localYPosition);}
if(!noCorner1Translation){var translatedPoint=corner1.add(corner1Translation);this.anchorPoints[1]=translatedPoint;var localXPosition=null;var localYPosition=null;if(translatedPoint!=null){localXPosition=translatedPoint.getX();localYPosition=translatedPoint.getY();}
localXPosition=this.validXPos(localXPosition);this.setPointValue(1,data,this.currentContext,localXPosition,localYPosition);}
this.transformAnchorId=null;this.transformOriginX=null;this.transformOriginY=null;};prototype.getPointsFromCorners=function(corner0,corner1){if(corner0==null||corner1==null){return null;}
if(corner1.equals(corner0)){corner1=new Point2D(corner0.getX()+2,corner0.getY()+2);}
var midX=stjs.trunc(Math.round((corner0.getX()+corner1.getX())/2.0));var midY=stjs.trunc(Math.round((corner0.getY()+corner1.getY())/2.0));var p1=corner0;var p2=new Point2D(corner0.getX(),midY);var p3=new Point2D(corner0.getX(),corner1.getY());var p4=new Point2D(midX,corner1.getY());var p5=corner1;var p6=new Point2D(corner1.getX(),midY);var p7=new Point2D(corner1.getX(),corner0.getY());var p8=new Point2D(midX,corner0.getY());return[p1,p2,p3,p4,p5,p6,p7,p8];};prototype.getCornersFromPoints=function(points){if(points!=null&&points[0]!=null&&points[4]!=null){return[points[0],points[4]];}else{return null;}};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var corner0=this.anchorPoints[0];var corner1=this.anchorPoints[1];var left=corner0.getX();var right=corner1.getX();var top=corner0.getY();var bottom=corner1.getY();if(left>right){left=right;right=corner0.getX();}
if(top>bottom){top=bottom;bottom=corner0.getY();}
top-=InteractiveShape.INSIDE_DISTANCE_MAX;left-=InteractiveShape.INSIDE_DISTANCE_MAX;bottom+=InteractiveShape.INSIDE_DISTANCE_MAX;right+=InteractiveShape.INSIDE_DISTANCE_MAX;return(x>=left&&y>=top&&x<=right&&y<=bottom);};prototype.getCorner0Translation=function(translation){if(this.transformAnchorId==null||translation==null){return null;}
switch(this.transformAnchorId){case-1:case 0:return translation;case 1:case 2:return new Vector2D(translation.getX(),0.0);case 6:case 7:return new Vector2D(0.0,translation.getY());default:return null;}};prototype.getCorner1Translation=function(translation){if(this.transformAnchorId==null||translation==null){return null;}
switch(this.transformAnchorId){case 2:case 3:return new Vector2D(0.0,translation.getY());case-1:case 4:return translation;case 5:case 6:return new Vector2D(translation.getX(),0.0);default:return null;}};prototype.getShapeName=function(){return Rectangle.NAME;};prototype.getNPointsId=function(){return null;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveEllipse=function(areaId,yAxisId){Rectangle.call(this,areaId,yAxisId);};InteractiveEllipse=stjs.extend(InteractiveEllipse,Rectangle,[],function(constructor,prototype){constructor.NAME="ellipse";prototype.getElementsFromPoints=function(points,view,layer,context){var corners=this.getPointsInContext(this.getCornersFromPoints(points),context,view);if(corners!=null&&corners[0]!=null&&corners[1]!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var p1=corners[0];var p2=corners[1];if(p1!=null&&p2!=null){var shapes=[];var x=p1.getX();var y=p1.getY();var width=p2.getX()-x;var height=p2.getY()-y;var radiusX=width/2.0;var radiusY=height/2.0;var centerX=stjs.trunc(Math.round(x+radiusX));var centerY=stjs.trunc(Math.round(y+radiusY));var ellipse=ChartElementFactory.createEllipse(layer,centerX,centerY,radiusX,radiusY);ellipse.setFillColor(this.fillColor);ellipse.setFillShape(this.fillColor!=null);if(InteractiveShape.NO_LINE_STYLE.equals(this.lineStyle)){ellipse.setStrokeColor(ChartColor.transparent);ellipse.setDashed(false);}else{ellipse.setStrokeColor(this.strokeColor);ellipse.setDashed(!InteractiveShape.SOLID_LINE_STYLE.equals(this.lineStyle));}
ellipse.setStrokeShape(this.strokeColor!=null);shapes.push(ellipse);return shapes;}}
return null;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var point=new Point2D(localXPosition,localYPosition);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if(p1!=null&&p2!=null){var x=p1.getX();var y=p1.getY();var width=p2.getX()-x;var height=p2.getY()-y;var radiusX=width/2.0+InteractiveShape.INSIDE_DISTANCE_MAX;var radiusY=height/2.0+InteractiveShape.INSIDE_DISTANCE_MAX;var centerX=stjs.trunc(Math.round(x+radiusX));var centerY=stjs.trunc(Math.round(y+radiusY));var radiusXSquare=radiusX*radiusX;var radiusYSquare=radiusY*radiusY;if(radiusXSquare==0||radiusYSquare==0){return false;}else{var diffXSquare=centerX-localXPosition;diffXSquare=diffXSquare*diffXSquare;diffXSquare/=radiusXSquare;var diffYSquare=centerY-localYPosition;diffYSquare=diffYSquare*diffYSquare;diffYSquare/=radiusYSquare;if((diffXSquare+diffYSquare)<=1){return true;}else{return false;}}}else{return false;}};prototype.getShapeName=function(){return InteractiveEllipse.NAME;};prototype.getNPointsId=function(){return null;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibArcs=function(areaId,yAxisId){Segment.call(this,areaId,yAxisId);this.minLevelDisplayed=2;this.maxLevelDisplayed=FibArcs.LEVELS.length-2;};FibArcs=stjs.extend(FibArcs,Segment,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="far";prototype.localRadius=0;prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var line=lines[0];if(line!=null){var p1=line.getP1();var p2=line.getP2();var croppedLine=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);croppedLine.setStrokeColor(this.strokeColor);croppedLine.setStrokeShape(this.strokeColor!=null);shapes.push(croppedLine);}
var p2=line.getP2();var p1=line.getP1();var startAngle=0;var endAngle=Math.PI;if(p2.getY()>p1.getY()){startAngle=endAngle;endAngle=2*Math.PI;}
var radius=stjs.trunc(Math.round(p1.distanceTo(p2)));for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;++i){var rf=stjs.trunc(((radius*FibArcs.LEVELS[i])/100.0));var currentHalfCircle=ChartElementFactory.createCircle(layer,p2.getX(),p2.getY(),rf);currentHalfCircle.setStartAngle(startAngle);currentHalfCircle.setEndAngle(endAngle);currentHalfCircle.setStrokeColor(this.strokeColor);currentHalfCircle.setStrokeShape(this.strokeColor!=null);shapes.push(currentHalfCircle);}
return shapes;}else{return null;}};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){if(!this.complete){if(InteractiveShape.prototype.addCurrentPositionToShape.call(this,offsetX,offsetY,chart)){this.localRadius=stjs.trunc(Math.round(this.anchorPoints[0].distanceTo(this.anchorPoints[1])));}}
return this.complete;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(Segment.prototype.isInsideCurrentShape.call(this,view,offsetX,offsetY)){return true;}
if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var x=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var y=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if((p2.getY()>p1.getY()&&y>p2.getY())||(p2.getY()<=p1.getY()&&y<p2.getY())){return false;}else{var radius=stjs.trunc(Math.round(p1.distanceTo(p2)));var maxRadius=stjs.trunc(((radius*FibArcs.LEVELS[this.maxLevelDisplayed])/100.0));return p2.distanceTo(new Point2D(x,y))<=maxRadius;}};prototype.getShapeName=function(){return FibArcs.NAME;};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibFans=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.minLevelDisplayed=2;this.maxLevelDisplayed=FibFans.LEVELS.length-2;};FibFans=stjs.extend(FibFans,InfiniteLine,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="ffa";prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainLine=lines[0];var currentLine=mainLine;var mainP1=mainLine.getP1();var mainP2=mainLine.getP2();var croppedLine2D=this.clipAndProjectLine(currentLine,graphBounds);var p1=null;var p2=null;if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;i++){croppedLine2D=this.clipAndProjectLine(this.getFanLevel(mainP1,mainP2,i),graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(true);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}}
return shapes;}else{return null;}};prototype.getFanLevel=function(mainP1,mainP2,level){var fibY=mainP2.getY()-(((mainP2.getY()-mainP1.getY())*FibFans.LEVELS[level])/100);var currentY=stjs.trunc(Math.round(fibY));return new Line2D(mainP1,new Point2D(mainP2.getX(),currentY));};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var boundsTranslation=new Vector2D(graphBounds.getContentLeft(),graphBounds.getContentTop());var point=new Point2D(offsetX,offsetY);var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];if(p1!=null&&p2!=null){p1=p1.add(boundsTranslation);p2=p2.add(boundsTranslation);}else{return false;}
var mainLine=new Line2D(p1,p2);var otherExtremityLine=this.getFanLevel(p1,p2,this.maxLevelDisplayed);var borders=graphBounds.getInnerBordersLines();var mainLineOtherPoint=this.getFurthestPointInDirection(p1,p2,borders);var otherExtremityFurtherPoint=this.getFurthestPointInDirection(p1,otherExtremityLine.getP2(),borders);return mainLine.distFromSegment(point)<=InteractiveShape.INSIDE_DISTANCE_MAX||MathUtil.isPointInsideTriangle(point,p1,mainLineOtherPoint,otherExtremityFurtherPoint);};prototype.getFurthestPointInDirection=function(p1,p2,borders){var maxDist=0;var furthestPoint=null;var mainLine=new Line2D(p1,p2);for(var index in borders){if(!(borders).hasOwnProperty(index))
continue;var border=borders[index];if(border!=null){var intersection=border.getIntersectionPoint(mainLine);if(intersection!=null&&intersection.distanceSquared(p2)<intersection.distanceSquared(p1)){var currentDist=intersection.distanceSquared(p2);if(currentDist>maxDist){maxDist=currentDist;furthestPoint=intersection;}}}}
return furthestPoint;};prototype.getShapeName=function(){return FibFans.NAME;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibRetracements=function(areaId,yAxisId){InfiniteLine.call(this,areaId,yAxisId);this.minLevelDisplayed=0;this.maxLevelDisplayed=FibRetracements.LEVELS.length-1;};FibRetracements=stjs.extend(FibRetracements,InfiniteLine,[],function(constructor,prototype){constructor.LEVELS=[0.0,23.6,38.2,50.0,61.8,100.0];constructor.NAME="fre";prototype.minLevelDisplayed=0;prototype.maxLevelDisplayed=0;prototype.getElementsFromPoints=function(points,view,layer,context){var lines=this.getLinesInContext(points,context,view);if(lines!=null&&lines[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainLine=lines[0];var mainP1=mainLine.getP1();var mainP2=mainLine.getP2();var tmpX=mainP1.getX();var tmpX2=tmpX+1;for(var i=this.minLevelDisplayed;i<=this.maxLevelDisplayed;i++){var fibY=mainP2.getY()-(((mainP2.getY()-mainP1.getY())*FibRetracements.LEVELS[i])/100);var currentY=stjs.trunc(Math.round(fibY));var intermediatePoint1=new Point2D(tmpX,currentY);var intermediatePoint2=new Point2D(tmpX2,currentY);var croppedLine2D=this.projectLineOnBounds(new Line2D(intermediatePoint1,intermediatePoint2),graphBounds);if(croppedLine2D!=null){var p1=croppedLine2D.getP1();var p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(i>this.minLevelDisplayed&&i<this.maxLevelDisplayed);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}}
return shapes;}else{return null;}};prototype.getAnchorPoints=function(layer,view,chartData,context){var anchorElements=InteractiveShape.prototype.getAnchorPoints.call(this,layer,view,chartData,context);if(anchorElements!=null){var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var xCenter=stjs.trunc(Math.round(graphBounds.getContentLeft()+(graphBounds.getContentWidth()/2.0)));for(var index in anchorElements){if(!(anchorElements).hasOwnProperty(index))
continue;var currentElement=anchorElements[index];if(currentElement!=null){currentElement.setX(xCenter);}}}
return anchorElements;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localYPosition=stjs.trunc(Math.round(offsetY-graphBounds.getContentTop()));var p1=this.anchorPoints[0];var p2=this.anchorPoints[1];var minY=p1.getY();var maxY=p2.getY();if(minY>maxY){maxY=minY;minY=p2.getY();}
minY-=InteractiveShape.INSIDE_DISTANCE_MAX;maxY+=InteractiveShape.INSIDE_DISTANCE_MAX;return localYPosition>=minY&&localYPosition<=maxY;};prototype.getShapeName=function(){return FibRetracements.NAME;};prototype.getNPointsId=function(){return String.valueOf(this.npoints);};},{LEVELS:{name:"Array",arguments:[null]},pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var FibTimeZones=function(areaId,yAxisId){InfiniteVerticalLine.call(this,areaId,yAxisId);this.currentStepRatio=1.0;};FibTimeZones=stjs.extend(FibTimeZones,InfiniteVerticalLine,[],function(constructor,prototype){constructor.N_FIB_ZONES=15;constructor.NAME="ftz";prototype.currentStepRatio=0.0;prototype.getElementsFromPoints=function(points,view,layer,context){var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){var shapes=[];var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var mainP1=pointsInContext[0];var mainP2=new Point2D(mainP1.getX(),mainP1.getY()+1);var mainLine=new Line2D(mainP1,mainP2);var currentLine=mainLine;var croppedLine2D=this.projectLineOnBounds(currentLine,graphBounds);var p1=null;var p2=null;if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
var p1Y=mainP2.getY();var p2Y=p1Y+1;var stepValue=this.currentStepRatio;if(stepValue==null||stepValue==0){stepValue=1.0;}
var x=mainP1.getX();var nFib0=0.0;var nFib1=stepValue;for(var i=0;i<FibTimeZones.N_FIB_ZONES;++i){var nFib=nFib0+nFib1;x+=stjs.trunc(Math.round(nFib));var intermediatePoint1=new Point2D(x,p1Y);var intermediatePoint2=new Point2D(x,p2Y);croppedLine2D=this.projectLineOnBounds(new Line2D(intermediatePoint1,intermediatePoint2),graphBounds);if(croppedLine2D!=null){p1=croppedLine2D.getP1();p2=croppedLine2D.getP2();var currentLineElement=ChartElementFactory.createLine(layer,p1.getX(),p1.getY(),p2.getX(),p2.getY(),this.lineWidth);currentLineElement.setDashed(true);currentLineElement.setStrokeColor(this.strokeColor);currentLineElement.setStrokeShape(this.strokeColor!=null);shapes.push(currentLineElement);}
nFib0=nFib1;nFib1=nFib;}
return shapes;}else{return null;}};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){if(!this.complete){if(InteractiveShape.prototype.addCurrentPositionToShape.call(this,offsetX,offsetY,chart)){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);var context=chart.getEngineModel().getContext();var xRange=context.getRange(Serie.X);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()||xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]){return this.complete;}
var areaBound=currentArea.getAreaBound();var width=areaBound.getContentWidth();var newValueLength=(xRange[1]-xRange[0]);this.currentStepRatio=width/newValueLength;}}
return this.complete;};prototype.updateContext=function(data,context,view){InteractiveShape.prototype.updateContext.call(this,data,context,view);if(context==null||view==null||view.getArea(this.associatedAreaId)==null){return;}
var area=view.getArea(this.associatedAreaId);var xRange=context.getRange(Serie.X);if(area==null||area.getAreaBound()==null||xRange==null||xRange[0]==null||xRange[1]==null||xRange[0]==xRange[1]){return;}
var areaBound=area.getAreaBound();var width=areaBound.getContentWidth();var newValueLength=(xRange[1]-xRange[0]);this.currentStepRatio=width/newValueLength;};prototype.isInsideCurrentShape=function(view,offsetX,offsetY){if(view==null||this.anchorPoints.length<this.npoints||view.getArea(this.associatedAreaId)==null){return false;}
var area=view.getArea(this.associatedAreaId);var graphBounds=area.getAreaBound();var localXPosition=stjs.trunc(Math.round(offsetX-graphBounds.getContentLeft()));var p1=this.anchorPoints[0];var x=p1.getX();var minX=x-InteractiveShape.INSIDE_DISTANCE_MAX;var maxX=x+4*InteractiveShape.INSIDE_DISTANCE_MAX;return localXPosition>=minX&&localXPosition<=maxX;};prototype.getShapeName=function(){return FibTimeZones.NAME;};},{pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveText=function(areaId,yAxisId){Rectangle.call(this,areaId,yAxisId);this.fontSize=InteractiveText.DEFAULT_FONT_SIZE;this.currentWidth=InteractiveText.DEFAULT_TEXT_AREA_WIDTH;this.currentHeight=InteractiveText.DEFAULT_TEXT_AREA_HEIGHT;this.textColor=ChartColor.black;this.fillColor=ChartColor.transparent;this.lineStyle=InteractiveShape.SOLID_LINE_STYLE;this.font=InteractiveText.DEFAULT_FONT;this.editMode=true;this.text="";this.fistFocus=true;};InteractiveText=stjs.extend(InteractiveText,Rectangle,[],function(constructor,prototype){constructor.NAME="text";constructor.DEFAULT_TEXT_AREA_WIDTH=20;constructor.DEFAULT_FONT_SIZE=12;constructor.DEFAULT_TEXT_AREA_HEIGHT=22;constructor.DEFAULT_FONT="Arial, Helvetica, sans-serif";prototype.interactiveTextArea=null;constructor.onTextChangeCallback={};prototype.currentWidth=0;prototype.currentHeight=0;prototype.font=null;prototype.text=null;prototype.labelArea=null;prototype.fistFocus=false;prototype.editMode=false;prototype.selected=false;prototype.hovered=false;prototype.currentBlurEventHandler=null;prototype.keypressEventHandler=null;prototype.getElementsFromPoints=function(points,view,layer,context){var self=this;var pointsInContext=this.getPointsInContext(points,context,view);if(pointsInContext!=null&&pointsInContext[0]!=null){this.calculateSize();var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);var upperLeftPoint=pointsInContext[0];var xCenter=upperLeftPoint.getX()+stjs.trunc(Math.round(this.currentWidth/2.0));var yCenter=upperLeftPoint.getY()+stjs.trunc(Math.round(this.currentHeight/2.0));if(this.fistFocus){this.fistFocus=false;this.setEditMode(view,context);return null;}
if(this.editMode){return null;}
this.labelArea=ChartElementFactory.createDrawTextLabel(layer,null,this.text,xCenter,yCenter,this.currentWidth,this.currentHeight);this.labelArea.setAlign(Label.ALIGN_CENTER);this.labelArea.setLineHeight(InteractiveText.DEFAULT_TEXT_AREA_HEIGHT);this.labelArea.setBaseline(Label.BASELINE_MIDDLE);this.labelArea.setBorderColor(this.strokeColor);this.labelArea.setColor(this.textColor);this.labelArea.setTextColor(this.textColor);this.labelArea.setFont(this.font);this.labelArea.setFontSize(this.fontSize);if(this.hovered){this.labelArea.setHovered(true);}
if(this.selected){this.labelArea.setSelected(true);this.labelArea.setTextColor(this.textColor.getChartColorWithAlpha(0.3));}
var shapes=null;if(this.strokeColor!=null){shapes=InfiniteLine.prototype.getElementsFromPoints.call(this,points,view,layer,context);}
if(shapes==null){shapes=[];}
shapes.push(this.labelArea);return shapes;}
return null;};prototype.select=function(){this.hovered=false;this.selected=true;};prototype.hover=function(){this.hovered=true;this.selected=false;};prototype.dblclick=function(view,context){this.setEditMode(view,context);};prototype.setEditMode=function(view,context){var self=this;var pointsInContext=this.getPointsInContext(this.anchorPoints,context,view);if(pointsInContext!=null&&pointsInContext.length>=this.npoints){var area=view.getArea(this.associatedAreaId);var corner1=pointsInContext[0];var viewParent=view.getParentElement();if(this.interactiveTextArea==null){this.interactiveTextArea=new InteractiveTextArea(viewParent,new Point2D(corner1.getX()-5,corner1.getY()-5),this.text,function(){self.updateTextFromInput();viewParent.trigger("updateSelectedElement");});}
this.interactiveTextArea.setFontSize(this.fontSize);this.interactiveTextArea.setFontColor(this.textColor);this.interactiveTextArea.setBorderColor(this.strokeColor);this.interactiveTextArea.setBackgroundColor(this.fillColor);this.interactiveTextArea.setBorderStyle(this.lineStyle);this.hovered=false;this.editMode=true;this.selected=false;}};prototype.getAnchorPoints=function(layer,view,chartData,context){return null;};prototype.blur=function(){this.currentBlurEventHandler=null;this.hovered=false;this.selected=false;this.complete=true;if(this.interactiveTextArea!=null){this.interactiveTextArea.blur();}
this.editMode=false;};prototype.updateTextFromInput=function(){var currentMaxWidth=this.interactiveTextArea.getWidth();var currentMaxHeight=this.interactiveTextArea.getHeight();this.currentWidth=currentMaxWidth;this.currentHeight=currentMaxHeight;var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);this.text=this.interactiveTextArea.getText();this.currentBlurEventHandler=null;this.editMode=false;this.selected=false;this.hovered=false;this.complete=true;this.interactiveTextArea=null;};prototype.addCurrentPositionToShape=function(offsetX,offsetY,chart){var currentArea=chart.getChartView().getAreaFromPosition(offsetX,offsetY);var validArea=chart.getChartView().getArea(this.associatedAreaId);if(currentArea==null||currentArea.getAreaBound()==null||chart==null||currentArea.getId()!=validArea.getId()){return false;}else if(this.anchorPoints.length>=this.npoints){return true;}
var context=chart.getEngineModel().getContext();var areaBound=currentArea.getAreaBound();this.currentWidth=InteractiveText.DEFAULT_TEXT_AREA_WIDTH;var maxInputWidth=stjs.trunc((areaBound.getRight()))-offsetX;if(this.currentWidth>maxInputWidth){this.currentWidth=maxInputWidth;}
var upperLeftX=stjs.trunc(Math.round(offsetX-areaBound.getContentLeft()-stjs.trunc(this.currentWidth/2)));var upperLeftY=stjs.trunc(Math.round(offsetY-areaBound.getContentTop()-stjs.trunc(this.currentHeight/2)));var lowerRightX=upperLeftX+this.currentWidth;var lowerRightY=upperLeftY+this.currentHeight;this.contextXRange=context.getRange(Serie.X);this.contextYRange=context.getRange(this.yAxisAreaId);this.contextWidth=areaBound.getWidth();this.contextHeight=areaBound.getHeight();var referencePoint=this.calculatePointBetweenPoints2D(new Point2D(upperLeftX,upperLeftY),new Point2D(lowerRightX,lowerRightY));this.anchorPoints=this.calculateAnchorPoints(referencePoint);this.addPointValue(chart.getChartData(),context,referencePoint.getX(),referencePoint.getY());this.complete=true;return this.complete;};prototype.updateContext=function(data,context,view){InteractiveShape.prototype.updateContext.call(this,data,context,view);if(this.anchorPoints!=null&&this.anchorPoints[0]!=null){var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.anchorPoints=this.calculateAnchorPoints(referencePoint);}};prototype.setEndTransform=function(offsetX,offsetY){Rectangle.prototype.setEndTransform.call(this,offsetX,offsetY);this.pointsValues=[];var data=this.currentContext!=null?this.currentContext.getData():null;var referencePoint=this.calculatePointBetweenPoints2D(this.anchorPoints[0],this.anchorPoints[1]);this.setPointValue(0,data,this.currentContext,referencePoint.getX(),referencePoint.getY());};prototype.isHovered=function(){return this.hovered;};prototype.isSelected=function(){return this.selected;};prototype.isEditMode=function(){return this.editMode;};prototype.getCurrentTextHeight=function(){return this.fontSize+2*DefaultLayout.DEFAULT_PADDING_PIXELS;};prototype.getCurrentFontSize=function(){return this.fontSize;};prototype.setCurrentFontSize=function(currentFontSize){this.fontSize=currentFontSize;};prototype.getTextColor=function(){return this.textColor;};prototype.setTextColor=function(textColor){this.textColor=textColor;};prototype.getShapeName=function(){return InteractiveText.NAME;};prototype.setOriginTransform=function(anchor,offsetX,offsetY){InteractiveShape.prototype.setOriginTransform.call(this,-1,offsetX,offsetY);};constructor.registerTextChangeCallback=function(uId,onBlurEventHandler){InteractiveText.onTextChangeCallback[uId]=onBlurEventHandler;};constructor.unregisterTextChangeCallback=function(uId){delete InteractiveText.onTextChangeCallback[uId];};constructor.blurAll=function(chart){var engine=chart.getEngineModel().getEngine(DrawEngine.ID);var drawElements=engine.getDrawElements();for(var i=0;i<drawElements.length;i++){if(drawElements!=null&&stjs.isInstanceOf(drawElements[i].constructor,InteractiveText)){(drawElements[i]).blur();}}};constructor.blurAllExceptProvided=function(drawEngine,textLabelToAvoidBlur){var drawElements=drawEngine.getDrawElements();for(var i=0;i<drawElements.length;i++){if(drawElements!=null&&stjs.isInstanceOf(drawElements[i].constructor,InteractiveText)&&drawElements[i]!=textLabelToAvoidBlur){(drawElements[i]).blur();}}};constructor.isDrawEngineCompatible=function(drawEngine){return InteractiveShapeFactory.TEXT_TYPE.equals(drawEngine.getCurrentDrawType())||DrawEngine.MOVE_MODE.equals(drawEngine.getCurrentMode());};prototype.serialize=function(){var content="";var pointsId=this.getNPointsId();if(pointsId!=null){content=XMLUtil.createNodeString("npoints",pointsId);}
content+=XMLUtil.createNodeString("group",this.groupId);content+=InfiniteLine.getStringFromArray("points",[this.calculateLabelCenterPoint()]);content+=this.getStyleString();var escapedText=this.text!=null?encodeURIComponent(this.text):"";content+=XMLUtil.createNodeString("text",escapedText);return XMLUtil.createNodeString(this.getShapeName(),content);};prototype.initShapeFromXML=function(currentFigure){var rawText=XMLUtil.getValue(currentFigure,"text");try{this.text=decodeURIComponent(rawText);}catch(ex){this.text="";}
this.fistFocus=false;this.editMode=false;this.calculateSize();var itemNodes=XMLUtil.getChildNodes(currentFigure,"points");if(itemNodes!=null&&itemNodes.length>0){if(itemNodes.length==1){var centerPointItemNode=itemNodes[0];if(centerPointItemNode!=null){this.pointsValues=[this.convertXMLNodeItemToPoint(centerPointItemNode)];}else{return false;}}else{var upperLeftItemNode=itemNodes[0];var lowerRightItemNode=itemNodes[1];var upperLeftPoint=this.convertXMLNodeItemToPoint(upperLeftItemNode);var lowerRightPoint=this.convertXMLNodeItemToPoint(lowerRightItemNode);this.pointsValues=[this.calculatePointBetweenPoints2Df(upperLeftPoint,lowerRightPoint)];}
return true;}
return false;};prototype.initAnchorPointsFromPointsValues=function(data,context,view){InteractiveShape.prototype.initAnchorPointsFromPointsValues.call(this,data,context,view);for(var i=0;i<this.anchorPoints.length;i++){var anchorPoint=this.anchorPoints[i];if(anchorPoint!=null){var translatedAnchorPoint=anchorPoint.add(new Vector2D(-this.currentWidth/2,-this.currentHeight/2));this.anchorPoints[i]=translatedAnchorPoint;}}};prototype.convertXMLNodeItemToPoint=function(xmlNodeItem){if(xmlNodeItem==null){return null;}
var pointData=(xmlNodeItem.textContent).split(",");var x=parseFloat(pointData[0]);var y=parseFloat(pointData[1]);if(x!=null&&y!=null&&!isNaN(x)&&!isNaN(y)){return new Point2Df(x,y);}
return null;};prototype.calculateLabelCenterPoint=function(){if(this.pointsValues==null||this.pointsValues.length==0||this.pointsValues[0]==null){return null;}else if(this.pointsValues.length==1){return new Point2Df(this.pointsValues[0].getX(),this.pointsValues[0].getY());}
return this.calculatePointBetweenPoints2Df(this.pointsValues[0],this.pointsValues[1]);};prototype.calculatePointBetweenPoints2Df=function(point1,point2){var point1X=point1.getX();var point1Y=point1.getY();if(point2!=null){var point2X=point2.getX();var point2Y=point2.getY();var pointBetweenX=point1X+(point2X-point1X)/2;var pointBetweenY=point1Y+(point2Y-point1Y)/2;return new Point2Df(pointBetweenX,pointBetweenY);}
return new Point2Df(point1X+stjs.trunc(this.currentWidth/2),point1Y+stjs.trunc(this.currentHeight/2));};prototype.calculatePointBetweenPoints2D=function(point1,point2){var point1X=point1.getX();var point1Y=point1.getY();if(point2!=null){var point2X=point2.getX();var point2Y=point2.getY();var pointBetweenX=point1X+stjs.trunc((point2X-point1X)/2);var pointBetweenY=point1Y+stjs.trunc((point2Y-point1Y)/2);return new Point2D(pointBetweenX,pointBetweenY);}
return new Point2D(point1X+stjs.trunc(this.currentWidth/2),point1Y+stjs.trunc(this.currentHeight/2));};prototype.calculateAnchorPoints=function(referencePoint){var upperLeftPoint=new Point2D(referencePoint.getX()-stjs.trunc(this.currentWidth/2),referencePoint.getY()-stjs.trunc(this.currentHeight/2));var lowerRightPoint=new Point2D(referencePoint.getX()+stjs.trunc(this.currentWidth/2),referencePoint.getY()+stjs.trunc(this.currentHeight/2));return[upperLeftPoint,lowerRightPoint];};prototype.calculateSize=function(){var textAreaSelector=InteractiveTextArea.getStubForSizeCalculation(this.text,this.fontSize);var hiddenTextCopyContainer=textAreaSelector.find(".TextAreaContainer__hiddenTextCopy");$("body").append(textAreaSelector);this.currentWidth=parseInt(hiddenTextCopyContainer.outerWidth());this.currentHeight=parseInt(hiddenTextCopyContainer.outerHeight());textAreaSelector.remove();};},{interactiveTextArea:"InteractiveTextArea",onTextChangeCallback:{name:"Map",arguments:[null,{name:"Callback1",arguments:["SqwJQuery"]}]},labelArea:"EditableCanvasLabel",currentBlurEventHandler:"EventHandler",keypressEventHandler:"EventHandler",pointsValues:{name:"Array",arguments:["Point2Df"]},anchorPoints:{name:"Array",arguments:["Point2D"]},currentPosition:"Point2D",currentContext:"ChartContext",contextXRange:{name:"Array",arguments:[null]},contextYRange:{name:"Array",arguments:[null]},contextFreq:"Frequency",textColor:"ChartColor",strokeColor:"ChartColor",fillColor:"ChartColor"},{});
var InteractiveTextArea=function(parent,positionPoint,text,updateTextCallback){this.parent=parent;this.positionPoint=positionPoint;this.text=text;this.updateTextCallback=updateTextCallback;this.renderTextArea(text).appendTo(parent);this.setFocusToTextAreaEnd();this.referencePoint=this.calculateReferencePoint(positionPoint);this.initHandlers();};InteractiveTextArea=stjs.extend(InteractiveTextArea,null,[],function(constructor,prototype){constructor.ENTER_KEYCODE=13;constructor.ENTER_WITH_CTRL_KEYCODE=10;constructor.DELETE_KEYCODE=46;constructor.CUSTOM_NEWLINE_SYMBOL="[n]";constructor.SELECTED_LABEL_BORDER_ALPHA=0.3;prototype.textAreaContainer=null;prototype.textArea=null;prototype.hiddenTextCopy=null;prototype.parent=null;prototype.positionPoint=null;prototype.referencePoint=null;prototype.text=null;prototype.updateTextCallback=null;prototype.renderTextArea=function(text){this.textAreaContainer=SQW.$("<div class='TextAreaContainer'>");this.textArea=SQW.$("<textarea class='TextAreaContainer__textArea'>").text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));this.textAreaContainer.append(this.textArea);var selectionIndicators=SQW.$("<span class='TextAreaContainer__verticalSelectionIndicators'/><span class='TextAreaContainer__horizontalSelectionIndicators'/>");this.textAreaContainer.append(selectionIndicators);this.hiddenTextCopy=SQW.$("<span class='TextAreaContainer__hiddenTextCopy'>");this.hiddenTextCopy.text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));this.textAreaContainer.append(this.hiddenTextCopy);var referencePoint=SQW.$("<span class='TextLabelContainer__referencePointAxisY'/><span class='TextLabelContainer__referencePointAxisX'/>");this.textAreaContainer.append(referencePoint);this.textAreaContainer.css("top",this.positionPoint.getY()+"px");this.textAreaContainer.css("left",this.positionPoint.getX()+"px");return this.textAreaContainer;};prototype.initHandlers=function(){var self=this;this.textAreaContainer.on("blur",".TextAreaContainer__textArea",stjs.bind(this,function(ev,THIS){self.blur();return false;},1));this.textAreaContainer.on("keydown",".TextAreaContainer__textArea",stjs.bind(this,function(ev,THIS){if(ev.keyCode==InteractiveTextArea.ENTER_WITH_CTRL_KEYCODE||(ev.ctrlKey||ev.altKey)&&ev.keyCode==InteractiveTextArea.ENTER_KEYCODE){self.insertEnterAtCaret();self.textArea.trigger("input");ev.preventDefault();}else if(ev.keyCode==InteractiveTextArea.ENTER_KEYCODE){self.blur();}else if(ev.keyCode==InteractiveTextArea.DELETE_KEYCODE){ev.stopPropagation();}
return true;},1));this.textArea.on("input selectionchange",stjs.bind(this,function(ev,THIS){self.hiddenTextCopy.text(self.textArea.val());self.updateTextAreaPosition();return true;},1));this.textArea.on("click mousedown mousemove",stjs.bind(this,function(ev,THIS){ev.stopPropagation();return true;},1));};prototype.blur=function(){this.text=this.convertLineBreaksToCustomSymbol(this.textArea.val());this.updateTextCallback();this.textAreaContainer.remove();};constructor.getStubForSizeCalculation=function(text,fontSize){var hiddenTextCopyContainer=SQW.$("<span class='TextAreaContainer__hiddenTextCopy'>").text(InteractiveTextArea.convertLineBreaksToNewLineSymbol(text));hiddenTextCopyContainer.css("font-size",fontSize);return SQW.$("<div class='TextAreaContainer'>").append(hiddenTextCopyContainer);};constructor.getColor=function(){return SQW.$("<textarea class='TextAreaContainer__textArea'>").css("border-color");};prototype.setBorderColor=function(color){if(color!=null){this.textArea.css("border-color",color.getFlatColor());this.textAreaContainer.css("border-color",color.getChartColorWithAlpha(InteractiveTextArea.SELECTED_LABEL_BORDER_ALPHA).getFlatColor());}};prototype.setFontColor=function(color){if(color!=null){this.textArea.css("color",color.getFlatColor());}};prototype.setBorderStyle=function(style){if(style!=null){this.textArea.css("border-style",style);}};prototype.setBackgroundColor=function(color){if(color!=null){this.textArea.css("background-color",color.getFlatColor());}};prototype.setFontSize=function(size){this.textArea.css("font-size",size);this.hiddenTextCopy.css("font-size",size);this.referencePoint=this.calculateReferencePoint(this.positionPoint);};prototype.getWidth=function(){return this.textArea.outerWidth()-2*this.getBorderWidth();};prototype.getHeight=function(){return this.textArea.outerHeight()-2*this.getBorderWidth();};prototype.getBorderWidth=function(){return parseInt(this.textArea.css("border-top-width"));};prototype.getText=function(){return this.text;};constructor.convertLineBreakToHTMLtag=function(textLine){return textLine.replace(/(?:\r\n|\r|\n|\[n\])/g,"<br />");};constructor.convertLineBreaksToNewLineSymbol=function(textLine){return textLine.replace(/(?:\[n\])/g,"\n");};prototype.convertLineBreaksToCustomSymbol=function(textLine){return textLine.replace(/(?:\n)/g,"[n]");};prototype.insertEnterAtCaret=function(){var selectionStart=parseInt(this.textArea.prop("selectionStart"));var selectionEnd=parseInt(this.textArea.prop("selectionEnd"));var textAreaValue=(this.textArea.val());var front=textAreaValue.substring(0,selectionStart);var back=textAreaValue.substring(selectionEnd,textAreaValue.length);this.textArea.val(front+"\n"+back);selectionStart=selectionStart+1;this.textArea.prop("selectionStart",selectionStart);this.textArea.prop("selectionEnd",selectionStart);this.textArea.focus();};prototype.calculateReferencePoint=function(positionPoint){var left=positionPoint.getX()+stjs.trunc(this.getWidth()/2);var top=positionPoint.getY()+stjs.trunc(this.getHeight()/2);return new Point2D(left,top);};prototype.updateTextAreaPosition=function(){var left=this.referencePoint.getX()-stjs.trunc(this.getWidth()/2);var top=this.referencePoint.getY()-stjs.trunc(this.getHeight()/2);this.textAreaContainer.css("top",top+"px");this.textAreaContainer.css("left",left+"px");};prototype.setFocusToTextAreaEnd=function(){var textAreaValue=(this.textArea.val());this.textArea.prop("selectionStart",textAreaValue.length);this.textArea.prop("selectionEnd",textAreaValue.length);this.textArea.focus();};},{textAreaContainer:"SqwJQuery",textArea:"SqwJQuery",hiddenTextCopy:"SqwJQuery",parent:"SqwJQuery",positionPoint:"Point2D",referencePoint:"Point2D",updateTextCallback:"Callback0"},{});
var InteractiveShapeFactory=function(){};InteractiveShapeFactory=stjs.extend(InteractiveShapeFactory,null,[],function(constructor,prototype){constructor.AREA_0_ID="area_0";constructor.AREA_1_ID="area_1";constructor.TYPE_VERTICAL=-1;constructor.TYPE_HORIZONTAL=-2;constructor.TYPE_INFINITE_LINE=-3;constructor.TEXT_TYPE="textMode";constructor.FREE_LINE_TYPE="freeLineMode";constructor.SEGMENT_TYPE="segmentMode";constructor.HORIZONTAL_LINE_TYPE="horizontalLineMode";constructor.VERTICAL_LINE_TYPE="verticalLineMode";constructor.ELLIPSE_TYPE="ellipseMode";constructor.RECTANGLE_TYPE="rectangleMode";constructor.TRIANGLE_TYPE="triangleMode";constructor.QUADRI_TYPE="quadriMode";constructor.FIB_FANS_TYPE="fibFansMode";constructor.FIB_RETRACEMENT_TYPE="fibRetracMode";constructor.FIB_TIME_ZONES_TYPE="fibTimeZonesMode";constructor.FIB_ARCS_TYPE="fibArcsMode";constructor.createInteractiveShape=function(shapeType,areaId,yAxisId){if(shapeType==InteractiveShapeFactory.FREE_LINE_TYPE){return new InfiniteLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.SEGMENT_TYPE){return new Segment(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.HORIZONTAL_LINE_TYPE){return new InfiniteHorizontalLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.VERTICAL_LINE_TYPE){return new InfiniteVerticalLine(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.ELLIPSE_TYPE){return new InteractiveEllipse(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.RECTANGLE_TYPE){return new Rectangle(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.TRIANGLE_TYPE){return new Triangle(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.QUADRI_TYPE){return new Quadrilateral(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_FANS_TYPE){return new FibFans(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_RETRACEMENT_TYPE){return new FibRetracements(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_TIME_ZONES_TYPE){return new FibTimeZones(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.FIB_ARCS_TYPE){return new FibArcs(areaId,yAxisId);}else if(shapeType==InteractiveShapeFactory.TEXT_TYPE){return new InteractiveText(areaId,yAxisId);}
return null;};constructor.createInteractiveShapeFromXML=function(currentFigure,areaName){if(currentFigure==null){return null;}
var areaId=null;var yAxisId=null;if(areaName==InteractiveShapeFactory.AREA_0_ID){areaId=DefaultLayout.GRAPH_AREA;yAxisId=DefaultLayout.Y1_AXIS_AREA;}else if(areaName==InteractiveShapeFactory.AREA_1_ID){areaId=FinancialLayout.BOTTOM_GRAPH_AREA;yAxisId=FinancialLayout.BOTTOM_AXIS_LEFT;}else{return null;}
var shapeType=InteractiveShapeFactory.getShapeTypeFromNode(currentFigure);if(shapeType!=null){var shape=InteractiveShapeFactory.createInteractiveShape(shapeType,areaId,yAxisId);var valid=shape.unserializeFromXML(currentFigure);return valid?shape:null;}else{return null;}};constructor.getShapeTypeFromNode=function(currentFigure){if(currentFigure.nodeName==InfiniteLine.NAME){var pointsCount=parseInt(XMLUtil.getValue(currentFigure,"npoints"));if(pointsCount==null||isNaN(pointsCount)){return null;}
switch(pointsCount){case InteractiveShapeFactory.TYPE_VERTICAL:return InteractiveShapeFactory.VERTICAL_LINE_TYPE;case InteractiveShapeFactory.TYPE_HORIZONTAL:return InteractiveShapeFactory.HORIZONTAL_LINE_TYPE;case InteractiveShapeFactory.TYPE_INFINITE_LINE:return InteractiveShapeFactory.FREE_LINE_TYPE;case 2:return InteractiveShapeFactory.SEGMENT_TYPE;case 3:return InteractiveShapeFactory.TRIANGLE_TYPE;case 4:return InteractiveShapeFactory.QUADRI_TYPE;default:return null;}}else if(currentFigure.nodeName==InteractiveEllipse.NAME){return InteractiveShapeFactory.ELLIPSE_TYPE;}else if(currentFigure.nodeName==Rectangle.NAME){return InteractiveShapeFactory.RECTANGLE_TYPE;}else if(currentFigure.nodeName==FibArcs.NAME){return InteractiveShapeFactory.FIB_ARCS_TYPE;}else if(currentFigure.nodeName==FibFans.NAME){return InteractiveShapeFactory.FIB_FANS_TYPE;}else if(currentFigure.nodeName==FibRetracements.NAME){return InteractiveShapeFactory.FIB_RETRACEMENT_TYPE;}else if(currentFigure.nodeName==FibTimeZones.NAME){return InteractiveShapeFactory.FIB_TIME_ZONES_TYPE;}else if(currentFigure.nodeName==InteractiveText.NAME){return InteractiveShapeFactory.TEXT_TYPE;}else{return null;}};},{},{});
(function($){$.fn.stocksearch=function(options){var settings=$.extend({},$.fn.stocksearch.defaults,options);return this.each(function(){$.stocksearch(this,settings);});};$.stocksearch=function(elm,settings){var elm=$(elm)[0];return elm.stocksearch||(elm.stocksearch=new $._stocksearch(elm,settings));}
$._stocksearch=function(elm,settings){var ss=this;ss.settings=settings;var $elm=$(elm);var prevVal=null;var mark=function(s,sub){var pos=s.toLowerCase().indexOf(sub.toLowerCase());if(pos!=0)
return s;return"<b>"+s.substring(0,sub.length)+"</b>"+s.substring(sub.length);}
var doSearch=function(){if(prevVal==$elm.val()||""==$elm.val()||$elm.val()==$elm.attr("explanation"))
return;var type="",market="";var url=settings.url.replace("$stock",$elm.val()).replace("$type",type).replace("$market",market);prevVal=$elm.val();$.ajax({url:url,dataType:"text",complete:function(res,status){if(status=="success"){stringToObjectArray(settings.headerLine+"\n"+res.responseText,ss);var list="<table>";for(var i=0;i<ss.rows.length;++i){var key=ss.rows[i].isin+"_"+ss.rows[i].exchangeId+"_"+ss.rows[i].currency;list+="<tr id='"+key+"' name='"+ss.rows[i].name+"'>";var market="<td class='market'>"+ss.rows[i].market+"</td>";var symbol=ss.rows[i].symbol||"";if(symbol.length>7)symbol=symbol.substring(0,8);var name="<td class='symbol'>"+mark(symbol,prevVal)+"</td><td>"+mark(ss.rows[i].name,prevVal)+"</td>";var currency="<td class='currency'>"+ss.rows[i].currency+"<img src='/gifs/flag_"+ss.rows[i].currency.toUpperCase()+".gif'></td>";list+=name+market+currency;list+="</tr>";}
list+="</table>";$("#search-results").html(list);}else{}}});}
$elm.focus(function(){bindSearchResultClickHandler();if($("#search-results").length==0){$("<div id='search-results'></div>").appendTo(document.body);$("#search-results").click(function(e){var elem=e.target.tagName.toLowerCase()=="tr"?$(e.target):$(e.target).parents("tr");settings.action(elem.attr("id"),elem.attr("name"));$("#search-results").hide();}).mousemove(function(e){$("#search-results tr").removeClass("hover");});}
var eoff=$elm.offset();var additionalHeight=0;if($elm.attr('data-offset')){additionalHeight=parseInt($elm.attr('data-offset'));}
$("#search-results").css({left:eoff.left,top:eoff.top+$elm.height()+10+additionalHeight});if($elm.val().length>0){$("#search-results").show();}else{$("#search-results").hide();}
ss.timer=setInterval(doSearch,settings.interval);});$elm.blur(function(){clearInterval(ss.timer);});var current=-1;var highlight=function(){current=Math.min(Math.max(current,0),$("#search-results tr").length-1);$("#search-results tr").removeClass("hover");$("#search-results tr:eq("+current+")").addClass("hover");}
var checkKey=function(e){var key=e.keyCode;if(!key&&e.which)
key=e.which;var results=$("#search-results");if(!results.is(":visible")){results.show();}
switch(key)
{case 40:current++;highlight();break;case 38:current--;highlight();break;case 13:if(current<0)current=0;settings.action($("#search-results tr:eq("+current+")").attr('id'),$("#search-results tr:eq("+current+")").attr('name'));results.hide();current=0;break;case 27:results.hide();break;}};if($.browser.mozilla){$elm.keypress(checkKey);}else{$elm.keydown(checkKey);}
var setSearchResultClickHandler=function(event){if(!$(event.target).is("#search-results")&&!$(event.target).is($elm)){$("#search-results").hide(0,unbindSearchResultClickHandler);}}
var bindSearchResultClickHandler=function(){$(document).bind("click",setSearchResultClickHandler);}
var unbindSearchResultClickHandler=function(){$(document).unbind("click",setSearchResultClickHandler);}}
$.fn.stocksearch.defaults={interval:200,url:"/sqi_ws/MetaSearchServlet2?stock=$stock&count=20&type=$type&market=$market",headerLine:"name,S|symbol,S|currency,S|isin,S|exchangeId,S|marketId,S|typeId,S|nationalNumber,S|marketdId2,S|null,S|phonetique,S|market,S",action:function(key,name){document.location="/sq_mi/market/Detail.action?s="+key;}}})(jQuery);
var SqwStockSearch=function(container,options,baseUrl){var that=this;this.options=options;this.container=container;this.searchId=0;this.input=SQW.$("<input class='stock-search-input autocompleteDisabled' size=\"20\"/>");this.results=SQW.$("<div class='stock-search-results' style=\"display:none\"/>");this.render();var servletUrl=baseUrl+"/sqi_ws/";servletUrl+="MetaSearchServlet?";if(options.markets!=null){servletUrl+="market="+options.markets+"&";}
if(options.stockTypes!=null){servletUrl+="stocktypes="+options.stockTypes+"&";}
servletUrl+="count="+options.maxResults+"&";this.url=servletUrl;this.selectedResultIndex=0;this.clickHandler=stjs.bind(this,function(ev,THIS){if(!SQW.$.contains(that.container.get(0),ev.target)){that.close(null,null);if(SQW.$.trim(that.input.val())==""&&that.options.selectCallback!=null){that.options.selectCallback(null);}
return true;}
var row=SQW.$(ev.target).closest("tr");if(row.size()>0&&SQW.$.contains(that.container.get(0),row.get(0))){that.close(row.data("searchResult"),row.data("stockKey"));if(that.options.selectCallback!=null){that.options.selectCallback(that.selectedStockKey);}
return true;}
return true;},1);this.arrowHandler=stjs.bind(this,function(ev,THIS){if(ev.keyCode==38){that.arrowUp();return false;}else if(ev.keyCode==40){that.arrowDown();return false;}else if(ev.keyCode==13){that.keyboardSelect();return false;}else{return true;}},1);this.clearKeyboardSelection=stjs.bind(this,function(ev,THIS){that.results.find("tr").removeClass("hover");that.selectedResultIndex=0;return false;},1);setTimeout(function(){that.input.focus(stjs.bind(this,function(ev,THIS){clearInterval(that.interval);if(that.options.focusCallback!=null){that.options.focusCallback();}
that.selectedResultIndex=0;SQW.$(window).unbind("click",that.clickHandler);SQW.$(window).bind("click",that.clickHandler);if(that.placeholder!=null&&that.input.val()==that.placeholder){that.input.val("");that.input.removeClass("stock-search-placeholder");}
that.interval=setInterval(function(){that.search();},that.options.interval);return true;},1));},10);SQW.$(this.results).bind("mousemove",that.clearKeyboardSelection);};SqwStockSearch=stjs.extend(SqwStockSearch,null,[],function(constructor,prototype){prototype.container=null;prototype.input=null;prototype.placeholder=null;prototype.results=null;prototype.options=null;prototype.url=null;prototype.interval=null;prototype.previousInputValue=null;prototype.clickHandler=null;prototype.arrowHandler=null;prototype.clearKeyboardSelection=null;prototype.searchId=0;prototype.selectedSearchResult=null;prototype.selectedStockKey=null;prototype.selectedResultIndex=0;prototype.render=function(){this.container.addClass("stock-search-container");this.container.append(this.input);this.container.append(this.results);};prototype.keyboardSelect=function(){if(this.selectedResultIndex>0){var row=this.results.find("tr:nth-child("+this.selectedResultIndex+")");if(row.size()>0){this.close(row.data("searchResult"),row.data("stockKey"));if(this.options.selectCallback!=null){this.options.selectCallback(this.selectedStockKey);}}}};prototype.arrowDown=function(){var nextRowIndex=this.selectedResultIndex+1;var row=this.results.find("tr:nth-child("+nextRowIndex+")");if(row.size()>0){this.results.find("tr:nth-child("+this.selectedResultIndex+")").removeClass("hover");this.selectedResultIndex=nextRowIndex;row.addClass("hover");this.scrollToRow(row);}};prototype.scrollToRow=function(row){var diff=row.offset().top-this.results.offset().top;if(diff<0){this.results.scrollTop(diff+this.results.scrollTop());}else if(diff+row.outerHeight(true)>this.results.innerHeight()){this.results.scrollTop(diff+row.outerHeight(true)-this.results.innerHeight()+this.results.scrollTop());}};prototype.arrowUp=function(){var previousRowIndex=this.selectedResultIndex-1;var row=this.results.find("tr:nth-child("+previousRowIndex+")");if(row.size()>0){this.results.find("tr:nth-child("+this.selectedResultIndex+")").removeClass("hover");this.selectedResultIndex=previousRowIndex;row.addClass("hover");this.scrollToRow(row);}};constructor.mark=function(content,toMark){var pos=content.toLowerCase().indexOf(toMark.toLowerCase());if(pos!=0){return content;}
return"<b>"+content.substring(0,toMark.length)+"</b>"+content.substring(toMark.length);};prototype.search=function(){if(this.previousInputValue==this.input.val()||""==this.input.val()||this.input.val()==this.input.attr("explanation")){if(""==this.input.val()){this.results.hide();}
return;}
this.previousInputValue=this.input.val();this.selectedSearchResult=null;this.selectedStockKey=null;this.selectedResultIndex=0;this.searchId++;var ajaxParams={};ajaxParams.url=this.url+"stock="+this.input.val();ajaxParams.dataType="jsonp";ajaxParams.success=this.getSuccessCallback();SQW.$.ajax(ajaxParams);};prototype.getSuccessCallback=function(){var that=this;var currentSearchCallbackId=this.searchId;return function(response,status,jqxhr){if(currentSearchCallbackId!=that.searchId){return;}
var table=SQW.$("<table/>");var searchResults=response["results"];for(var i=0;i<searchResults.length;i++){var r=new SqwStockSearchResult(searchResults[i]);var row=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r.symbol,that.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r.name,that.previousInputValue)+"</td>"+"<td class='market'>"+r.marketName+"</td>"+"<td class='currency'>"+r.currency+"<img src=\"/gifs/flag_"+r.currency+".gif\"></td>"+"</tr>");row.data("stockKey",SqwStockSearch.createKey(r.isin,r.stockExchangeId,r.currency));row.data("searchResult",r);table.append(row);}
that.results.html("");if(searchResults.length>0){that.results.append(table);that.displayResults();}else{that.results.hide();}};};constructor.createKey=function(isin,exchangeId,currency){var exchangeValue=parseInt(exchangeId);if(isin==null||exchangeId==null||currency==null||exchangeValue==null||isNaN(exchangeValue)){return null;}
var exchangeIdString=exchangeId;if(exchangeValue<0){exchangeIdString="M"+String.valueOf(-exchangeValue);}
return isin+"_"+exchangeIdString+"_"+currency;};prototype.displayResults=function(){this.results.show();SQW.$(window).unbind("keydown",this.arrowHandler);SQW.$(window).bind("keydown",this.arrowHandler);this.results.css("top",this.input.outerHeight());var leftPos=(this.input.outerWidth(true)-this.input.outerWidth())/2.0;this.results.css("left",leftPos);var rightOverflow=SQW.$(window).width()-(this.results.width()+this.results.offset().left);if(rightOverflow<0){this.results.css("left",Math.floor(leftPos)+Math.floor(rightOverflow)-1);}
this.results.css("height","auto");this.results.css("overflow-y","hidden");this.results.css("min-height","");var resultTopPosInViewport=this.results.offset().top-SQW.$(window).scrollTop();if(resultTopPosInViewport+this.results.outerHeight(true)>SQW.$(window).height()){this.results.css("height",(SQW.$(window).height()-resultTopPosInViewport)+"px");this.results.css("overflow-y","scroll");this.results.css("min-height","100px");}};prototype.close=function(selectedResult,selectedResultKey){this.searchId++;this.results.hide();clearInterval(this.interval);SQW.$(window).unbind("click",this.clickHandler);SQW.$(window).unbind("keydown",this.arrowHandler);this.previousInputValue="";this.selectedSearchResult=selectedResult;this.selectedStockKey=selectedResultKey;this.selectedResultIndex=0;if(selectedResult!=null){this.input.val(selectedResult.symbol);}else{this.input.val("");}
this.blur();};prototype.getSelectedStockKey=function(){return this.selectedStockKey;};prototype.getSelectedSearchResult=function(){return this.selectedSearchResult;};prototype.emptyValue=function(){this.input.val("");};prototype.setValue=function(value){this.input.removeClass("stock-search-placeholder");this.input.val(value);this.blur();};prototype.blur=function(){if(this.placeholder!=null&&(this.input.val()==""||this.input.val()==this.placeholder)){this.input.addClass("stock-search-placeholder");this.input.val(this.placeholder);}
this.input.blur();};prototype.getPlaceholder=function(){return this.placeholder;};prototype.setPlaceholder=function(placeholder){this.placeholder=placeholder;if(placeholder!=null&&(this.input.val()==""||this.input.val()==placeholder)){this.input.addClass("stock-search-placeholder");this.blur();}};},{container:"SqwJQuery",input:"SqwJQuery",results:"SqwJQuery",options:"SqwStockSearchOptions",interval:"TimeoutHandler",clickHandler:"EventHandler",arrowHandler:"EventHandler",clearKeyboardSelection:"EventHandler",selectedSearchResult:"SqwStockSearchResult"},{});
var SqwStockSearchOptions=function(){};SqwStockSearchOptions=stjs.extend(SqwStockSearchOptions,null,[],function(constructor,prototype){prototype.selectCallback=null;prototype.focusCallback=null;prototype.markets=null;prototype.stockTypes=null;prototype.maxResults=null;prototype.interval=0;constructor.getDefault=function(){var options=new SqwStockSearchOptions();options.interval=200;options.markets="";options.stockTypes="";options.maxResults="20";return options;};constructor.extend=function(options){var extendedOptions=new SqwStockSearchOptions();return extendedOptions=SQW.$.extend(extendedOptions,SqwStockSearchOptions.getDefault(),options);};},{selectCallback:{name:"Callback1",arguments:[null]},focusCallback:"Callback0"},{});
var SqwStockSearchResult=function(pipeSeparated){var splitResult=(pipeSeparated).split("|");this.name=splitResult[0];this.symbol=splitResult[1];this.currency=splitResult[2];this.isin=splitResult[3];this.stockExchangeId=splitResult[4];this.marketId=splitResult[5];this.stockTypeId=splitResult[6];this.marketName=splitResult[11];};SqwStockSearchResult=stjs.extend(SqwStockSearchResult,null,[],function(constructor,prototype){constructor.CURRENCY_TYPE_ID="5";prototype.name=null;prototype.symbol=null;prototype.currency=null;prototype.isin=null;prototype.stockExchangeId=null;prototype.marketId=null;prototype.marketName=null;prototype.stockTypeId=null;prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getSymbol=function(){return this.symbol;};prototype.setSymbol=function(symbol){this.symbol=symbol;};prototype.getCurrency=function(){return this.currency;};prototype.setCurrency=function(currency){this.currency=currency;};prototype.getIsin=function(){return this.isin;};prototype.setIsin=function(isin){this.isin=isin;};prototype.getStockExchangeId=function(){return this.stockExchangeId;};prototype.setStockExchangeId=function(stockExchangeId){this.stockExchangeId=stockExchangeId;};prototype.getMarketId=function(){return this.marketId;};prototype.setMarketId=function(marketId){this.marketId=marketId;};prototype.getMarketName=function(){return this.marketName;};prototype.setMarketName=function(marketName){this.marketName=marketName;};prototype.getStockTypeId=function(){return this.stockTypeId;};prototype.setStockTypeId=function(stockTypeId){this.stockTypeId=stockTypeId;};prototype.isCurrency=function(){return this.stockTypeId==SqwStockSearchResult.CURRENCY_TYPE_ID;};},{},{});
var FinancialChartOption=function(){ChartOption.call(this);};FinancialChartOption=stjs.extend(FinancialChartOption,ChartOption,[],function(constructor,prototype){prototype.indicatorsParametersIntraday=null;prototype.indicatorsParametersHisto=null;prototype.showCompareBox=false;prototype.showPeriodMenu=false;prototype.showLegendInPopover=false;prototype.graphHeightModifiable=false;prototype.currentColorSchema=null;prototype.delimiterHeightPixels=null;prototype.delimiterHighlightColor=null;prototype.customIconClickHandler=null;constructor.getDefaultFinancialChartOption=function(){var financialChartConfig=SQW.$.extend(new FinancialChartOption(),ChartOption.getDefault());financialChartConfig.showCompareBox=true;financialChartConfig.showPeriodMenu=true;financialChartConfig.showLegendInPopover=true;financialChartConfig.graphHeightModifiable=false;financialChartConfig.customIconClickHandler=null;financialChartConfig.delimiterHighlightColor=ChartColor.orange;financialChartConfig.styleModel=new FinancialStyleModel();financialChartConfig.layout=new FinancialLayout();financialChartConfig.engineModel=new FinancialEngineModel();financialChartConfig.indicatorsParametersIntraday=null;financialChartConfig.indicatorsParametersHisto=null;financialChartConfig.delimiterHeightPixels=4;financialChartConfig.currentColorSchema=DefaultIndicator.RED_GREEN_SCHEMA_ID;return financialChartConfig;};constructor.extendFinancialChartOption=function(chartOption){var userDefined=chartOption;var customStyleModel=null;var customEngineModel=null;if(userDefined!=null){if(userDefined.styleModel!=null){customStyleModel=userDefined.styleModel;delete userDefined.styleModel;}
if(userDefined.engineModel!=null){customEngineModel=userDefined.engineModel;delete userDefined.engineModel;}}
var fullConfig=new FinancialChartOption();fullConfig=SQW.$.extend(fullConfig,FinancialChartOption.getDefaultFinancialChartOption(),userDefined);if(customStyleModel!=null){fullConfig._styleModel=customStyleModel;userDefined.styleModel=customStyleModel;}
if(customEngineModel!=null){fullConfig._engineModel=customEngineModel;userDefined.engineModel=customEngineModel;}
if(fullConfig.indicatorsParametersIntraday!=null){fullConfig.indicatorsParametersIntraday=IndicatorsParameters.extend(fullConfig.indicatorsParametersIntraday);}
if(fullConfig.indicatorsParametersHisto!=null){fullConfig.indicatorsParametersHisto=IndicatorsParameters.extend(fullConfig.indicatorsParametersHisto);}
return fullConfig;};prototype.isShowCompareBox=function(){return this.showCompareBox;};prototype.setShowCompareBox=function(showCompareBox){this.showCompareBox=showCompareBox;};prototype.isShowPeriodMenu=function(){return this.showPeriodMenu;};prototype.setShowPeriodMenu=function(showPeriodMenu){this.showPeriodMenu=showPeriodMenu;};prototype.isShowLegendInPopover=function(){return this.showLegendInPopover;};prototype.setShowLegendInPopover=function(showLegendInPopover){this.showLegendInPopover=showLegendInPopover;};prototype.getIndicatorsParametersIntraday=function(){return this.indicatorsParametersIntraday;};prototype.setIndicatorsParametersIntraday=function(indicatorsParametersIntraday){this.indicatorsParametersIntraday=indicatorsParametersIntraday;};prototype.getIndicatorsParametersHisto=function(){return this.indicatorsParametersHisto;};prototype.setIndicatorsParametersHisto=function(indicatorsParametersHisto){this.indicatorsParametersHisto=indicatorsParametersHisto;};prototype.getColorSchema=function(){return this.currentColorSchema;};prototype.setColorSchema=function(currentColorSchema){this.currentColorSchema=currentColorSchema;};prototype.getCustomIconClickHandler=function(){return this.customIconClickHandler;};prototype.setCustomIconClickHandler=function(customIconClickHandler){this.customIconClickHandler=customIconClickHandler;};prototype.isGraphHeightModifiable=function(){return this.graphHeightModifiable;};prototype.setGraphHeightModifiable=function(graphHeightModifiable){this.graphHeightModifiable=graphHeightModifiable;};prototype.getDelimiterHighlightColor=function(){return this.delimiterHighlightColor;};prototype.setDelimiterHighlightColor=function(delimiterHighlightColor){this.delimiterHighlightColor=delimiterHighlightColor;};prototype.getDelimiterHeightPixels=function(){return this.delimiterHeightPixels;};prototype.setDelimiterHeightPixels=function(delimiterHeightPixels){this.delimiterHeightPixels=delimiterHeightPixels;};},{indicatorsParametersIntraday:"IndicatorsParameters",indicatorsParametersHisto:"IndicatorsParameters",delimiterHighlightColor:"ChartColor",customIconClickHandler:{name:"Function1",arguments:[null,"Void"]},DEFAULT:{name:"Enum",arguments:["ChartOption.Implementation"]},implementation:{name:"Enum",arguments:["ChartOption.Implementation"]},colorStrategy:"ColorStrategy",volumeColorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},xAxisPosition:{name:"Enum",arguments:["Layout.Position"]},y1AxisPosition:{name:"Enum",arguments:["Layout.Position"]},y2AxisPosition:{name:"Enum",arguments:["Layout.Position"]},mainAxisMinMax:{name:"Array",arguments:[null]},interactionModel:"AbstractInteractionModel",styleModel:"StyleModel",engineModel:"EngineModel",layout:"Layout",volumeAxisPosition:{name:"Enum",arguments:["Layout.Position"]},backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]},oddLinesColor:"ChartColor",oddLinesColorGradientParams:{name:"Array",arguments:[null]},evenLinesColor:"ChartColor",evenLinesColorGradientParams:{name:"Array",arguments:[null]},gridColor:"ChartColor",gridColorGradientParams:{name:"Array",arguments:[null]},yesterdayLineColor:"ChartColor",yesterdayLineColorGradientParams:{name:"Array",arguments:[null]},tickTextColor:"ChartColor",tickTextColorGradientParams:{name:"Array",arguments:[null]},tickColor:"ChartColor",tickColorGradientParams:{name:"Array",arguments:[null]},borderColor:"ChartColor",borderColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",zoomAreaColor:"ChartColor",zoomAreaColorGradientParam:{name:"Array",arguments:[null]},textColor:"ChartColor",titleColor:"ChartColor",yAxisTicksColor:"ChartColor",xAxisTicksColor:"ChartColor",labelHighlightColor:"ChartColor",xAxisFormatter:"Formatter",y1AxisFormatter:"Formatter",y2AxisFormatter:"Formatter",stocks:{name:"Array",arguments:["Stock"]},urls:{name:"Array",arguments:[null]},data:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},copyrightPosition:{name:"Array",arguments:[null]},legendPosition:{name:"Array",arguments:[null]},legendAreaPostion:{name:"Enum",arguments:["Layout.Position"]},zoomType:{name:"Map",arguments:[null,null]},rangeSelector:{name:"Map",arguments:[null,"Object"]},startScale:{name:"Array",arguments:[null]},columnsRelativeWidth:{name:"Array",arguments:[null]},_styleModel:"StyleModel",_engineModel:"EngineModel",defaultHistoColor:"ChartColor"},{});
var FinancialChart=function(parentDiv,options){DefaultChart.call(this,parentDiv,options);};FinancialChart=stjs.extend(FinancialChart,DefaultChart,[],function(constructor,prototype){constructor.MINIMUM_INTRADAY_ZOOM_FACTOR=4*DateUtil.MS_MINUTE;constructor.MINIMUM_HISTO_ZOOM_FACTOR=4;prototype.provider=null;prototype.init=function(parentDiv,optionsParam){DefaultChart.prototype.init.call(this,parentDiv,optionsParam);this.updatePeriodAndFrequency(this.options.getPeriod(),this.options.getFrequency());if(this.options.isShowVolume()){this.addIndicator(IndicatorsManager.VOLUME_INDICATOR_ID);}};prototype.getExtendedOption=function(optionParams){return FinancialChartOption.extendFinancialChartOption(optionParams);};prototype.initSpecifics=function(){this.engineModel=this.options.getEngineModel();if(this.engineModel==null){this.engineModel=new FinancialEngineModel();}
this.engineModel.init(this.options);this.provider=this.options.getDataProvider();this.data=new FinancialChartData(this,this.provider,this.engineModel.getContext());this.data.attach(this);};prototype.updatePeriodAndFrequency=function(newPeriod,newFrequency){this.options.setPeriod(newPeriod);this.options.setFrequency(newFrequency);var period=Period.getInstance(newPeriod,newFrequency);if(period!=null&&period.isIntraday()){this.minimumZoomFactor=FinancialChart.MINIMUM_INTRADAY_ZOOM_FACTOR;}else{this.minimumZoomFactor=FinancialChart.MINIMUM_HISTO_ZOOM_FACTOR;}
if(this.provider!=null){this.provider.updateConfig(this.options);}
return period;};prototype.updatePeriod=function(newPeriod){this.updatePeriodAndFrequency(newPeriod,null);};prototype.updateFrequency=function(newFrequency){this.updatePeriodAndFrequency(null,newFrequency);};prototype.setPeriod=function(period){if(period==null){period=Period.HISTO_DEFAULT;}
var freq=period.getFrequency();this.options.setPeriod(period.toString());this.options.setFrequency(freq.toString());if(period.isIntraday()){this.minimumZoomFactor=FinancialChart.MINIMUM_INTRADAY_ZOOM_FACTOR;}else{this.minimumZoomFactor=FinancialChart.MINIMUM_HISTO_ZOOM_FACTOR;}
if(this.provider!=null){this.provider.updateConfig(this.options);}};prototype.isValidPositionForInteraction=function(offsetX,offsetY){var mainGraph=this.chartView.getArea(DefaultLayout.GRAPH_AREA);var volumeGraph=this.chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);return mainGraph!=null&&(mainGraph.isInside(offsetX,offsetY)||(volumeGraph!=null&&volumeGraph.isInside(offsetX,offsetY)));};prototype.openPopOver=function(){var customIconClickHandler=this.options.getCustomIconClickHandler();if(customIconClickHandler!=null){var currentIcon=this.chartView.findElementById(DefaultTitleEngine.ICON_ID);customIconClickHandler(currentIcon!=null?currentIcon.getIconType():null);}else if(this.options.isPopOverAllowed()){FinancialPopover.getInstance().open(this);}};prototype.getDataProvider=function(){return this.provider;};prototype.add=function(stock){};prototype.remove=function(stock){};prototype.updateHistoIndicatorParams=function(params){this.options.setIndicatorsParametersHisto(params);this.data.updateIndicatorParameters(this.options);};prototype.updateIntradayIndicatorParams=function(params){this.options.setIndicatorsParametersIntraday(params);this.data.updateIndicatorParameters(this.options);};prototype.updateIndicatorParams=function(paramsHisto,paramsIntraday){this.options.setIndicatorsParametersHisto(paramsHisto);this.options.setIndicatorsParametersIntraday(paramsIntraday);this.data.updateIndicatorParameters(this.options);};prototype.getIndicator=function(indicatorId){return this.data.getIndicator(indicatorId,this.options);};prototype.addIndicator=function(indicatorId){this.data.addIndicator(indicatorId,this.options);};prototype.removeIndicator=function(indicatorId){this.data.removeIndicator(indicatorId,this.options);};prototype.getChartData=function(){return this.data;};prototype.getPeriod=function(){if(this.data!=null&&this.data.getMainSerie()!=null){return(this.data.getMainSerie()).getPeriod();}else{return null;}};prototype.setId=function(chartId){this.id=chartId;};prototype.getChartOption=function(){return this.options;};prototype.getStock=function(){var stocks=this.getStocks();if(stocks!=null){return stocks[0];}else{return null;}};prototype.getStocks=function(){return this.options!=null?this.options.getStocks():null;};},{provider:"DataProvider",zoomHistory:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},zoomLevel:{name:"Array",arguments:[null]},panLevel:{name:"Array",arguments:[null]},renderEndCallback:"Callback0",charts:{name:"Map",arguments:[null,"Chart"]},relatedCharts:{name:"Map",arguments:[null,"Chart"]},renderCallbacks:{name:"Map",arguments:[null,"Callback1"]},parentElement:"SqwJQuery",chartType:{name:"Enum",arguments:["Chart.ChartType"]},engineModel:"EngineModel",chartView:"ChartView",interactionModel:"AbstractInteractionModel"},{});
var IndicatorSerie=function(){};IndicatorSerie=stjs.extend(IndicatorSerie,null,[],function(constructor,prototype){prototype.update=function(mainSerie,range){};prototype.setUniformValue=function(unifromValue){};prototype.setValues=function(values){};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.substract=function(baseSerie,minusSerie){};prototype.getMainSerie=function(){};prototype.reset=function(){};},{},{});
var IndexedIndicatorSerie=function(name,mainSerie,colorStrategy,stepSize){IndexedSerie.call(this,colorStrategy,stepSize);this.name=name;this.id=name;this.mainSerie=mainSerie;this.uniformValue=null;};IndexedIndicatorSerie=stjs.extend(IndexedIndicatorSerie,IndexedSerie,[IndicatorSerie],function(constructor,prototype){prototype.mainSerie=null;prototype.uniformValue=null;prototype.getValue=function(i,which){if(which==Serie.X){return this.mainSerie.getValue(i,which);}else if(which==Serie.Y&&this.uniformValue!=null){return this.uniformValue;}else{return Serie.prototype.getValue.call(this,i,which);}};prototype.findIndexAtOrBeforeXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexAtOrBeforeXValue(xValue);}else{return Serie.prototype.findIndexAtOrBeforeXValue.call(this,xValue);}};prototype.findIndexClosestToXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexClosestToXValue(xValue);}else{return Serie.prototype.findIndexClosestToXValue.call(this,xValue);}};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};prototype.update=function(mainSerie,range){this.mainSerie=mainSerie;};prototype.reset=function(){this.removeAllPoints();this.mainSerie=null;};prototype.setValues=function(values){this.removeAllPoints();if(values!=null){var valuesCount=values.length;for(var i=0;i<valuesCount;i++){this.pushValue(values[i]);}}};prototype.setUniformValue=function(unifromValue){this.uniformValue=unifromValue;};prototype.isEmpty=function(){if(this.uniformValue!=null){return this.mainSerie!=null?this.mainSerie.isEmpty():false;}else{return Serie.prototype.isEmpty.call(this);}};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){if(this.uniformValue!=null){if(exactPosition){if(currentPos==0||currentPos==(width-1)){return[this.uniformValue];}else{return null;}}else{return[this.uniformValue];}}else{return Serie.prototype.getAggregatedValues.call(this,aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition);}};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else{var barTotal=0;var currentPeriodCount=0;for(var j=i;j>i-period;j--){var currentVal=mainSerie.getValueAsDouble(j,which);if(currentVal!=null&&!isNaN(currentVal)){barTotal+=currentVal;currentPeriodCount++;}}
if(currentPeriodCount>0){this.pushValue(barTotal/currentPeriodCount);}else{this.pushValue(null);}}}};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;var lastValidValue=0.0;var exp=2/(period+1);var first=true;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else if(first){var currentPeriodCount=0;var movingAve=0;for(var j=i;j>i-period;j--){var currentValue=mainSerie.getValueAsDouble(j,which);if(currentValue!=null&&!isNaN(currentValue)){movingAve+=currentValue;currentPeriodCount++;}}
if(currentPeriodCount>0){lastValidValue=movingAve/currentPeriodCount;this.pushValue(lastValidValue);first=false;}else{this.pushValue(null);}}else{var v1=mainSerie.getValueAsDouble(i,which);var v2=this.getValueAsDouble(i-1,which);if(v2!=null){lastValidValue=v2;}
if(v1!=null&&!isNaN(v1)){this.pushValue(v1*exp+lastValidValue*(1-exp));}else{this.pushValue(null);}}}};prototype.substract=function(baseSerie,minusSerie){this.removeAllPoints();if(baseSerie==null||minusSerie==null){return;}
var serieLength=stjs.trunc(Math.max(baseSerie.getLength(),minusSerie.getLength()));var which=Serie.Y;for(var i=0;i<serieLength;i++){var value1=baseSerie.getValueAsDouble(i,which);var value2=minusSerie.getValueAsDouble(i,which);if(value1!=null&&value2!=null){this.pushValue(value1-value2);}else{this.pushValue(null);}}};prototype.getMainSerie=function(){return this.mainSerie;};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IntradayIndicatorSerie=function(name,mainSerie,colorStrategy,stepSize){TimeSerie.call(this,colorStrategy,DateUtil.MS_SECOND);this.name=name;this.id=name;this.mainSerie=mainSerie;this.uniformValue=null;};IntradayIndicatorSerie=stjs.extend(IntradayIndicatorSerie,TimeSerie,[IndicatorSerie],function(constructor,prototype){prototype.mainSerie=null;prototype.uniformValue=null;prototype.getValue=function(i,which){if(which==Serie.X){return this.mainSerie.getValue(i,which);}else if(which==Serie.Y&&this.uniformValue!=null){return this.uniformValue;}else{return Serie.prototype.getValue.call(this,i,which);}};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};prototype.findIndexAtOrBeforeXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexAtOrBeforeXValue(xValue);}else{return Serie.prototype.findIndexAtOrBeforeXValue.call(this,xValue);}};prototype.findIndexClosestToXValue=function(xValue){if(this.uniformValue!=null&&this.mainSerie!=null){return this.mainSerie.findIndexClosestToXValue(xValue);}else{return Serie.prototype.findIndexClosestToXValue.call(this,xValue);}};prototype.update=function(mainSerie,range){this.mainSerie=mainSerie;};prototype.reset=function(){this.removeAllPoints();this.mainSerie=null;};prototype.setValues=function(values){this.removeAllPoints();if(values!=null){var valuesCount=values.length;for(var i=0;i<valuesCount;i++){this.pushValue(values[i]);}}};prototype.setUniformValue=function(unifromValue){this.uniformValue=unifromValue;};prototype.isEmpty=function(){if(this.uniformValue!=null){return this.mainSerie!=null?this.mainSerie.isEmpty():false;}else{return Serie.prototype.isEmpty.call(this);}};prototype.getAggregatedValues=function(aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition){if(this.uniformValue!=null){if(exactPosition){if(currentPos==0||currentPos==(width-1)){return[this.uniformValue];}else{return null;}}else{return[this.uniformValue];}}else{return Serie.prototype.getAggregatedValues.call(this,aggregationStrategy,context,currentPos,width,whichSerieValue,exactPosition);}};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else{var barTotal=0;var currentPeriodCount=0;for(var j=i;j>i-period;j--){var currentVal=mainSerie.getValueAsDouble(j,which);if(currentVal!=null&&!isNaN(currentVal)){barTotal+=currentVal;currentPeriodCount++;}}
if(currentPeriodCount>0){this.pushValue(barTotal/currentPeriodCount);}else{this.pushValue(null);}}}};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){this.removeAllPoints();if(period==null||period<=0){return;}
var serieLength=mainSerie.getLength();var which=Serie.Y;var wantedStartIndex=0;if(forcedStartIndex!=null&&!isNaN(forcedStartIndex)&&forcedStartIndex>=0){wantedStartIndex=forcedStartIndex;}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,wantedStartIndex);var periodLimit=firstValidIndex+period;var lastValidValue=0.0;var exp=2/(period+1);var first=true;for(var i=0;i<serieLength;i++){if(i<periodLimit){this.pushValue(null);}else if(first){var currentPeriodCount=0;var movingAve=0;for(var j=i;j>i-period;j--){var currentValue=mainSerie.getValueAsDouble(j,which);if(currentValue!=null&&!isNaN(currentValue)){movingAve+=currentValue;currentPeriodCount++;}}
if(currentPeriodCount>0){lastValidValue=movingAve/currentPeriodCount;this.pushValue(lastValidValue);first=false;}else{this.pushValue(null);}}else{var v1=mainSerie.getValueAsDouble(i,which);var v2=this.getValueAsDouble(i-1,which);if(v2!=null){lastValidValue=v2;}
if(v1!=null&&!isNaN(v1)){this.pushValue(v1*exp+lastValidValue*(1-exp));}else{this.pushValue(null);}}}};prototype.substract=function(baseSerie,minusSerie){this.removeAllPoints();if(baseSerie==null||minusSerie==null){return;}
var serieLength=stjs.trunc(Math.max(baseSerie.getLength(),minusSerie.getLength()));var which=Serie.Y;for(var i=0;i<serieLength;i++){var value1=baseSerie.getValueAsDouble(i,which);var value2=minusSerie.getValueAsDouble(i,which);if(value1!=null&&value2!=null){this.pushValue(value1-value2);}else{this.pushValue(null);}}};prototype.getMainSerie=function(){return this.mainSerie;};},{points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var YesterdayLine=function(mainSerie,range,color,dashed){IntradaySerie.call(this,null,null,mainSerie.getStock(),false);this.mainSerie=mainSerie;this.xSpaceScale=mainSerie.getXSpaceScale();this.id=YesterdayLine.INDICATOR_ID;this.name=YesterdayLine.INDICATOR_NAME;this.type=Chart.ChartType.LINE;this.setColor(color);this.setDashed(dashed);this.setInteractionAllowed(false);};YesterdayLine=stjs.extend(YesterdayLine,IntradaySerie,[IndicatorSerie],function(constructor,prototype){constructor.INDICATOR_NAME="Yesterday close";constructor.INDICATOR_ID="yesterdayLineId";prototype.mainSerie=null;prototype.update=function(mainSerie,range){if(mainSerie==null||range==null){return;}
this.mainSerie=mainSerie;this.setXSpaceScale(mainSerie.getXSpaceScale());var yesterdayValue=mainSerie.getReferenceValue();var firstXValue=range[0];var lastXValue=range[1];var firstPoint={};var lastPoint={};firstPoint[Serie.X]=firstXValue;firstPoint[Serie.Y]=yesterdayValue;firstPoint[FinancialSerie.HIGH]=yesterdayValue;firstPoint[FinancialSerie.LOW]=yesterdayValue;firstPoint[FinancialSerie.OPEN]=yesterdayValue;firstPoint[FinancialSerie.VOLUME]=0;lastPoint[Serie.X]=lastXValue;lastPoint[Serie.Y]=yesterdayValue;lastPoint[FinancialSerie.HIGH]=yesterdayValue;lastPoint[FinancialSerie.LOW]=yesterdayValue;lastPoint[FinancialSerie.OPEN]=yesterdayValue;lastPoint[FinancialSerie.VOLUME]=0;this.removeAllPoints();this.pushPoint(firstPoint);this.pushPoint(lastPoint);};prototype.getDataId=function(pixelCount){return this.id;};prototype.getMetadataId=function(pixelCount){return this.id;};prototype.getStartXValue=function(){return this.getFirstXValue();};prototype.getEndXValue=function(){return this.getLastXValue();};prototype.reset=function(){this.setColor(ChartColor.red);this.setDashed(true);this.setInteractionAllowed(false);this.removeAllPoints();};prototype.setUniformValue=function(unifromValue){};prototype.setValues=function(values){};prototype.computeMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.computeExponentialMovingAverage=function(mainSerie,forcedStartIndex,period){};prototype.substract=function(baseSerie,minusSerie){};prototype.getMainSerie=function(){return this.mainSerie;};prototype.getReferenceValue=function(){return this.mainSerie.getReferenceValue();};},{stock:"Stock",period:"Period",points:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},validity:"Date",colorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},color:"ChartColor",type:{name:"Enum",arguments:["Chart.ChartType"]},mainFields:{name:"Array",arguments:[null]}},{});
var IndicatorsParameters=function(){this.ADX={};this.ARO={};this.BOL={};this.CCI={};this.EMA={};this.HVO={};this.LRC={};this.MACD={};this.MAV={};this.MOM={};this.OBV={};this.RSI={};this.SAR={};this.STD={};this.STO={};this.VOL={};this.WIL={};this.ZIG={};this.parameters={};for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorName=IndicatorsManager.AVAILABLE_INDICATORS[index];this.parameters[indicatorName]=(this)[indicatorName];}};IndicatorsParameters=stjs.extend(IndicatorsParameters,null,[],function(constructor,prototype){constructor.defaultInstance=null;constructor.ENABLED_PARAMETER="enabled";constructor.PERIOD_PARAMETER="period";constructor.DEVIATIONS_PARAMETER="deviations";constructor.PERIOD_SHORT_PARAMETER="period_short";constructor.PERIOD_MEDIUM_PARAMETER="period_medium";constructor.PERIOD_LONG_PARAMETER="period_long";constructor.PERIOD_9_PARAMETER="period_9";constructor.PERIOD_12_PARAMETER="period_12";constructor.PERIOD_26_PARAMETER="period_26";constructor.ACCELERATION_PARAMETER="acceleration";constructor.MAX_ACCELERATION_PARAMETER="max_acceleration";constructor.PERIOD_K_PARAMETER="period_k";constructor.PERIOD_D_PARAMETER="period_d";constructor.PERCENT_PARAMETER="percent";prototype.ADX=null;prototype.ARO=null;prototype.BOL=null;prototype.CCI=null;prototype.EMA=null;prototype.HVO=null;prototype.LRC=null;prototype.MACD=null;prototype.MAV=null;prototype.MOM=null;prototype.OBV=null;prototype.RSI=null;prototype.SAR=null;prototype.STD=null;prototype.STO=null;prototype.VOL=null;prototype.WIL=null;prototype.ZIG=null;prototype.parameters=null;constructor.extend=function(partialParams){if(partialParams!=null){var defaultParamsExtended=IndicatorsParameters.getDefault();for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorName=IndicatorsManager.AVAILABLE_INDICATORS[index];var customIndicatorParams=(partialParams)[indicatorName];if(customIndicatorParams!=null){var defaultIndicatorParams=(defaultParamsExtended)[indicatorName];SQW.$.extend(defaultIndicatorParams,customIndicatorParams);}}
return defaultParamsExtended;}else{return IndicatorsParameters.getDefault();}};constructor.getDefault=function(){var defaultParam=new IndicatorsParameters();defaultParam.ADX[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ADX[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.ARO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ARO[IndicatorsParameters.PERIOD_PARAMETER]=25.0;defaultParam.BOL[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.BOL[IndicatorsParameters.PERIOD_PARAMETER]=20.0;defaultParam.BOL[IndicatorsParameters.DEVIATIONS_PARAMETER]=2.0;defaultParam.CCI[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.CCI[IndicatorsParameters.PERIOD_PARAMETER]=20.0;defaultParam.EMA[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.EMA[IndicatorsParameters.PERIOD_SHORT_PARAMETER]=20.0;defaultParam.EMA[IndicatorsParameters.PERIOD_MEDIUM_PARAMETER]=50.0;defaultParam.EMA[IndicatorsParameters.PERIOD_LONG_PARAMETER]=200.0;defaultParam.HVO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.HVO[IndicatorsParameters.PERIOD_PARAMETER]=100.0;defaultParam.LRC[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.LRC[IndicatorsParameters.PERIOD_PARAMETER]=200.0;defaultParam.MACD[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MACD[IndicatorsParameters.PERIOD_9_PARAMETER]=9.0;defaultParam.MACD[IndicatorsParameters.PERIOD_12_PARAMETER]=12.0;defaultParam.MACD[IndicatorsParameters.PERIOD_26_PARAMETER]=26.0;defaultParam.MAV[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MAV[IndicatorsParameters.PERIOD_SHORT_PARAMETER]=20.0;defaultParam.MAV[IndicatorsParameters.PERIOD_MEDIUM_PARAMETER]=50.0;defaultParam.MAV[IndicatorsParameters.PERIOD_LONG_PARAMETER]=200.0;defaultParam.MOM[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.MOM[IndicatorsParameters.PERIOD_PARAMETER]=12.0;defaultParam.OBV[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.RSI[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.RSI[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.SAR[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.SAR[IndicatorsParameters.PERIOD_PARAMETER]=2.0;defaultParam.SAR[IndicatorsParameters.ACCELERATION_PARAMETER]=2.0;defaultParam.SAR[IndicatorsParameters.MAX_ACCELERATION_PARAMETER]=20.0;defaultParam.STD[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.STD[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.STO[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.STO[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.STO[IndicatorsParameters.PERIOD_K_PARAMETER]=3.0;defaultParam.STO[IndicatorsParameters.PERIOD_D_PARAMETER]=3.0;defaultParam.VOL[IndicatorsParameters.ENABLED_PARAMETER]=true;defaultParam.WIL[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.WIL[IndicatorsParameters.PERIOD_PARAMETER]=14.0;defaultParam.ZIG[IndicatorsParameters.ENABLED_PARAMETER]=false;defaultParam.ZIG[IndicatorsParameters.PERCENT_PARAMETER]=5.0;return defaultParam;};prototype.getIndicatorParameters=function(indicatorId){return this.parameters[indicatorId];};constructor.getDefaultIndicatorParameters=function(indicatorId){if(IndicatorsParameters.defaultInstance==null){IndicatorsParameters.defaultInstance=IndicatorsParameters.getDefault();}
return SQW.$.extend({},IndicatorsParameters.defaultInstance.getIndicatorParameters(indicatorId));};constructor.addDefaultIndicatorParametersTo=function(indicatorName,currentVal){if(IndicatorsParameters.defaultInstance==null){IndicatorsParameters.defaultInstance=IndicatorsParameters.getDefault();}
return SQW.$.extend({},IndicatorsParameters.defaultInstance.getIndicatorParameters(indicatorName),currentVal);};prototype.isEnabled=function(indicatorId){var param=this.parameters[indicatorId];if(param!=null){return param[IndicatorsParameters.ENABLED_PARAMETER];}else{return false;}};},{defaultInstance:"IndicatorsParameters",ADX:{name:"Map",arguments:[null,"Object"]},ARO:{name:"Map",arguments:[null,"Object"]},BOL:{name:"Map",arguments:[null,"Object"]},CCI:{name:"Map",arguments:[null,"Object"]},EMA:{name:"Map",arguments:[null,"Object"]},HVO:{name:"Map",arguments:[null,"Object"]},LRC:{name:"Map",arguments:[null,"Object"]},MACD:{name:"Map",arguments:[null,"Object"]},MAV:{name:"Map",arguments:[null,"Object"]},MOM:{name:"Map",arguments:[null,"Object"]},OBV:{name:"Map",arguments:[null,"Object"]},RSI:{name:"Map",arguments:[null,"Object"]},SAR:{name:"Map",arguments:[null,"Object"]},STD:{name:"Map",arguments:[null,"Object"]},STO:{name:"Map",arguments:[null,"Object"]},VOL:{name:"Map",arguments:[null,"Object"]},WIL:{name:"Map",arguments:[null,"Object"]},ZIG:{name:"Map",arguments:[null,"Object"]},parameters:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]}},{});
var Indicator=function(){};Indicator=stjs.extend(Indicator,null,[],function(constructor,prototype){prototype.getId=function(){};prototype.setId=function(id){};prototype.getName=function(){};prototype.setName=function(name){};prototype.getDescription=function(){};prototype.setParameters=function(parameters){};prototype.getParameter=function(param){};prototype.getDoubleParameter=function(param){};prototype.calculate=function(mainSerie,context){};prototype.getSeries=function(){};prototype.reset=function(){};prototype.getSignal=function(mainSerie,index){};prototype.getSignals=function(){};prototype.getColors=function(){};prototype.updateColorSchema=function(newSchemaId){};prototype.setColors=function(colors){};prototype.setEnabled=function(enabled){};prototype.isEnabled=function(){};prototype.getCorrespondingAreaId=function(){};prototype.isOnArea=function(graphArea){};prototype.hasAxisPosition=function(axisPos){};prototype.getAxisPosition=function(){};prototype.isHasSignals=function(){};},{},{});
var DefaultIndicator=function(name,id,correspondingAreaId,axisPosition,parameters){this.name=name;this.id=id;this.correspondingAreaId=correspondingAreaId;this.parameters=parameters;this.currentSchemaId=DefaultIndicator.RED_GREEN_SCHEMA_ID;this.axisPosition=axisPosition;this.hasSignals=true;};DefaultIndicator=stjs.extend(DefaultIndicator,null,[Indicator],function(constructor,prototype){constructor.MIN_AREA_CROSS_LINE=10;constructor.RED_GREEN_SCHEMA_ID="0";constructor.ORANGE_BLUE_SCHEMA_ID="1";prototype.name=null;prototype.id=null;prototype.currentSchemaId=null;prototype.previouslyComputedSchemaId=null;prototype.correspondingAreaId=null;prototype.axisPosition=null;prototype.parameters=null;prototype.series=null;prototype.colors=null;prototype.signalsColorStrategy=null;prototype.signals=null;prototype.currentSerieId=null;prototype.currentSize=null;prototype.hasSignals=false;prototype.calculate=function(mainSerie,context){if(this.needComputation(mainSerie,context)){if(this.currentSchemaId==DefaultIndicator.ORANGE_BLUE_SCHEMA_ID){this.colors=this.getOrangeBlueSchema();this.signalsColorStrategy=ColorStrategy.BLUE_ORANGE;}else{this.colors=this.getRedGreenSchema();this.signalsColorStrategy=ColorStrategy.GREEN_RED;}
this.previouslyComputedSchemaId=this.currentSchemaId;this.currentSerieId=mainSerie!=null?mainSerie.getDataId(""):null;this.currentSize=mainSerie!=null?mainSerie.getLength():0;var regularIntervalSerie=IntradaySerie.toRegularFrequency(mainSerie);this.calculateSeries(regularIntervalSerie,context);this.calculateSignals(regularIntervalSerie);}};prototype.getRedGreenSchema=function(){};prototype.getOrangeBlueSchema=function(){};prototype.updateColorSchema=function(newSchemaId){this.currentSchemaId=newSchemaId;};prototype.needComputation=function(mainSerie,context){var hasDiffParam=this.hasDifferentParameters();var isDifferentSerie=(mainSerie==null)?(this.currentSerieId!=null):mainSerie.getDataId("")!=this.currentSerieId;var hasDifferentSize=(mainSerie==null)?(this.currentSize!=null):mainSerie.getLength()!=this.currentSize;var hasDiffSchema=this.currentSchemaId!=this.previouslyComputedSchemaId;return hasDiffParam||isDifferentSerie||hasDifferentSize||hasDiffSchema||this.isDifferentReference(this.getSeries(),mainSerie);};prototype.isDifferentReference=function(computedSeries,mainSerie){var computedIndicator=computedSeries!=null?computedSeries[0]:null;if(computedIndicator==null||computedIndicator.getMainSerie()==null||mainSerie==null){return true;}
return!mainSerie.isIntraday()&&computedIndicator.getMainSerie().getId()!=mainSerie.getId();};prototype.hasDifferentParameters=function(){};prototype.calculateSeries=function(mainSerie,context){};prototype.createIndicatorSerie=function(mainSerie,name,colorStrategy,stepSize){var indicatorSerie=null;if(mainSerie==null||mainSerie.isIndexed()){indicatorSerie=new IndexedIndicatorSerie(name,mainSerie,colorStrategy,stepSize);}else{indicatorSerie=new IntradayIndicatorSerie(name,mainSerie,colorStrategy,stepSize);}
indicatorSerie.setType(Chart.ChartType.LINE);return indicatorSerie;};prototype.calculateSignals=function(mainSerie){if(this.hasSignals){var signalsSerie=this.createIndicatorSerie(mainSerie,this.name+"_signals",null,null);signalsSerie.setColorStrategy(this.signalsColorStrategy);var length=mainSerie!=null?mainSerie.getLength():0;if(length>0){signalsSerie.pushValue(0.0);}
var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0)+1;for(var i=1;i<length;i++){if(i<firstValidIndex){signalsSerie.pushValue(0.0);}else{signalsSerie.pushValue(this.getSignal(mainSerie,i));}}
this.signals=signalsSerie;}else{this.signals=null;}};prototype.reset=function(){this.series=null;this.signals=null;};prototype.getName=function(){return this.name;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.setName=function(strName){this.name=strName;};prototype.setEnabled=function(enabled){if(this.parameters!=null){this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=enabled;}
for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;this.series[index].setEnabled(enabled);}};prototype.isEnabled=function(){if(this.parameters==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]==null){return false;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="true"){return true;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="false"){return false;}
return this.parameters[IndicatorsParameters.ENABLED_PARAMETER];};prototype.setParameters=function(parameters){this.parameters=parameters;};prototype.getParameter=function(param){var validDoubleValue=null;if(this.parameters!=null&&this.parameters[param]!=null&&!isNaN(this.parameters[param])){validDoubleValue=this.parameters[param];}else{validDoubleValue=IndicatorsParameters.getDefaultIndicatorParameters(this.id)[param];}
return stjs.trunc(Math.round(validDoubleValue));};prototype.getDoubleParameter=function(param){if(this.parameters!=null&&this.parameters[param]!=null&&!isNaN(this.parameters[param])){return this.parameters[param];}else{return IndicatorsParameters.getDefaultIndicatorParameters(this.id)[param];}};prototype.getSeries=function(){return this.series;};prototype.setColors=function(colors){this.colors=colors;};prototype.getColors=function(){return this.colors;};prototype.getSignals=function(){return this.signals;};prototype.crossAscSerie=function(crossingSerie,comparedSerie,index){var y=Serie.Y;var v1=crossingSerie.getValueAsDouble(index-1,y);var v2=comparedSerie.getValueAsDouble(index-1,y);var v3=crossingSerie.getValueAsDouble(index,y);var v4=comparedSerie.getValueAsDouble(index,y);return v1!=null&&v2!=null&&v3!=null&&v4!=null&&(v1<v2&&v3>v4);};prototype.crossDescSerie=function(crossingSerie,comparedSerie,index){var y=Serie.Y;var v1=crossingSerie.getValueAsDouble(index-1,y);var v2=comparedSerie.getValueAsDouble(index-1,y);var v3=crossingSerie.getValueAsDouble(index,y);var v4=comparedSerie.getValueAsDouble(index,y);return v1!=null&&v2!=null&&v3!=null&&v4!=null&&(v1>v2&&v3<v4);};prototype.crossAscConstant=function(s,nLevel,idx){var y=Serie.Y;var v1=s.getValueAsDouble(idx-1,y);var v2=s.getValueAsDouble(idx,y);if(v1!=null&&v2!=null&&v1<nLevel&&v2>=nLevel){return DefaultIndicator.isAreaBigger(s,nLevel,idx-1,DefaultIndicator.MIN_AREA_CROSS_LINE);}
return false;};prototype.crossDescConstant=function(s,nLevel,idx){var y=Serie.Y;var v1=s.getValueAsDouble(idx-1,y);var v2=s.getValueAsDouble(idx,y);if(v1!=null&&v2!=null&&v1>nLevel&&v2<=nLevel){return DefaultIndicator.isAreaBigger(s,nLevel,idx-1,DefaultIndicator.MIN_AREA_CROSS_LINE);}
return false;};constructor.isAreaBigger=function(s,nLevel,idx,min){var y=Serie.Y;var area=0;var diff=s.getValueAsDouble(idx,y)-nLevel;var sgn=(diff>=0)?1:-1;for(var i=idx;i>=0;i--){diff=s.getValueAsDouble(i,y)-nLevel;if(diff*sgn<0){return false;}
area+=sgn*diff;if(area>=min){return true;}}
return false;};prototype.getCorrespondingAreaId=function(){return this.correspondingAreaId;};constructor.getFirstValidFinancialIndex=function(mainSerie,which,startIndex){var length=mainSerie!=null?mainSerie.getLength():0;for(var i=startIndex;i<length;i++){if(DefaultIndicator.isValidFinancialValue(mainSerie.getValueAsDouble(i,which))){return i;}}
return length;};constructor.isValidFinancialValue=function(value){return value!=null&&!isNaN(value)&&value>0;};prototype.isOnArea=function(graphArea){return this.correspondingAreaId==graphArea;};prototype.hasAxisPosition=function(axisPos){return this.axisPosition==axisPos;};prototype.isHasSignals=function(){return this.hasSignals;};prototype.getDescription=function(){var description=[];var serieDescription={};var paramsString="";if(this.getParamValues()!=null){paramsString="("+this.getParamValues()+")";}
serieDescription["text"]=this.getName()+paramsString;serieDescription["color"]=this.colors!=null?this.colors[0]:ChartColor.black;description.push(serieDescription);return description;};prototype.getParamValues=function(){return null;};prototype.getAxisPosition=function(){return this.axisPosition;};},{axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var AroonIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Aroon",IndicatorsManager.AROON_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=AroonIndicator.COLORS_DEFAULT;this.hasSignals=false;};AroonIndicator=stjs.extend(AroonIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.GREEN_MAV,ChartColor.RED_MAV,ChartColor.GRAY_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.blue,ChartColor.orange,ChartColor.GRAY_MAV];prototype.up=null;prototype.down=null;prototype.upLine=null;prototype.midLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var period=this.currentPeriod;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,FinancialSerie.HIGH,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.up.pushValue(null);this.down.pushValue(null);}else{var u=0,d=0;var high=0,low=Double.MAX_VALUE;for(var j=i-period+1;j<=i;j++){var tmpHigh=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);var tmpLow=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);if(tmpHigh>=high){high=tmpHigh;u=j-(i-period);}
if(tmpLow<=low){low=tmpLow;d=j-(i-period);}}
this.up.pushValue(u*100/period);this.down.pushValue(d*100/period);}}};prototype.updateSeries=function(mainSerie){this.up=this.createIndicatorSerie(mainSerie,"Aroon Up",null,null);this.down=this.createIndicatorSerie(mainSerie,"Aroon Down",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"aroon_up_line",null,null);this.midLine=this.createIndicatorSerie(mainSerie,"aroon_middle_line",null,null);this.midLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"aroon_down_line",null,null);this.upLine.setUniformValue(70.0);this.midLine.setUniformValue(50.0);this.downLine.setUniformValue(30.0);this.series=[this.up,this.down,this.upLine,this.midLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.up.setColor(colors[0]);this.down.setColor(colors[1]);this.upLine.setColor(colors[2]);this.midLine.setColor(colors[2]);this.downLine.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return AroonIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return AroonIndicator.COLORS_ORANGE_BLUE;};prototype.getSignal=function(mainSerie,index){return 0;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var AverageDirectionalMovementIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"ADX",IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=AverageDirectionalMovementIndicator.COLORS_DEFAULT;};AverageDirectionalMovementIndicator=stjs.extend(AverageDirectionalMovementIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.blue,ChartColor.GREEN_MAV,ChartColor.RED_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.GRAY_MAV,ChartColor.blue,ChartColor.orange];prototype.lineColor=null;prototype.sDmiMinus=null;prototype.sDmiPlus=null;prototype.sAdx=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var period=this.currentPeriod;var DMI_PLUS=[];DMI_PLUS.length=mainPointsCount;var DMI_MINUS=[];DMI_MINUS.length=mainPointsCount;var TRUE_RANGE=[];TRUE_RANGE.length=mainPointsCount;var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var close=FinancialSerie.CLOSE;for(var i=0;i<mainPointsCount;i++){var currentHigh=mainSerie.getValueAsDouble(i,high);var currentLow=mainSerie.getValueAsDouble(i,low);var previousHigh=mainSerie.getValueAsDouble(i-1,high);var previousLow=mainSerie.getValueAsDouble(i-1,low);var previousClose=mainSerie.getValueAsDouble(i-1,close);var currentClose=mainSerie.getValueAsDouble(i,close);if(DefaultIndicator.isValidFinancialValue(currentHigh)&&DefaultIndicator.isValidFinancialValue(currentLow)&&DefaultIndicator.isValidFinancialValue(previousHigh)&&DefaultIndicator.isValidFinancialValue(previousLow)&&DefaultIndicator.isValidFinancialValue(currentClose)&&DefaultIndicator.isValidFinancialValue(previousClose)){var hiDiff=currentHigh-previousHigh;var loDiff=previousLow-currentLow;DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;if((hiDiff<0&&loDiff<0)||hiDiff==loDiff){DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;}else if(hiDiff>loDiff){DMI_PLUS[i]=hiDiff;}else if(hiDiff<loDiff){DMI_MINUS[i]=loDiff;}
TRUE_RANGE[i]=Math.max(Math.max(Math.abs(currentHigh-currentLow),Math.abs(currentHigh-previousClose)),Math.abs(previousClose-currentLow));}else{DMI_PLUS[i]=0.0;DMI_MINUS[i]=0.0;TRUE_RANGE[i]=0.0;}}
var EMA_DMI_PLUS=this.ema(DMI_PLUS,this.currentPeriod);var EMA_DMI_MINUS=this.ema(DMI_MINUS,this.currentPeriod);var EMA_TRUE_RANGE=this.ema(TRUE_RANGE,this.currentPeriod);var DX=[];var currentCount=EMA_TRUE_RANGE.length;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<currentCount;i++){if(i>=periodLimit&&EMA_TRUE_RANGE[i]!=0){var currentDmiPlusValue=100*EMA_DMI_PLUS[i]/EMA_TRUE_RANGE[i];var currentDmiMinusValue=100*EMA_DMI_MINUS[i]/EMA_TRUE_RANGE[i];this.sDmiPlus.pushValue(currentDmiPlusValue);this.sDmiMinus.pushValue(currentDmiMinusValue);DX.push(100*Math.abs(currentDmiPlusValue-currentDmiMinusValue)/(currentDmiPlusValue+currentDmiMinusValue)/this.currentPeriod);}else{this.sDmiMinus.pushValue(0.0);this.sDmiPlus.pushValue(0.0);DX.push(0.0);}}
var ADX=this.ema(DX,this.currentPeriod);this.sAdx.setValues(ADX);};prototype.updateSeries=function(mainSerie){this.sDmiMinus=this.createIndicatorSerie(mainSerie,"DI-",null,null);this.sDmiPlus=this.createIndicatorSerie(mainSerie,"DI+",null,null);this.sAdx=this.createIndicatorSerie(mainSerie,"ADX",null,null);this.series=[this.sAdx,this.sDmiPlus,this.sDmiMinus];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.ema=function(v,n){var vt=[];vt[0]=v[0];var vLength=v.length;for(var i=1;i<vLength;i++){vt[i]=vt[i-1]*(n-1)/n+v[i];}
return vt;};prototype.getSignal=function(mainSerie,index){var y=Serie.Y;if(this.crossAscSerie(this.sDmiPlus,this.sDmiMinus,index)&&this.sAdx.getValueAsDouble(index,y)>Math.max(this.sDmiMinus.getValueAsDouble(index,y),this.sDmiPlus.getValueAsDouble(index,y))){return 1;}
if(this.crossDescSerie(this.sDmiPlus,this.sDmiMinus,index)&&this.sAdx.getValueAsDouble(index,y)>Math.max(this.sDmiMinus.getValueAsDouble(index,y),this.sDmiPlus.getValueAsDouble(index,y))){return-1;}
if(index<3){return 0;}
for(var i=index-2;i<=index;i++){if(this.sAdx.getValueAsDouble(i,y)<Math.max(this.sDmiMinus.getValueAsDouble(i,y),this.sDmiPlus.getValueAsDouble(i,y))){return 0;}}
if(this.sAdx.getValueAsDouble(index-3,y)<this.sAdx.getValueAsDouble(index-2,y)&&this.sAdx.getValueAsDouble(index-2,y)<this.sAdx.getValueAsDouble(index-1,y)&&this.sAdx.getValueAsDouble(index-1,y)>=this.sAdx.getValueAsDouble(index,y)){if(this.sDmiPlus.getValueAsDouble(index-1,y)>=this.sDmiMinus.getValueAsDouble(index-1,y)){return-1;}
return 1;}
return 0;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.sAdx.getName()+" ";serieDescription["color"]=this.sAdx!=null?this.sAdx.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.sDmiPlus.getName()+" ";serieDescription["color"]=this.sDmiPlus!=null?this.sDmiPlus.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.sDmiMinus.getName();serieDescription["color"]=this.sDmiMinus!=null?this.sDmiMinus.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[2];description.push(serieDescription);serieDescription={};serieDescription["text"]="("+Math.round(this.currentPeriod)+")";serieDescription["color"]=this.sAdx!=null?this.sAdx.getColor():AverageDirectionalMovementIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.sAdx.setColor(colors[0]);this.sDmiPlus.setColor(colors[1]);this.sDmiMinus.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return AverageDirectionalMovementIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return AverageDirectionalMovementIndicator.COLORS_ORANGE_BLUE;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},lineColor:"ChartColor",axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var BollingerIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Bollinger",IndicatorsManager.BOLLINGER_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=BollingerIndicator.COLORS_DEFAULT;};BollingerIndicator=stjs.extend(BollingerIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.PURPLE,ChartColor.PURPLE,ChartColor.PURPLE];prototype.upperBand=null;prototype.middleBand=null;prototype.lowerBand=null;prototype.currentPeriod=0;prototype.numberOfStandardDeviations=0.0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||this.numberOfStandardDeviations!=this.getDoubleParameter(IndicatorsParameters.DEVIATIONS_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.numberOfStandardDeviations=this.getDoubleParameter(IndicatorsParameters.DEVIATIONS_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod;this.updateSeries(mainSerie);var barTotal=0;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,Serie.Y,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){barTotal=0;if(i>=periodLimit){var actualVal=0;for(var j=i;j>i-period;j--){var currValue=mainSerie.getValueAsDouble(j,Serie.Y);if(DefaultIndicator.isValidFinancialValue(currValue)){barTotal+=currValue;actualVal++;}}
if(actualVal>0){var mb=barTotal/actualVal;var innerSum=0.0;var temp=0.0;for(var j=i;j>i-period;j--){var currValue=mainSerie.getValueAsDouble(j,Serie.Y);if(DefaultIndicator.isValidFinancialValue(currValue)){temp=(currValue-mb);innerSum+=temp*temp;}}
this.middleBand.pushValue(mb);this.upperBand.pushValue(mb+this.numberOfStandardDeviations*Math.sqrt(innerSum/actualVal));this.lowerBand.pushValue(mb-this.numberOfStandardDeviations*Math.sqrt(innerSum/actualVal));}else{this.middleBand.pushValue(null);this.upperBand.pushValue(null);this.lowerBand.pushValue(null);}}else{this.middleBand.pushValue(null);this.upperBand.pushValue(null);this.lowerBand.pushValue(null);}}};prototype.updateSeries=function(mainSerie){this.upperBand=this.createIndicatorSerie(mainSerie,"Bol-Upper",null,null);this.middleBand=this.createIndicatorSerie(mainSerie,"Bol-Middle",null,null);this.lowerBand=this.createIndicatorSerie(mainSerie,"Bol-Lower",null,null);this.series=[this.upperBand,this.middleBand,this.lowerBand];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscSerie(mainSerie,this.upperBand,index)){return 1;}
if(this.crossDescSerie(mainSerie,this.lowerBand,index)){return-1;}
return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod))+"/"+String.valueOf(Math.round(this.numberOfStandardDeviations));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.upperBand.setColor(colors[0]);this.middleBand.setColor(colors[1]);this.lowerBand.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return BollingerIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return BollingerIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var CommodityChannelIndexIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Commodity Channel Index",IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=CommodityChannelIndexIndicator.COLORS_DEFAULT;};CommodityChannelIndexIndicator=stjs.extend(CommodityChannelIndexIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.PURPLE,ChartColor.PURPLE,ChartColor.PURPLE];prototype.cci=null;prototype.upLine=null;prototype.midLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var timePeriod=this.currentPeriod;var currentValues=null;this.updateSeries(mainSerie);for(var i=0;i<mainPointsCount;i++){var currentHigh=mainSerie.getValueAsDouble(i,FinancialSerie.HIGH);var currentLow=mainSerie.getValueAsDouble(i,FinancialSerie.LOW);var currentClose=mainSerie.getValueAsDouble(i,FinancialSerie.CLOSE);if(i<timePeriod||!DefaultIndicator.isValidFinancialValue(currentHigh)||!DefaultIndicator.isValidFinancialValue(currentLow)||!DefaultIndicator.isValidFinancialValue(currentClose)){this.cci.pushValue(null);}else{var tpma=0;currentValues=[];for(var j=i;j>i-timePeriod;j--){var v1=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);var v2=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);var v3=mainSerie.getValueAsDouble(j,FinancialSerie.CLOSE);if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&DefaultIndicator.isValidFinancialValue(v3)){var tp=(v1+v2+v3)/3;tpma+=tp;currentValues.push(tp);}}
var validCount=currentValues.length;if(validCount>0){tpma/=validCount;var md=0;for(var j=0;j<validCount;j++){md+=Math.abs(currentValues[j]-tpma);}
md/=validCount;if(md!=0){var tpi=(currentHigh+currentLow+currentClose)/3;var ccival=(tpi-tpma)/(0.015*md);this.cci.pushValue(ccival);}else{this.cci.pushValue(null);}}else{this.cci.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.cci=this.createIndicatorSerie(mainSerie,"CCI",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"cci_up_line",null,null);this.midLine=this.createIndicatorSerie(mainSerie,"cci_middle_line",null,null);this.midLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"cci_down_line",null,null);this.upLine.setUniformValue(100.0);this.midLine.setUniformValue(0.0);this.downLine.setUniformValue(-100.0);this.series=[this.cci,this.upLine,this.midLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscConstant(this.cci,-100,index)){return 1;}
if(this.crossDescConstant(this.cci,100,index)){return-1;}
return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.cci.setColor(colors[0]);this.upLine.setColor(colors[0]);this.midLine.setColor(colors[0]);this.downLine.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return CommodityChannelIndexIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return CommodityChannelIndexIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var HistoricalVolatilityIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Volatility",IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=HistoricalVolatilityIndicator.COLORS_DEFAULT;this.hasSignals=false;};HistoricalVolatilityIndicator=stjs.extend(HistoricalVolatilityIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.DAILYVALUESBYYEAR=252;constructor.WEEKLYVALUESBYYEAR=52;constructor.MONTHLYVALUESBYYEAR=12;constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.black,ChartColor.black];prototype.continualProfitability=null;prototype.continualProfitabilityMAV=null;prototype.volatility=null;prototype.currentPeriod=0;constructor.getValueNumber=function(type){switch(type){case Frequency.Type.LIVE:case Frequency.Type.SECOND:case Frequency.Type.MINUTE:case Frequency.Type.HOUR:return 20;case Frequency.Type.DAY:return HistoricalVolatilityIndicator.DAILYVALUESBYYEAR;case Frequency.Type.WEEK:return HistoricalVolatilityIndicator.WEEKLYVALUESBYYEAR;case Frequency.Type.MONTH:return HistoricalVolatilityIndicator.MONTHLYVALUESBYYEAR;case Frequency.Type.YEAR:return 1;default:return 1;}};prototype.hasDifferentParameters=function(){return this.currentPeriod!=(this.getParameter(IndicatorsParameters.PERIOD_PARAMETER));};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod;this.updateSeries(mainSerie);var nbValues=HistoricalVolatilityIndicator.getValueNumber(mainSerie.getPeriod().getFrequency().getType());var which=Serie.Y;this.continualProfitability.pushValue(0.0);for(var i=1;i<mainPointsCount;i++){this.continualProfitability.pushValue(Math.log(mainSerie.getValueAsDouble(i,which)/mainSerie.getValueAsDouble(i-1,which)));}
this.continualProfitabilityMAV.computeMovingAverage(this.continualProfitability,0,period);var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.volatility.pushValue(null);}else{var total=0.0;var validCount=0;for(var k=0;k<period;k++){var cpVal=this.continualProfitability.getValueAsDouble(i-k,which);var cpMAVVal=this.continualProfitabilityMAV.getValueAsDouble(i,which);if(cpVal!=null&&!isNaN(cpVal)&&cpMAVVal!=null&&!isNaN(cpMAVVal)){validCount++;total+=Math.pow(cpVal-cpMAVVal,2);}}
if(validCount>1){var variance=(1.0/(validCount-1.0))*total;this.volatility.pushValue(100*(Math.sqrt(variance)*Math.sqrt(nbValues)));}else{this.volatility.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.volatility=this.createIndicatorSerie(mainSerie,"Volatility",null,null);this.continualProfitability=this.createIndicatorSerie(mainSerie,"Volatility",null,null);this.continualProfitabilityMAV=this.createIndicatorSerie(mainSerie,"volatilityMav",null,null);this.series=[this.volatility];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.volatility.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return HistoricalVolatilityIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return HistoricalVolatilityIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var LinearRegressionChannelIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Linear Regression",IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=LinearRegressionChannelIndicator.COLORS_DEFAULT;this.hasSignals=false;};LinearRegressionChannelIndicator=stjs.extend(LinearRegressionChannelIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.DAILYVALUESBYYEAR=252;constructor.WEEKLYVALUESBYYEAR=52;constructor.MONTHLYVALUESBYYEAR=12;constructor.COLORS_DEFAULT=[ChartColor.DARK_BLUE,ChartColor.LIGHT_ORANGE,ChartColor.LIGHT_ORANGE];prototype.pointsSerie=null;prototype.topSerie=null;prototype.bottomSerie=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return true;};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;var period=this.currentPeriod-1;this.updateSeries(mainSerie);var yString=Serie.Y;var nb=mainPointsCount;context.getMainMaxIndex(Serie.X);if(mainSerie!=null&&context.getRange(DefaultLayout.X_AXIS_AREA)!=null&&context.getRange(DefaultLayout.X_AXIS_AREA)[1]!=null){var lastIndex=mainSerie.findIndexAtOrBeforeXValue(context.getRange(DefaultLayout.X_AXIS_AREA)[1]);if(lastIndex!=null&&!isNaN(lastIndex)&&lastIndex<mainPointsCount){nb=lastIndex+1;}}
var startBar=nb-period;if(startBar<0){return;}
var x=0.0;var y=0.0;var xy=0.0;var xSquared=0.0;for(var i=startBar;i<nb;i++){x+=i;var value=mainSerie.getValueAsDouble(i,yString);if(DefaultIndicator.isValidFinancialValue(value)){y+=value;xy+=i*value;}
xSquared+=i*i;}
var b=(period*xy-x*y)/(period*xSquared-x*x);var a=(y-b*x)/period;var dummy=0.0;var diff=0.0;var yOffset=0.0;for(var i=startBar;i<nb;i++){var value=mainSerie.getValueAsDouble(i,yString);if(DefaultIndicator.isValidFinancialValue(value)){dummy=b*i+a;diff=Math.abs(value-dummy);yOffset=Math.max(yOffset,diff);}}
for(var i=0;i<nb;i++){if(i<startBar){this.pointsSerie.pushValue(null);this.topSerie.pushValue(null);this.bottomSerie.pushValue(null);}else{this.pointsSerie.pushValue(b*i+a);this.topSerie.pushValue(b*i+a+yOffset);this.bottomSerie.pushValue(b*i+a-yOffset);}}};prototype.updateSeries=function(mainSerie){this.pointsSerie=this.createIndicatorSerie(mainSerie,"LRC Points",null,null);this.topSerie=this.createIndicatorSerie(mainSerie,"LRC Top",null,null);this.bottomSerie=this.createIndicatorSerie(mainSerie,"LRC Bottom",null,null);this.series=[this.pointsSerie,this.topSerie,this.bottomSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.pointsSerie.setColor(colors[0]);this.topSerie.setColor(colors[1]);this.bottomSerie.setColor(colors[2]);}};prototype.getRedGreenSchema=function(){return LinearRegressionChannelIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return LinearRegressionChannelIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MACDIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"MACD",IndicatorsManager.MACD_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=MACDIndicator.COLORS_DEFAULT;this.histoColorStrategy=new ColorStrategy(ChartColor.orange,ChartColor.lightGrey2);};MACDIndicator=stjs.extend(MACDIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.RED_MACD,ChartColor.black];prototype.histogram=null;prototype.macd=null;prototype.signal=null;prototype.origin=null;prototype.period9=0;prototype.period12=0;prototype.period26=0;prototype.histoColorStrategy=null;prototype.hasDifferentParameters=function(){return this.period9!=this.getParameter(IndicatorsParameters.PERIOD_9_PARAMETER)||this.period12!=this.getParameter(IndicatorsParameters.PERIOD_12_PARAMETER)||this.period26!=this.getParameter(IndicatorsParameters.PERIOD_26_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.period9=this.getParameter(IndicatorsParameters.PERIOD_9_PARAMETER);this.period12=this.getParameter(IndicatorsParameters.PERIOD_12_PARAMETER);this.period26=this.getParameter(IndicatorsParameters.PERIOD_26_PARAMETER);this.updateSeries(mainSerie);var mae12=this.createIndicatorSerie(mainSerie,"mae12",null,null);mae12.computeExponentialMovingAverage(mainSerie,0,this.period12);var mae26=this.createIndicatorSerie(mainSerie,"mae26",null,null);mae26.computeExponentialMovingAverage(mainSerie,0,this.period26);this.macd.substract(mae12,mae26);this.signal.computeExponentialMovingAverage(this.macd,0,this.period9);this.histogram.substract(this.macd,this.signal);};prototype.updateSeries=function(mainSerie){this.histogram=this.createIndicatorSerie(mainSerie,"Histogram",null,null);this.macd=this.createIndicatorSerie(mainSerie,"MACD",null,null);this.signal=this.createIndicatorSerie(mainSerie,"MACD signal",null,null);this.origin=this.createIndicatorSerie(mainSerie,"macd_origin",null,null);this.histogram.setType(Chart.ChartType.BAR);this.origin.setUniformValue(0.0);this.origin.setDashed(true);this.series=[this.histogram,this.macd,this.signal,this.origin];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossDescSerie(this.signal,this.macd,index)){return 1;}
if(this.crossAscSerie(this.signal,this.macd,index)){return-1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.histogram.setColorStrategy(this.histoColorStrategy);this.macd.setColor(colors[1]);this.signal.setColor(colors[2]);this.origin.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return MACDIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MACDIndicator.COLORS_DEFAULT;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName()+" "+Math.round(this.period26)+"/"+Math.round(this.period12);serieDescription["color"]=MACDIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.period9);serieDescription["color"]=MACDIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},histoColorStrategy:"ColorStrategy",axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MomentumIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Momentum",IndicatorsManager.MOMENTUM_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=MomentumIndicator.COLORS_DEFAULT;this.hasSignals=false;};MomentumIndicator=stjs.extend(MomentumIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.MOMENTUM_COLOR,ChartColor.MOMENTUM_COLOR,ChartColor.MOMENTUM_COLOR];prototype.momentum=null;prototype.origin=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var period=this.currentPeriod;var periodLimit=firstValidIndex+period;for(var i=0;i<mainPointsCount;i++){var v1=mainSerie.getValueAsDouble(i,which);var v2=mainSerie.getValueAsDouble(i-period,which);if(i<=periodLimit||!DefaultIndicator.isValidFinancialValue(v1)||!DefaultIndicator.isValidFinancialValue(v2)){this.momentum.pushValue(null);}else{this.momentum.pushValue(v1-v2);}}};prototype.updateSeries=function(mainSerie){this.momentum=this.createIndicatorSerie(mainSerie,"Momentum",null,null);this.origin=this.createIndicatorSerie(mainSerie,"momentum_origin",null,null);this.origin.setUniformValue(0.0);this.origin.setDashed(true);this.series=[this.momentum,this.origin];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.momentum.setColor(colors[0]);this.origin.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return MomentumIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MomentumIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var MovingAverageIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Moving Average",IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=MovingAverageIndicator.COLORS_DEFAULT;};MovingAverageIndicator=stjs.extend(MovingAverageIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.GREEN_MAV,ChartColor.BLUE_MAV,ChartColor.RED_MAV];constructor.COLORS_ORANGE_BLUE=[ChartColor.blue,ChartColor.GRAY_MAV,ChartColor.orange];prototype.shortSerie=null;prototype.mediumSerie=null;prototype.longSerie=null;prototype.shortPeriodValue=null;prototype.mediumPeriodValue=null;prototype.longPeriodValue=null;prototype.hasDifferentParameters=function(){return this.shortPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER)||this.mediumPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER)||this.longPeriodValue!=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName()+" "+Math.round(this.shortPeriodValue);serieDescription["color"]=this.shortSerie!=null?this.shortSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.mediumPeriodValue);serieDescription["color"]=this.mediumSerie!=null?this.mediumSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+Math.round(this.longPeriodValue);serieDescription["color"]=this.longSerie!=null?this.longSerie.getColor():MovingAverageIndicator.COLORS_DEFAULT[2];description.push(serieDescription);return description;};prototype.calculateSeries=function(mainSerie,context){this.shortPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER);this.mediumPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER);this.longPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);this.updateSeries(mainSerie);this.shortSerie.computeMovingAverage(mainSerie,0,this.shortPeriodValue);this.mediumSerie.computeMovingAverage(mainSerie,0,this.mediumPeriodValue);this.longSerie.computeMovingAverage(mainSerie,0,this.longPeriodValue);};prototype.updateSeries=function(mainSerie){this.shortSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Short",null,null);this.mediumSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Medium",null,null);this.longSerie=this.createIndicatorSerie(mainSerie,this.getId()+" Long",null,null);this.series=[this.shortSerie,this.mediumSerie,this.longSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.shortSerie.setColor(colors[0]);this.mediumSerie.setColor(colors[1]);this.longSerie.setColor(colors[2]);}};prototype.getSignal=function(mainSerie,idx){if(this.crossAscSerie(this.shortSerie,this.mediumSerie,idx)){return 1;}
if(this.crossDescSerie(this.shortSerie,this.mediumSerie,idx)){return-1;}
if(this.crossAscSerie(this.shortSerie,this.longSerie,idx)){return 1;}
if(this.crossDescSerie(this.shortSerie,this.longSerie,idx)){return-1;}
if(this.crossAscSerie(this.mediumSerie,this.longSerie,idx)){return 1;}
if(this.crossDescSerie(this.mediumSerie,this.longSerie,idx)){return-1;}
return 0;};prototype.getRedGreenSchema=function(){return MovingAverageIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return MovingAverageIndicator.COLORS_ORANGE_BLUE;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var ExponentialMovingAverageIndicator=function(parameters,correspondingAreaId){MovingAverageIndicator.call(this,parameters,correspondingAreaId);this.name="Exponential Moving Average";this.id=IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID;this.colors=MovingAverageIndicator.COLORS_DEFAULT;};ExponentialMovingAverageIndicator=stjs.extend(ExponentialMovingAverageIndicator,MovingAverageIndicator,[],function(constructor,prototype){prototype.calculateSeries=function(mainSerie,context){this.shortPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_SHORT_PARAMETER);this.mediumPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_MEDIUM_PARAMETER);this.longPeriodValue=this.getParameter(IndicatorsParameters.PERIOD_LONG_PARAMETER);this.updateSeries(mainSerie);this.shortSerie.computeExponentialMovingAverage(mainSerie,0,this.shortPeriodValue);this.mediumSerie.computeExponentialMovingAverage(mainSerie,0,this.mediumPeriodValue);this.longSerie.computeExponentialMovingAverage(mainSerie,0,this.longPeriodValue);};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_ORANGE_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var OnBalanceVolumeIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"OBV",IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,parameters);this.colors=OnBalanceVolumeIndicator.COLORS_DEFAULT;this.hasSignals=false;};OnBalanceVolumeIndicator=stjs.extend(OnBalanceVolumeIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.OBV_COLOR,ChartColor.OBV_COLOR,ChartColor.OBV_COLOR];prototype.obv=null;prototype.hasDifferentParameters=function(){return false;};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);if(mainPointsCount<=0){return;}
var total=0;total=0;var which=Serie.Y;var volume=FinancialSerie.VOLUME;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);for(var i=0;i<mainPointsCount;i++){var currentVolume=mainSerie.getValueAsDouble(i,volume);if(i>=firstValidIndex&&currentVolume!=null&&!isNaN(currentVolume)){if(mainSerie.getValueAsDouble(i-1,which)<mainSerie.getValueAsDouble(i,which)){total=total+currentVolume;}else{total=total-currentVolume;}
this.obv.pushValue(total);}else{this.obv.pushValue(null);}}};prototype.updateSeries=function(mainSerie){this.obv=this.createIndicatorSerie(mainSerie,"OBV",null,null);this.series=[this.obv];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.obv.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return OnBalanceVolumeIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return OnBalanceVolumeIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var RSIIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Relative Strength Index",IndicatorsManager.RSI_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=RSIIndicator.COLORS_DEFAULT;};RSIIndicator=stjs.extend(RSIIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.RSI_COLOR,ChartColor.RSI_COLOR,ChartColor.RSI_COLOR];prototype.rsi=null;prototype.upLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.getMeanUp=function(s,period,idx,which){var diff;var up=0;var validCount=0;for(var j=idx;j>idx-period;j--){var v1=s.getValueAsDouble(j,which);var v2=s.getValueAsDouble(j-1,which);diff=v1-v2;if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&diff>=0){up+=diff;validCount++;}}
if(validCount>0){return up/validCount;}else{return null;}};prototype.getMeanDown=function(s,period,idx,which){var diff;var down=0;var validCount=0;for(var j=idx;j>idx-period;j--){var v1=s.getValueAsDouble(j,which);var v2=s.getValueAsDouble(j-1,which);diff=v1-v2;if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)&&diff<0){down-=diff;validCount++;}}
if(validCount>0){return down/validCount;}else{return null;}};prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var upClosingTotal=0;var downClosingTotal=0;var diff=0;var U=0.0;var D=0.0;var first=true;var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.rsi.pushValue(null);}else{upClosingTotal=0;downClosingTotal=0;var v1=mainSerie.getValueAsDouble(i,which);var v2=mainSerie.getValueAsDouble(i-1,which);if(first){U=this.getMeanUp(mainSerie,this.currentPeriod,i,which);D=this.getMeanDown(mainSerie,this.currentPeriod,i,which);if(U!=null&&D!=null){this.rsi.pushValue(100-(100/(1+(U/D))));first=false;}else{this.rsi.pushValue(null);}}else if(DefaultIndicator.isValidFinancialValue(v1)&&DefaultIndicator.isValidFinancialValue(v2)){diff=v1-v2;if(diff>=0){upClosingTotal=U*(this.currentPeriod-1)+diff;downClosingTotal=D*(this.currentPeriod-1);}
if(diff<0){upClosingTotal=U*(this.currentPeriod-1);downClosingTotal=D*(this.currentPeriod-1)+Math.abs(diff);}
U=upClosingTotal/this.currentPeriod;D=downClosingTotal/this.currentPeriod;this.rsi.pushValue(100-(100/(1+(U/D))));}else{this.rsi.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.rsi=this.createIndicatorSerie(mainSerie,"RSI",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"rsi_up",null,null);this.upLine.setDashed(true);this.downLine=this.createIndicatorSerie(mainSerie,"rsi_down",null,null);this.downLine.setDashed(true);this.upLine.setUniformValue(70.0);this.downLine.setUniformValue(30.0);this.series=[this.rsi,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossDescConstant(this.rsi,70,index)){return-1;}
if(this.crossAscConstant(this.rsi,30,index)){return 1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.rsi.setColor(colors[0]);this.upLine.setColor(colors[1]);this.downLine.setColor(colors[2]);}};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};prototype.getRedGreenSchema=function(){return RSIIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return RSIIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var SARIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Parabolic SAR",IndicatorsManager.SAR_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=SARIndicator.COLORS_DEFAULT;};SARIndicator=stjs.extend(SARIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.BLUE_SAR,ChartColor.BLUE_SAR,ChartColor.BLUE_SAR];prototype.sarSerie=null;prototype.currentPeriod=0;prototype.currentAcceleration=0.0;prototype.currentMaxAcceleration=0.0;prototype.isBigger=function(high,sar){var dh=Math.round(high*1000);var ds=Math.round(sar*1000);if((dh-ds)+1>=0){return true;}
return false;};prototype.isLower=function(low,sar){var dl=Math.round(low*1000);var ds=Math.round(sar*1000);if((ds-dl)+1>=0){return true;}
return false;};prototype.getMaxValueInRange=function(serie,start,end,which){if(serie==null||which==null||end<start){return null;}
var currentMaxValue=Double.NEGATIVE_INFINITY;for(var i=start;i<end;i++){var currentValue=serie.getValueAsDouble(i,which);if(currentValue!=null&&currentValue>currentMaxValue){currentMaxValue=currentValue;}}
return currentMaxValue;};prototype.getMinValueInRange=function(serie,start,end,which){if(serie==null||which==null||end<start){return null;}
var currentMinValue=Double.POSITIVE_INFINITY;for(var i=start;i<end;i++){var currentValue=serie.getValueAsDouble(i,which);if(currentValue!=null&&currentValue<currentMinValue){currentMinValue=currentValue;}}
return currentMinValue;};prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||(this.currentAcceleration!=this.getDoubleParameter(IndicatorsParameters.ACCELERATION_PARAMETER))||(this.currentMaxAcceleration!=this.getDoubleParameter(IndicatorsParameters.MAX_ACCELERATION_PARAMETER));};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.currentAcceleration=this.getDoubleParameter(IndicatorsParameters.ACCELERATION_PARAMETER);this.currentMaxAcceleration=this.getDoubleParameter(IndicatorsParameters.MAX_ACCELERATION_PARAMETER);var currentAcceleration=this.currentAcceleration*(0.01);var currentMaxAcceleration=this.currentMaxAcceleration*(0.01);this.updateSeries(mainSerie);var highWhich=FinancialSerie.HIGH;var lowWhich=FinancialSerie.LOW;var firstHigh=this.getMaxValueInRange(mainSerie,0,this.currentPeriod,highWhich);var firstLow=this.getMinValueInRange(mainSerie,0,this.currentPeriod,lowWhich);var secHigh=this.getMaxValueInRange(mainSerie,this.currentPeriod,2*this.currentPeriod,highWhich);var secLow=this.getMinValueInRange(mainSerie,this.currentPeriod,2*this.currentPeriod,lowWhich);var sar;var sarUp;sarUp=(firstHigh<secHigh)&&(firstLow<secLow)||(firstHigh+firstLow<=secHigh+secLow);sar=sarUp?firstLow:firstHigh;var a=currentAcceleration;var hereWeGo=false;var high=firstHigh;var low=firstLow;var oldHigh;var oldLow;for(var i=0;i<mainPointsCount;i++){var currentValue=mainSerie.getValueAsDouble(i,Serie.Y);var previousValue=mainSerie.getValueAsDouble(i-1,Serie.Y);if(i<this.currentPeriod||!DefaultIndicator.isValidFinancialValue(currentValue)||!DefaultIndicator.isValidFinancialValue(previousValue)){this.sarSerie.pushValue(null);continue;}
var dataH=mainSerie.getValueAsDouble(i,highWhich);var dataL=mainSerie.getValueAsDouble(i,lowWhich);var result=0;oldHigh=high;oldLow=low;hereWeGo=false;if(high<dataH){high=dataH;}
if(low>dataL){low=dataL;}
if((this.isLower(dataL,sar))&&(sarUp)){sarUp=false;low=dataL;sar=high;result=sar;a=currentAcceleration;hereWeGo=true;}
if((this.isBigger(dataH,sar))&&(!hereWeGo&&!sarUp)){sarUp=true;high=dataH;sar=low;result=sar;a=currentAcceleration;hereWeGo=true;}
if(!hereWeGo){if(sarUp){result=(sar+a*(high-sar));result=Math.min(result,Math.min(dataL,mainSerie.getValueAsDouble(i-1,lowWhich)));sar=result;if(high!=oldHigh){a=a+currentAcceleration;}}else{result=(sar+a*(low-sar));result=Math.max(result,Math.max(dataH,mainSerie.getValueAsDouble(i-1,highWhich)));sar=result;if(low!=oldLow){a=a+currentAcceleration;}}
if(a>currentMaxAcceleration){a=currentMaxAcceleration;}}
this.sarSerie.pushValue(sar);}};prototype.updateSeries=function(mainSerie){this.sarSerie=this.createIndicatorSerie(mainSerie,"SAR",null,null);this.sarSerie.setType(Chart.ChartType.POINT);this.series=[this.sarSerie];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.crossAscSerie(this.sarSerie,mainSerie,index)){return-1;}
if(this.crossDescSerie(this.sarSerie,mainSerie,index)){return 1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.sarSerie.setColor(colors[0]);}};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod))+"/"+String.valueOf(Math.round(this.currentAcceleration))+"/"+String.valueOf(Math.round(this.currentMaxAcceleration));};prototype.getRedGreenSchema=function(){return SARIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return SARIndicator.COLORS_DEFAULT;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var StandardDeviationIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Standard Deviation",IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=StandardDeviationIndicator.COLORS_DEFAULT;this.hasSignals=false;};StandardDeviationIndicator=stjs.extend(StandardDeviationIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.OBV_COLOR,ChartColor.OBV_COLOR,ChartColor.OBV_COLOR];prototype.stdDev=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var ma=this.createIndicatorSerie(mainSerie,"ma",null,null);ma.computeMovingAverage(mainSerie,0,this.currentPeriod);var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){var maVal=ma.getValueAsDouble(i,which);if(i<periodLimit||maVal==null||isNaN(maVal)){this.stdDev.pushValue(null);}else{var barTotal=0;var validCount=0;for(var j=i;j>i-this.currentPeriod&&j>=0;j--){var v1=mainSerie.getValueAsDouble(j,which);if(DefaultIndicator.isValidFinancialValue(v1)){barTotal+=Math.pow(v1-maVal,2);validCount++;}}
if(validCount>0){this.stdDev.pushValue(Math.sqrt(barTotal/validCount));}else{this.stdDev.pushValue(null);}}}};prototype.updateSeries=function(mainSerie){this.stdDev=this.createIndicatorSerie(mainSerie,"Std.Dev.",null,null);this.series=[this.stdDev];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.stdDev.setColor(colors[0]);}};prototype.getRedGreenSchema=function(){return StandardDeviationIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return StandardDeviationIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var StochasticOscillatorIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Stochastic",IndicatorsManager.STOCHASTIC_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=StochasticOscillatorIndicator.COLORS_DEFAULT;};StochasticOscillatorIndicator=stjs.extend(StochasticOscillatorIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.STO_COLOR,ChartColor.black,ChartColor.STO_COLOR,ChartColor.STO_COLOR];prototype.kVals=null;prototype.dVals=null;prototype.upLine=null;prototype.downLine=null;prototype.period=0;prototype.percentKPeriods=0;prototype.percentDPeriods=0;prototype.getHighestHigh=function(s,kper,period){var sr=this.createIndicatorSerie(s,"tmp",null,null);var serieLength=s!=null?s.getLength():0;for(var i=0;i<serieLength;i++){var v=s.getValueAsDouble(i,FinancialSerie.HIGH);for(var j=stjs.trunc(Math.max(i-period,0));j<=i;j++){v=Math.max(v,s.getValueAsDouble(j,FinancialSerie.HIGH));}
sr.pushValue(v);}
var highestHigh=this.createIndicatorSerie(s,"highestHigh",null,null);highestHigh.computeMovingAverage(sr,0,kper);return highestHigh;};prototype.getLowestLow=function(s,kper,period){var sr=this.createIndicatorSerie(s,"tmp",null,null);var serieLength=s!=null?s.getLength():0;for(var i=0;i<serieLength;i++){var v=s.getValueAsDouble(i,FinancialSerie.LOW);for(var j=stjs.trunc(Math.max(i-period,0));j<=i;j++){v=Math.min(v,s.getValueAsDouble(j,FinancialSerie.LOW));}
sr.pushValue(v);}
var lowestLow=this.createIndicatorSerie(s,"lowestLow",null,null);lowestLow.computeMovingAverage(sr,0,kper);return lowestLow;};prototype.hasDifferentParameters=function(){return this.period!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER)||this.percentKPeriods!=this.getParameter(IndicatorsParameters.PERIOD_K_PARAMETER)||this.percentDPeriods!=this.getParameter(IndicatorsParameters.PERIOD_D_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.period=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);this.percentKPeriods=this.getParameter(IndicatorsParameters.PERIOD_K_PARAMETER);this.percentDPeriods=this.getParameter(IndicatorsParameters.PERIOD_D_PARAMETER);this.updateSeries(mainSerie);var lowestLow=this.getLowestLow(mainSerie,this.percentKPeriods,this.period);var highestHigh=this.getHighestHigh(mainSerie,this.percentKPeriods,this.period);var myClose=this.createIndicatorSerie(mainSerie,"myClose",null,null);myClose.computeMovingAverage(mainSerie,0,this.percentKPeriods);var firstPoint=this.period+this.percentKPeriods+this.percentDPeriods;var which=Serie.Y;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,which,0);var periodLimit=firstValidIndex+firstPoint;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.kVals.pushValue(null);}else{this.kVals.pushValue(100*(myClose.getValueAsDouble(i,which)-lowestLow.getValueAsDouble(i,which))/(highestHigh.getValueAsDouble(i,which)-lowestLow.getValueAsDouble(i,which)));}}
this.dVals.computeMovingAverage(this.kVals,0,this.percentDPeriods);};prototype.updateSeries=function(mainSerie){this.kVals=this.createIndicatorSerie(mainSerie,"Stochastic %K.",null,null);this.dVals=this.createIndicatorSerie(mainSerie,"Stochastic %D",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"sto_up",null,null);this.downLine=this.createIndicatorSerie(mainSerie,"sto_down",null,null);this.upLine.setDashed(true);this.upLine.setUniformValue(80.0);this.downLine.setDashed(true);this.downLine.setUniformValue(20.0);this.series=[this.kVals,this.dVals,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.getSignal=function(mainSerie,index){if(this.dVals.getValueAsDouble(index-1,Serie.Y)<20&&this.crossAscSerie(this.kVals,this.dVals,index)){return 1;}
if(this.kVals.getValueAsDouble(index-1,Serie.Y)>80&&this.crossAscSerie(this.dVals,this.kVals,index)){return-1;}
return 0;};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=4){this.kVals.setColor(colors[0]);this.dVals.setColor(colors[1]);this.upLine.setColor(colors[2]);this.downLine.setColor(colors[3]);}};prototype.getRedGreenSchema=function(){return StochasticOscillatorIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return StochasticOscillatorIndicator.COLORS_DEFAULT;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=")";serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[0];description.push(serieDescription);serieDescription={};serieDescription["text"]="/"+String.valueOf(Math.round(this.percentDPeriods));serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[1];description.push(serieDescription);serieDescription={};serieDescription["text"]=this.getName()+"("+String.valueOf(Math.round(this.period))+"/"+String.valueOf(Math.round(this.percentKPeriods));serieDescription["color"]=StochasticOscillatorIndicator.COLORS_DEFAULT[0];description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var VolumeIndicator=function(correspondingAreaId){DefaultIndicator.call(this,"Volume",IndicatorsManager.VOLUME_INDICATOR_ID,correspondingAreaId,Layout.Position.LEFT,{});this.colors=VolumeIndicator.COLORS_DEFAULT;this.valid=false;this.hasSignals=false;};VolumeIndicator=stjs.extend(VolumeIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.greenOld,ChartColor.redOld];constructor.COLORS_BLUE=[ChartColor.blue,ChartColor.orange];prototype.volume=null;prototype.valid=false;prototype.hasDifferentParameters=function(){return false;};prototype.calculateSeries=function(mainSerie,context){var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=FinancialSerie.VOLUME;this.valid=false;for(var i=0;i<mainPointsCount;i++){var volumeValue=mainSerie.getValueAsDouble(i,which);this.volume.setValue(i,volumeValue);if(volumeValue!=null&&volumeValue>0){this.valid=true;}}};prototype.getSeries=function(){if(this.valid){return this.series;}else{return[];}};prototype.setEnabled=function(enabled){if(this.parameters!=null){if(enabled==null){enabled=true;}
this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=enabled;}
for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;this.series[index].setEnabled(enabled);}};prototype.isEnabled=function(){if(this.parameters==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="false"){return false;}
if(this.parameters[IndicatorsParameters.ENABLED_PARAMETER]==null||this.parameters[IndicatorsParameters.ENABLED_PARAMETER]=="true"){return true;}
return this.parameters[IndicatorsParameters.ENABLED_PARAMETER];};prototype.updateSeries=function(mainSerie){this.volume=this.createIndicatorSerie(mainSerie,"Volume",null,null);this.series=[this.volume];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=2){var a=new ColorStrategy(colors[0],colors[1]);this.volume.setColorStrategy(a);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return VolumeIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return VolumeIndicator.COLORS_BLUE;};prototype.getDescription=function(){var description=[];var serieDescription={};serieDescription["text"]=this.getName();serieDescription["color"]=ChartColor.black;description.push(serieDescription);return description;};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},COLORS_BLUE:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var WilliamsPercentRIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Williams %",IndicatorsManager.AROON_INDICATOR_ID,correspondingAreaId,Layout.Position.RIGHT,parameters);this.colors=WilliamsPercentRIndicator.COLORS_DEFAULT;this.hasSignals=false;};WilliamsPercentRIndicator=stjs.extend(WilliamsPercentRIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.black,ChartColor.black,ChartColor.black];prototype.wil=null;prototype.upLine=null;prototype.downLine=null;prototype.currentPeriod=0;prototype.hasDifferentParameters=function(){return this.currentPeriod!=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);};prototype.calculateSeries=function(mainSerie,context){this.currentPeriod=this.getParameter(IndicatorsParameters.PERIOD_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var min;var max;var firstValidIndex=DefaultIndicator.getFirstValidFinancialIndex(mainSerie,FinancialSerie.LOW,0);var periodLimit=firstValidIndex+this.currentPeriod;for(var i=0;i<mainPointsCount;i++){if(i<periodLimit){this.wil.pushValue(null);}else{min=mainSerie.getValueAsDouble(i,FinancialSerie.LOW);max=mainSerie.getValueAsDouble(i,FinancialSerie.HIGH);for(var j=i-1;j>=i-this.currentPeriod;j--){if(mainSerie.getValueAsDouble(j,FinancialSerie.LOW)<min){min=mainSerie.getValueAsDouble(j,FinancialSerie.LOW);}
if(mainSerie.getValueAsDouble(j,FinancialSerie.HIGH)>max){max=mainSerie.getValueAsDouble(j,FinancialSerie.HIGH);}}
this.wil.pushValue((max-mainSerie.getValueAsDouble(i,FinancialSerie.CLOSE))/(max-min)*(-100));}}};prototype.updateSeries=function(mainSerie){this.wil=this.createIndicatorSerie(mainSerie,"Williams %",null,null);this.upLine=this.createIndicatorSerie(mainSerie,"williams_up",null,null);this.downLine=this.createIndicatorSerie(mainSerie,"williams_down",null,null);this.upLine.setUniformValue(-20.0);this.upLine.setDashed(true);this.downLine.setUniformValue(-80.0);this.downLine.setDashed(true);this.series=[this.wil,this.upLine,this.downLine];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.wil.setColor(colors[0]);this.upLine.setColor(colors[2]);this.downLine.setColor(colors[2]);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return WilliamsPercentRIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return WilliamsPercentRIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPeriod));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var ZigZagIndicator=function(parameters,correspondingAreaId){DefaultIndicator.call(this,"Zig Zag",IndicatorsManager.ZIG_ZAG_INDICATOR_ID,correspondingAreaId,null,parameters);this.colors=ZigZagIndicator.COLORS_DEFAULT;this.hasSignals=false;};ZigZagIndicator=stjs.extend(ZigZagIndicator,DefaultIndicator,[],function(constructor,prototype){constructor.COLORS_DEFAULT=[ChartColor.RED_FULL,ChartColor.RED_FULL,ChartColor.RED_FULL];prototype.zigZag=null;prototype.currentPercent=0;prototype.hasDifferentParameters=function(){return true;};prototype.calculateSeries=function(mainSerie,context){this.currentPercent=this.getParameter(IndicatorsParameters.PERCENT_PARAMETER);var mainPointsCount=mainSerie!=null?mainSerie.getLength():0;this.updateSeries(mainSerie);var which=Serie.Y;var nStartIdx=0;var trend=0;var limit=mainSerie.getValueAsDouble(nStartIdx,which);var iLimit=nStartIdx;this.zigZag.setValue(iLimit,limit);for(var i=nStartIdx;i<mainPointsCount;i++){var close=mainSerie.getValueAsDouble(i,which);if(trend==0){if(close-limit>=limit*this.currentPercent/100){trend=1;}else if(limit-close>=limit*this.currentPercent/100){trend=-1;}else{continue;}}
if(-trend*(close-limit)>=limit*this.currentPercent/100){trend=-trend;this.zigZag.setValue(iLimit,limit);iLimit=i;limit=close;}
if(trend*close>=trend*limit){iLimit=i;limit=close;}}
this.zigZag.setValue(mainPointsCount-1,mainSerie.getValueAsDouble(mainPointsCount-1,which));};prototype.updateSeries=function(mainSerie){this.zigZag=this.createIndicatorSerie(mainSerie,"ZigZag",null,null);this.series=[this.zigZag];this.setEnabled(this.isEnabled());this.setColors(this.colors);};prototype.setColors=function(colors){DefaultIndicator.prototype.setColors.call(this,colors);if(colors!=null&&colors.length>=3){this.zigZag.setColor(colors[0]);}};prototype.getSignal=function(mainSerie,index){return 0;};prototype.getRedGreenSchema=function(){return ZigZagIndicator.COLORS_DEFAULT;};prototype.getOrangeBlueSchema=function(){return ZigZagIndicator.COLORS_DEFAULT;};prototype.getParamValues=function(){return String.valueOf(Math.round(this.currentPercent));};},{COLORS_DEFAULT:{name:"Array",arguments:["ChartColor"]},axisPosition:{name:"Enum",arguments:["Layout.Position"]},parameters:{name:"Map",arguments:[null,"Object"]},series:{name:"Array",arguments:["S"]},colors:{name:"Array",arguments:["ChartColor"]},signalsColorStrategy:"ColorStrategy"},{});
var IndicatorsManager=function(financialChartOption){this.indicatorsBySerie={};this.indicatorParamsIntraday=financialChartOption.getIndicatorsParametersIntraday();this.indicatorParamsHisto=financialChartOption.getIndicatorsParametersHisto();if(this.indicatorParamsIntraday==null){this.indicatorParamsIntraday=IndicatorsParameters.getDefault();}
if(this.indicatorParamsHisto==null){this.indicatorParamsHisto=IndicatorsParameters.getDefault();}
this.currentColorSchema=financialChartOption.getColorSchema();};IndicatorsManager=stjs.extend(IndicatorsManager,null,[],function(constructor,prototype){constructor.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID="ADX";constructor.AROON_INDICATOR_ID="ARO";constructor.BOLLINGER_INDICATOR_ID="BOL";constructor.COMMODITY_CHANNEL_INDEX_INDICATOR_ID="CCI";constructor.EXP_MOVING_AVERAGE_INDICATOR_ID="EMA";constructor.HISTORICAL_VOLATILITY_INDICATOR_ID="HVO";constructor.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID="LRC";constructor.MACD_INDICATOR_ID="MACD";constructor.MOVING_AVERAGE_INDICATOR_ID="MAV";constructor.MOMENTUM_INDICATOR_ID="MOM";constructor.ON_BALANCE_VOLUME_INDICATOR_ID="OBV";constructor.RSI_INDICATOR_ID="RSI";constructor.SAR_INDICATOR_ID="SAR";constructor.STANDARD_DEVIATION_INDICATOR_ID="STD";constructor.STOCHASTIC_INDICATOR_ID="STO";constructor.VOLUME_INDICATOR_ID="VOL";constructor.WILLIAMS_PERC_INDICATOR_ID="WIL";constructor.ZIG_ZAG_INDICATOR_ID="ZIG";constructor.AVAILABLE_INDICATORS=[IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID,IndicatorsManager.AROON_INDICATOR_ID,IndicatorsManager.BOLLINGER_INDICATOR_ID,IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID,IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID,IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID,IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,IndicatorsManager.MACD_INDICATOR_ID,IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID,IndicatorsManager.MOMENTUM_INDICATOR_ID,IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID,IndicatorsManager.RSI_INDICATOR_ID,IndicatorsManager.SAR_INDICATOR_ID,IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID,IndicatorsManager.STOCHASTIC_INDICATOR_ID,IndicatorsManager.VOLUME_INDICATOR_ID,IndicatorsManager.WILLIAMS_PERC_INDICATOR_ID,IndicatorsManager.ZIG_ZAG_INDICATOR_ID];prototype.indicatorsBySerie=null;prototype.indicatorParamsIntraday=null;prototype.indicatorParamsHisto=null;prototype.currentColorSchema=null;prototype.updateIndicatorParameters=function(financialChartOption){this.indicatorParamsIntraday=financialChartOption.getIndicatorsParametersIntraday();this.indicatorParamsHisto=financialChartOption.getIndicatorsParametersHisto();if(this.indicatorParamsIntraday==null){this.indicatorParamsIntraday=IndicatorsParameters.getDefault();}
if(this.indicatorParamsHisto==null){this.indicatorParamsHisto=IndicatorsParameters.getDefault();}
this.currentColorSchema=financialChartOption.getColorSchema();};prototype.enable=function(options,indicatorId){var intraday=IndicatorsManager.isIntradayFromOptions(options);var indicator=this.getIndicator(IndicatorsManager.getSerieTypeIdFromOptions(options),indicatorId,intraday);var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicator!=null){indicator.setEnabled(true);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=true;}}
return indicator;};prototype.disable=function(options,indicatorId){var intraday=IndicatorsManager.isIntradayFromOptions(options);var indicator=this.getIndicator(IndicatorsManager.getSerieTypeIdFromOptions(options),indicatorId,intraday);var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicator!=null){indicator.setEnabled(false);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=false;}}
return indicator;};prototype.disableAll=function(mainSerie){var intraday=mainSerie!=null&&mainSerie.getPeriod()!=null&&mainSerie.isIntraday();var indicatorsParams=this.indicatorParamsHisto;if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
var serieTypeId=IndicatorsManager.getSerieTypeId(mainSerie);var indicators=this.indicatorsBySerie[serieTypeId];for(var indicatorId in indicators){var currentIndicator=indicators[indicatorId];if(currentIndicator!=null){currentIndicator.setEnabled(false);var indicatorParam=indicatorsParams.getIndicatorParameters(indicatorId);if(indicatorParam!=null){indicatorParam["enabled"]=false;}}}};prototype.getActiveIndicators=function(mainSerie){var activeIndicatorsArray=[];var indicators=this.indicatorsBySerie[IndicatorsManager.getSerieTypeId(mainSerie)];var indicatorsParams=this.indicatorParamsHisto;var intraday=mainSerie!=null&&mainSerie.getPeriod()!=null&&mainSerie.isIntraday();if(intraday){indicatorsParams=this.indicatorParamsIntraday;}
for(var index in IndicatorsManager.AVAILABLE_INDICATORS){if(!(IndicatorsManager.AVAILABLE_INDICATORS).hasOwnProperty(index))
continue;var indicatorId=IndicatorsManager.AVAILABLE_INDICATORS[index];var currentIndicator=this.getIndicator(IndicatorsManager.getSerieTypeId(mainSerie),indicatorId,intraday);if(currentIndicator!=null){currentIndicator.setParameters(indicatorsParams.getIndicatorParameters(indicatorId));currentIndicator.updateColorSchema(this.currentColorSchema);if(currentIndicator.isEnabled()){activeIndicatorsArray.push(currentIndicator);}}}
return activeIndicatorsArray;};prototype.isActiveIndicators=function(mainSerie,indicatorId){var indicators=this.indicatorsBySerie[IndicatorsManager.getSerieTypeId(mainSerie)];if(indicators!=null){var indicator=indicators[indicatorId];return indicator!=null&&indicator.isEnabled();}else{return false;}};prototype.getIndicator=function(serieId,indicatorId,isIntraday){var indicators=this.indicatorsBySerie[serieId];var indicator=null;var indicatorsParams=this.indicatorParamsHisto;if(isIntraday){indicatorsParams=this.indicatorParamsIntraday;}
if(indicators==null){indicator=IndicatorsManager.createIndicator(indicatorsParams,indicatorId);indicators={};if(indicator!=null){indicators[indicatorId]=indicator;}
this.indicatorsBySerie[serieId]=indicators;}else{indicator=indicators[indicatorId];if(indicator==null){indicator=IndicatorsManager.createIndicator(indicatorsParams,indicatorId);if(indicator!=null){indicators[indicatorId]=indicator;}}}
return indicator;};constructor.createIndicator=function(indicatorsParams,indicatorId){var parameters=null;if(indicatorsParams!=null){parameters=indicatorsParams.getIndicatorParameters(indicatorId);}
if(parameters==null){parameters=IndicatorsParameters.getDefaultIndicatorParameters(indicatorId);}
if(indicatorId==IndicatorsManager.AVERAGE_DIRECTIONAL_MOVEMENT_INDICATOR_ID){return new AverageDirectionalMovementIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.AROON_INDICATOR_ID){return new AroonIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.BOLLINGER_INDICATOR_ID){return new BollingerIndicator(parameters,FinancialLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.COMMODITY_CHANNEL_INDEX_INDICATOR_ID){return new CommodityChannelIndexIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.EXP_MOVING_AVERAGE_INDICATOR_ID){return new ExponentialMovingAverageIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.HISTORICAL_VOLATILITY_INDICATOR_ID){return new HistoricalVolatilityIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID){return new LinearRegressionChannelIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MACD_INDICATOR_ID){return new MACDIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MOVING_AVERAGE_INDICATOR_ID){return new MovingAverageIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.MOMENTUM_INDICATOR_ID){return new MomentumIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.ON_BALANCE_VOLUME_INDICATOR_ID){return new OnBalanceVolumeIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.RSI_INDICATOR_ID){return new RSIIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.SAR_INDICATOR_ID){return new SARIndicator(parameters,DefaultLayout.GRAPH_AREA);}else if(indicatorId==IndicatorsManager.STANDARD_DEVIATION_INDICATOR_ID){return new StandardDeviationIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.STOCHASTIC_INDICATOR_ID){return new StochasticOscillatorIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.VOLUME_INDICATOR_ID){return new VolumeIndicator(FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.WILLIAMS_PERC_INDICATOR_ID){return new WilliamsPercentRIndicator(parameters,FinancialLayout.BOTTOM_GRAPH_AREA);}else if(indicatorId==IndicatorsManager.ZIG_ZAG_INDICATOR_ID){return new ZigZagIndicator(parameters,DefaultLayout.GRAPH_AREA);}else{return null;}};constructor.getSerieTypeId=function(mainSerie){if(mainSerie==null){return null;}
var prefix=mainSerie.getKey();var suffix=Period.HISTO;if(mainSerie.getPeriod()!=null&&mainSerie.isIntraday()){suffix=Period.INTRADAY;}
return prefix+"_"+suffix;};constructor.getSerieTypeIdFromOptions=function(options){if(options==null||options.getStocks()==null||options.getStocks()[0]==null){return null;}
var prefix=options.getStocks()[0].getKey();var suffix=Period.HISTO;var period=Period.getInstance(options.getPeriod(),options.getFrequency());if(period!=null&&period.isIntraday()){suffix=Period.INTRADAY;}
return prefix+"_"+suffix;};constructor.isIntradayFromOptions=function(options){if(options==null||options.getStocks()==null||options.getStocks()[0]==null){return false;}
var period=Period.getInstance(options.getPeriod(),options.getFrequency());if(period!=null&&period.isIntraday()){return true;}else{return false;}};},{AVAILABLE_INDICATORS:{name:"Array",arguments:[null]},indicatorsBySerie:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Indicator"]}]},indicatorParamsIntraday:"IndicatorsParameters",indicatorParamsHisto:"IndicatorsParameters"},{});
var FinancialSeriesDataProvider=function(config){MobileServiceDataProvider.call(this,config);};FinancialSeriesDataProvider=stjs.extend(FinancialSeriesDataProvider,MobileServiceDataProvider,[],function(constructor,prototype){prototype.getNewSeries=function(data){if(data==null){return null;}
var keysCount=this.stocks!=null?this.stocks.length:0;var colorStrategy=this.config.getColorStrategy();var addYesterday=this.config.isAddYesterday();var series=data.getSeries();var newSeries=[];var period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());if(keysCount>0){var mainSerie=this.getSerieFromChartType((series!=null)?series[0]:null,this.stocks[0],this.config,period);if(mainSerie!=null){mainSerie.setColorStrategy(colorStrategy);newSeries[0]=mainSerie;}else{return newSeries;}}
for(var i=1;i<keysCount;i++){var currentStock=this.stocks[i];var currentDataSerie=(series!=null)?series[i]:null;period=Period.getInstance(this.config.getPeriod(),this.config.getFrequency());if(currentStock!=null&&(currentDataSerie==null||currentDataSerie.getDataId(this.config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,this.config.getWidthParam()))){if(period.isIntraday()){var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(this.config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(this.config.isStretchRightSide());currentDataSerie=newIntradaySerie;}else{var newHistoSerie=new HistoSerie(period,null,currentStock);newHistoSerie.setColor(this.config.getDefaultHistoColor());currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([Serie.Y]);currentDataSerie.setType(Chart.ChartType.LINE);newSeries[i]=currentDataSerie;}
return newSeries;};prototype.getSerieFromChartType=function(currentDataSerie,currentStock,config,period){var colorStrategy=config.getColorStrategy();var addYesterday=config.isAddYesterday();var mainChartType=Chart.ChartType.valueOf(config.getType());if(currentStock!=null&&(currentDataSerie==null||currentDataSerie.getDataId(config.getWidthParam())!=currentDataSerie.createDataId(currentStock.getKey(),period,config.getWidthParam())||(currentDataSerie.getType()==Chart.ChartType.BID_ASK&&mainChartType!=Chart.ChartType.BID_ASK))){if(period.isIntraday()){var newIntradaySerie=new IntradaySerie(period,colorStrategy,currentStock,addYesterday);newIntradaySerie.setStretchLeftSide(config.isStretchLeftSide());newIntradaySerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newIntradaySerie;}else{var newHistoSerie=new HistoSerie(period,null,currentStock);currentDataSerie=newHistoSerie;}}else if(currentDataSerie!=null){if(currentDataSerie.isIntraday()){currentDataSerie.setColorStrategy(colorStrategy);}else{currentDataSerie.setColorStrategy(null);}
currentDataSerie.setStock(currentStock);}
if(currentStock!=null&&currentStock.isSwissDotsMarket()&&period!=null&&period.isLive()&&!period.spanSeveralDays()){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newBidAskSerie;currentDataSerie.setType(Chart.ChartType.BID_ASK);}else if(mainChartType==Chart.ChartType.POINT){if(period.isLive()){var newBidAskSerie=new BidAskSerie(period,colorStrategy,currentStock);newBidAskSerie.setStretchLeftSide(config.isStretchLeftSide());newBidAskSerie.setStretchRightSide(config.isStretchRightSide());currentDataSerie=newBidAskSerie;currentDataSerie.setType(Chart.ChartType.BID_ASK);}else if(period.isIntraday()){currentDataSerie.setMainField(FinancialSerie.CLOSE);currentDataSerie.setMainFields([FinancialSerie.HIGH,FinancialSerie.LOW,FinancialSerie.CLOSE]);}else{currentDataSerie.setMainField(FinancialSerie.CLOSE);currentDataSerie.setMainFields([FinancialSerie.CLOSE]);}}else if(mainChartType==Chart.ChartType.HL_AREA||mainChartType==Chart.ChartType.CANDLESTICK||mainChartType==Chart.ChartType.HLOC){currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([FinancialSerie.HIGH,FinancialSerie.LOW,Serie.Y]);}else{currentDataSerie.setMainField(Serie.Y);currentDataSerie.setMainFields([Serie.Y]);}
currentDataSerie.setColor(FinancialEngineModel.COLORS_ARRAY[0]);return currentDataSerie;};prototype.clone=function(){return new FinancialSeriesDataProvider(this.config);};},{refreshTimer:"TimeoutHandler",retrySetDataCallback:{name:"Callback2",arguments:[null,{name:"Array",arguments:[null]}]},autorefreshFunction:"Callback0",onRequestCompleteCallback:{name:"Callback4",arguments:[null,null,"D",{name:"Array",arguments:["S"]}]},stocks:{name:"Array",arguments:["Stock"]},dataProcessor:"PipeDelimitedDataProcessor",cache:"Cache",config:"ChartOption"},{});
var FinancialChartData=function(chart,provider,context){ChartData.call(this,chart,provider);if(chart!=null){this.indicatorsManager=new IndicatorsManager(chart.getChartOption());}
this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};this.intraday=false;this.context=context;};FinancialChartData=stjs.extend(FinancialChartData,ChartData,[],function(constructor,prototype){prototype.indicatorsManager=null;prototype.activeIndicatorSeries=null;prototype.mainGraphActiveIndicatorSeries=null;prototype.intraday=false;prototype.context=null;prototype.validateData=function(){var serieCount=(this.series!=null)?this.series.length:0;var mainSerie=this.getMainSerie();if(serieCount<=0||mainSerie==null){this.xValuesPeriods=null;this.extremums=null;this.totalXSpace=0;return;}
this.intraday=mainSerie.isIntraday();this.xSpaceValuesScale=mainSerie.getXSpaceScale();this.indexedXSpace=mainSerie.isIndexed();this.stepSize=mainSerie.getStepSize();if(this.indexedXSpace){this.indexedXValues=this.createGlobalIndexedXValues();}
var minNormalizedXValue=Double.POSITIVE_INFINITY;var maxNormalizedXValue=Double.NEGATIVE_INFINITY;var seriesPeriods=[];var flattenedPeriodSpace=0.0;for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.isEnabled()&&serie.getId()!=YesterdayLine.INDICATOR_ID){var serieStartValue=serie.getAbsoluteStartXValue();var serieEndValue=serie.getAbsoluteEndXValue();if(this.intraday&&serie.getPeriod()!=null&&serie.getPeriod().hasOpenPeriods()){flattenedPeriodSpace=this.updateDatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue,serie.getPeriod().getOpenPeriods());}else{flattenedPeriodSpace=this.updatePeriods(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue);}
if(!isNaN(serieStartValue)&&serieStartValue<minNormalizedXValue){minNormalizedXValue=serieStartValue;}
if(!isNaN(serieEndValue)&&serieEndValue>maxNormalizedXValue){maxNormalizedXValue=serieEndValue;}}}
this.xValuesPeriods=seriesPeriods;this.totalXSpace=flattenedPeriodSpace;if(minNormalizedXValue==Double.POSITIVE_INFINITY||maxNormalizedXValue==Double.NEGATIVE_INFINITY){this.extremums=null;}else{this.extremums=[];this.extremums[0]=minNormalizedXValue;this.extremums[1]=maxNormalizedXValue;}
this.availableFormats=[];this.possibleXSteps=[];mainSerie.setXAxisFormatsAndSteps(this.availableFormats,this.possibleXSteps);if(this.extremums!=null&&this.extremums[0]!=null&&this.extremums[1]!=null&&(this.extremums[0]<0||this.extremums[1]<0)){this.clear();}
if(mainSerie!=null&&this.intraday&&this.getSerieCount()==1&&mainSerie.isEmpty()&&mainSerie.getStartXValue()!=null&&mainSerie.getEndXValue()!=null){this.extremums=[mainSerie.getAbsoluteStartXValue(),mainSerie.getAbsoluteEndXValue()];this.totalXSpace=this.computeXSpaceSizeFromPeriods(this.xValuesPeriods,mainSerie.getStartXValue(),mainSerie.getEndXValue());}
this.updateIndicators();};prototype.updateDatePeriods=function(seriesPeriods,flattenedPeriodSpace,serieStartValue,serieEndValue,openPeriods){if(serieStartValue==null||serieEndValue==null){return flattenedPeriodSpace;}
var newFlattenedPeriodSpace=flattenedPeriodSpace;for(var index in openPeriods){if(!(openPeriods).hasOwnProperty(index))
continue;var currentPeriod=openPeriods[index];if(currentPeriod!=null&&currentPeriod[0]!=null&&currentPeriod[1]!=null){var currentStart=currentPeriod[0].getTime();var currentEnd=currentPeriod[1].getTime();if(currentStart<serieEndValue&&currentEnd>serieStartValue){if(currentStart<serieStartValue){currentStart=serieStartValue;}
if(currentEnd>serieEndValue){currentEnd=serieEndValue;}
if(currentStart<currentEnd){newFlattenedPeriodSpace=this.updatePeriods(seriesPeriods,newFlattenedPeriodSpace,currentStart,currentEnd);}}}}
return newFlattenedPeriodSpace;};prototype.createGlobalIndexedXValues=function(){var orderedX=[];var seriesCurrentIndices={};var seriesCount=this.getSerieCount();for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){seriesCurrentIndices[currentSerie.getId()]=0;}}
var nextX=this.getNext(seriesCurrentIndices);while(nextX!=null){orderedX.push(nextX);for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieId=currentSerie.getId();var currentSerieNextIndex=seriesCurrentIndices[currentSerieId];var currentSerieNextX=currentSerie.getValueAsDouble(currentSerieNextIndex,Serie.X);if(currentSerieNextX!=null&&currentSerieNextX>nextX){currentSerie.addPoint(currentSerieNextIndex,null);}
seriesCurrentIndices[currentSerieId]=currentSerieNextIndex+1;}}
nextX=this.getNext(seriesCurrentIndices);}
return orderedX;};prototype.getNextNormalizedXValue=function(normalizedXValue,xValueStep){if(this.isIntraday()){return ChartData.prototype.getNextNormalizedXValue.call(this,normalizedXValue,xValueStep);}else if(normalizedXValue!=null){var index=stjs.trunc(Math.round(normalizedXValue));var nextValue=DateUtil.getNextDateValueInScale(this.indexedXValues[index],xValueStep);var possibleNext=this.findIndexAtOrAfterValue(nextValue,this.indexedXValues,DateUtil.MS_DAY_24H);if(possibleNext!=null){return Math.round(possibleNext);}else{return null;}}else{return null;}};prototype.getNext=function(currentIndices){var seriesCount=this.getSerieCount();var currentNext=Double.POSITIVE_INFINITY;for(var i=0;i<seriesCount;i++){var currentSerie=this.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieNextIndex=currentIndices[currentSerie.getId()];var currentSerieNextX=currentSerie.getValueAsDouble(currentSerieNextIndex,Serie.X);if(currentSerieNextX!=null&&currentSerieNextX<currentNext){currentNext=currentSerieNextX;}}}
if(currentNext==Double.POSITIVE_INFINITY){return null;}else{return currentNext;}};prototype.addIndicator=function(indicatorId,options){this.addIndicatorSeries(this.indicatorsManager.enable(options,indicatorId));};prototype.updateIndicatorParameters=function(options){this.indicatorsManager.updateIndicatorParameters(options);this.updateIndicators();};prototype.addIndicatorSeries=function(indicator){var newSeries=null;var isSerieOnMainGraph=true;if(indicator!=null&&this.getMainSerie()!=null){indicator.calculate(this.getMainSerie(),this.context);newSeries=indicator.getSeries();isSerieOnMainGraph=indicator.getCorrespondingAreaId()==DefaultLayout.GRAPH_AREA;}
var newSeriesCount=newSeries!=null?newSeries.length:0;for(var i=0;i<newSeriesCount;i++){var currentIndicatorSerie=newSeries[i];if(currentIndicatorSerie!=null){this.activeIndicatorSeries[currentIndicatorSerie.getId()]=currentIndicatorSerie;if(isSerieOnMainGraph){currentIndicatorSerie.setLogScale(this.logScale);this.mainGraphActiveIndicatorSeries[currentIndicatorSerie.getId()]=currentIndicatorSerie;}}}};prototype.removeIndicator=function(indicatorId,options){var disabledIndicator=this.indicatorsManager.disable(options,indicatorId);var seriesToRemove=disabledIndicator!=null?disabledIndicator.getSeries():null;var seriesToRemoveCount=seriesToRemove!=null?seriesToRemove.length:0;for(var i=0;i<seriesToRemoveCount;i++){var currentSerie=seriesToRemove[i];if(currentSerie!=null){delete this.activeIndicatorSeries[currentSerie.getId()];delete this.mainGraphActiveIndicatorSeries[currentSerie.getId()];}}};prototype.getIndicator=function(indicatorId,options){return this.indicatorsManager.getIndicator(IndicatorsManager.getSerieTypeId(this.getMainSerie()),indicatorId,this.intraday);};prototype.clearIndicators=function(){this.indicatorsManager.disableAll(this.getMainSerie());this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};};prototype.isIntraday=function(){return this.intraday;};prototype.hasCurrency=function(){for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;var currentSerie=this.series[index];if(currentSerie!=null&&currentSerie.getStock()!=null&&currentSerie.getStock().isCurrency()){return true;}}
return false;};prototype.isMainCurrency=function(){var currentSerie=this.getMainSerie();return currentSerie!=null&&currentSerie.getStock()!=null&&currentSerie.getStock().isCurrency();};prototype.setExtremums=function(newExtremums){if(newExtremums!=null&&newExtremums[0]!=null&&newExtremums[1]!=null){for(var index in this.series){if(!(this.series).hasOwnProperty(index))
continue;var currentSerie=this.series[index];if(currentSerie!=null){currentSerie.setForcedInterval(newExtremums[0],newExtremums[1]);}}
this.validateData();}};prototype.isSwissDots=function(){return this.getMainSerie()!=null&&this.getMainSerie().getStock()!=null&&this.getMainSerie().getStock().isSwissDotsMarket();};prototype.getActiveIndicators=function(){return this.indicatorsManager.getActiveIndicators(this.getMainSerie());};prototype.getAllSeries=function(){var allSeries=[];if(this.series!=null){allSeries=this.series.slice(0);}
for(var serieId in this.activeIndicatorSeries){allSeries.push(this.activeIndicatorSeries[serieId]);}
return allSeries;};prototype.getMainGraphSeries=function(){var allSeries=[];if(this.series!=null){allSeries=this.series.slice(0);}
for(var serieId in this.mainGraphActiveIndicatorSeries){allSeries.push(this.mainGraphActiveIndicatorSeries[serieId]);}
return allSeries;};prototype.updateIndicators=function(){this.activeIndicatorSeries={};this.mainGraphActiveIndicatorSeries={};var activeIndicators=this.getActiveIndicators();var activeIndicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var i=0;i<activeIndicatorsCount;i++){this.addIndicatorSeries(activeIndicators[i]);}};prototype.updateContextDependentIndicators=function(){var lrcIndic=this.indicatorsManager.getIndicator(this.indicatorsManager.constructor.getSerieTypeId(this.getMainSerie()),IndicatorsManager.LINEAR_REGRESSION_CHANNEL_INDICATOR_ID,this.intraday);if(lrcIndic!=null&&lrcIndic.isEnabled()){lrcIndic.calculate(this.getMainSerie(),this.context);}};prototype.isActiveIndicator=function(indicatorId){return this.indicatorsManager.isActiveIndicators(this.getMainSerie(),indicatorId);};prototype.addSerie=function(yesterdayLine){if(yesterdayLine==null){return;}
yesterdayLine.setLogScale(this.logScale);if(this.series!=null){this.series.push(yesterdayLine);}else{this.series=[yesterdayLine];}};prototype.removeSerie=function(serieId){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.series[i];if(serie!=null&&serie.getId()==serieId){this.series.splice(i,1);return;}}};prototype.isEmpty=function(){var serieCount=this.getSerieCount();for(var i=0;i<serieCount;i++){var serie=this.getSerie(i);if(serie!=null&&serie.getId()!=YesterdayLine.INDICATOR_ID&&!serie.isEmpty()){return false;}}
return true;};prototype.getActiveIndicatorSerie=function(indicatorId){return this.activeIndicatorSeries[indicatorId];};prototype.updateSeriesLogScale=function(){ChartData.prototype.updateSeriesLogScale.call(this);for(var serieId in this.mainGraphActiveIndicatorSeries){var currentIndicator=this.mainGraphActiveIndicatorSeries[serieId];if(currentIndicator!=null){currentIndicator.setLogScale(this.logScale);}}};prototype.hasValidBottomIndicators=function(){for(var index in this.activeIndicatorSeries){if(this.mainGraphActiveIndicatorSeries[index]==null){return true;}}
return false;};prototype.getActiveIndicatorsAssociatedWith=function(graphArea,axisPos){var indicators=this.getActiveIndicators();var associatedIndicators=[];for(var index in indicators){if(!(indicators).hasOwnProperty(index))
continue;var ind=indicators[index];if(ind!=null&&ind.isOnArea(graphArea)&&ind.hasAxisPosition(axisPos)){associatedIndicators.push(ind);}}
return associatedIndicators;};},{indicatorsManager:{name:"IndicatorsManager",arguments:["S"]},activeIndicatorSeries:{name:"Map",arguments:[null,"S"]},mainGraphActiveIndicatorSeries:{name:"Map",arguments:[null,"S"]},context:"ChartContext",provider:{name:"DataProvider",arguments:[{name:"ChartData",arguments:["S"]}]},cache:"Cache",series:{name:"Array",arguments:["S"]},extremums:{name:"Array",arguments:[null]},indexedXValues:{name:"Array",arguments:[null]},availableFormats:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},possibleXSteps:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},xValuesPeriods:{name:"Array",arguments:[{name:"Array",arguments:[null]}]},observers:{name:"Map",arguments:[null,"Observer"]}},{});
var DefaultDelimiterEngine=function(options){Engine.call(this);this.correspondingAreaId=FinancialLayout.DELIMITER_AREA;this.selected=false;};DefaultDelimiterEngine=stjs.extend(DefaultDelimiterEngine,Engine,[],function(constructor,prototype){constructor.DELIMITER_ELEMENT_ID="delimtierElement";prototype.selected=false;prototype.update=function(chartView,chartData,context){};prototype.createMainGraphics=function(chartView,chartData,context){var groundLayer=chartView.getGroundLayer();var delimiterArea=chartView.getArea(this.correspondingAreaId);var delimiterStyle=chartView.getStyleModel().getStyle(FinancialLayout.DELIMITER_AREA);var position=context.getCurrentPosition();if(delimiterStyle!=null&&delimiterStyle.isVisible()&&delimiterArea!=null){var bounds=delimiterArea.getAreaBound();var delimiterHighlight=ChartElementFactory.createRect(groundLayer,stjs.trunc(bounds.getLeft()),stjs.trunc(bounds.getTop()),stjs.trunc(bounds.getOuterWidth(false)),stjs.trunc(bounds.getHeight()));delimiterHighlight.setFillShape(false);delimiterHighlight.setStrokeShape(false);delimiterHighlight.setId(DefaultDelimiterEngine.DELIMITER_ELEMENT_ID);delimiterArea.addElement(delimiterHighlight);}};prototype.createInteractiveGraphics=function(chartView,chartData,context){var overlayLayer=chartView.getOverlayLayer();var delimiterArea=chartView.getArea(this.correspondingAreaId);var delimiterStyle=chartView.getStyleModel().getStyle(FinancialLayout.DELIMITER_AREA);var position=context.getCurrentPosition();if(delimiterStyle!=null&&delimiterStyle.isVisible()&&delimiterArea!=null&&(this.selected||(position!=null&&delimiterArea.isInside(position.getX(),position.getY())))){var bounds=delimiterArea.getAreaBound();var left=stjs.trunc(bounds.getLeft());var top=stjs.trunc(bounds.getTop());var width=stjs.trunc(bounds.getOuterWidth(false));var height=stjs.trunc(bounds.getHeight());var delimiterHighlight=ChartElementFactory.createRect(overlayLayer,left,top,width,height);delimiterHighlight.setFillColor(delimiterStyle.getBackgroundColor());delimiterArea.addElement(delimiterHighlight);if(this.selected){var topGraphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var bottomGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var topGraphAreaBounds=topGraphArea.getAreaBound();var bottomGraphAreaBounds=bottomGraphArea.getAreaBound();if(bottomGraphAreaBounds==null||!bottomGraphAreaBounds.isVisible()){bottomGraphAreaBounds=topGraphAreaBounds;}
if(topGraphAreaBounds==null){return;}
var newTopPos=position.getY();var minY=stjs.trunc(topGraphAreaBounds.getTop());var maxY=stjs.trunc((bottomGraphAreaBounds.getTop()+bottomGraphAreaBounds.getHeight()-bounds.getHeight()));if(newTopPos<minY){newTopPos=minY;}else if(newTopPos>maxY){newTopPos=maxY;}
var newDelimiterHighlight=ChartElementFactory.createRect(overlayLayer,left,newTopPos,width,height);newDelimiterHighlight.setFillColor(delimiterStyle.getBackgroundColor());if(newTopPos>top){bottomGraphArea.addElement(newDelimiterHighlight);}else{topGraphArea.addElement(newDelimiterHighlight);}}}};prototype.isSelected=function(){return this.selected;};prototype.setSelected=function(selected){this.selected=selected;};},{},{});
var CandlesticksGraphEngine=function(){DefaultGraphEngine.call(this);};CandlesticksGraphEngine=stjs.extend(CandlesticksGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.MAX_LENGTH=6;constructor.getInstance=function(){if(CandlesticksGraphEngine.instance==null){CandlesticksGraphEngine.instance=new CandlesticksGraphEngine();}
return CandlesticksGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var open=FinancialSerie.OPEN;var close=FinancialSerie.CLOSE;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(serie.getColorStrategy()!=null){var cs=serie.getColorStrategy();if(cs.getPositiveColor()!=null){positiveColor=cs.getPositiveColor();}
if(cs.getNegativeColor()!=null){negativeColor=cs.getNegativeColor();}}
var heightRatio=chartHeight/(yMax-yMin);var sideLength=stjs.trunc(Math.round(stjs.trunc(chartWidth/(2*serieLength))));if(sideLength<=0){sideLength=1;}else if(sideLength>CandlesticksGraphEngine.MAX_LENGTH){sideLength=CandlesticksGraphEngine.MAX_LENGTH;}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentHighValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,high,true);var currentLowValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,low,true);var currentOpenValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,open,true);var currentCloseValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,close,true);if(currentHighValues!=null&&currentHighValues.length>0&&currentLowValues!=null&&currentLowValues.length>0&&currentOpenValues!=null&&currentOpenValues.length>0&&currentCloseValues!=null&&currentCloseValues.length>0){var highValue=this.filterValue(currentHighValues[0],yMin,useLogScale);var lowValue=this.filterValue(currentLowValues[0],yMin,useLogScale);var openValue=this.filterValue(currentOpenValues[0],yMin,useLogScale);var closeValue=this.filterValue(currentCloseValues[0],yMin,useLogScale);if(highValue!=null&&lowValue!=null){var highCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(highValue-yMin)));var lowCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(lowValue-yMin)));if(highCoordinate<chartTopPos){highCoordinate=chartTopPos;}else if(highCoordinate>chartBottomPos){highCoordinate=chartBottomPos;}
if(lowCoordinate<chartTopPos){lowCoordinate=chartTopPos;}else if(lowCoordinate>chartBottomPos){lowCoordinate=chartBottomPos;}
var centerLine=ChartElementFactory.createLine(layer,currentXPosition,highCoordinate,currentXPosition,lowCoordinate,1);centerLine.setStrokeColor(ChartColor.orange);area.addElement(centerLine);}
var openCoordinate=openValue==null?null:stjs.trunc(Math.round(chartBottomPos-heightRatio*(openValue-yMin)));var closeCoordinate=closeValue==null?null:stjs.trunc(Math.round(chartBottomPos-heightRatio*(closeValue-yMin)));if(openCoordinate!=null&&closeCoordinate!=null&&openCoordinate!=closeCoordinate){if(closeCoordinate<chartTopPos){closeCoordinate=chartTopPos;}else if(closeCoordinate>chartBottomPos){closeCoordinate=chartBottomPos;}
if(openCoordinate<chartTopPos){openCoordinate=chartTopPos;}else if(openCoordinate>chartBottomPos){openCoordinate=chartBottomPos;}
var topPosition=closeCoordinate;var height=openCoordinate-closeCoordinate;var color=positiveColor;if(openCoordinate<closeCoordinate){color=negativeColor;}
var candle=ChartElementFactory.createRect(layer,currentXPosition-sideLength,topPosition,2*sideLength,height);candle.setFillColor(color);area.addElement(candle);}else if(openCoordinate!=null||closeCoordinate!=null){var validCoordinate=openCoordinate!=null?openCoordinate:closeCoordinate;if(validCoordinate<chartTopPos){validCoordinate=chartTopPos;}else if(validCoordinate>chartBottomPos){validCoordinate=chartBottomPos;}
var validLine=ChartElementFactory.createLine(layer,currentXPosition-sideLength,validCoordinate,currentXPosition+sideLength,validCoordinate,1);validLine.setStrokeColor(ChartColor.black);area.addElement(validLine);}}}};},{instance:"CandlesticksGraphEngine"},{});
var HLOCGraphEngine=function(){DefaultGraphEngine.call(this);};HLOCGraphEngine=stjs.extend(HLOCGraphEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.MAX_LENGTH=6;constructor.getInstance=function(){if(HLOCGraphEngine.instance==null){HLOCGraphEngine.instance=new HLOCGraphEngine();}
return HLOCGraphEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=serie.getMainField();var high=FinancialSerie.HIGH;var low=FinancialSerie.LOW;var open=FinancialSerie.OPEN;var close=FinancialSerie.CLOSE;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var useLogScale=serie.isLogScale()&&yMin!=null&&yMin>0&&yMax!=null&&yMax>yMin;if(useLogScale){yMin=Math.log(yMin);yMax=Math.log(yMax);}
var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var heightRatio=chartHeight/(yMax-yMin);var sideLength=stjs.trunc(Math.round(stjs.trunc(chartWidth/serieLength)));if(sideLength<=0){sideLength=1;}else if(sideLength>HLOCGraphEngine.MAX_LENGTH){sideLength=HLOCGraphEngine.MAX_LENGTH;}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentHighValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,high,true);var currentLowValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,low,true);var currentOpenValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,open,true);var currentCloseValues=serie.getAggregatedValues(AggregationStrategy.LAST,context,i,chartWidth,close,true);if(currentHighValues!=null&&currentHighValues.length>0&&currentLowValues!=null&&currentLowValues.length>0&&currentOpenValues!=null&&currentOpenValues.length>0&&currentCloseValues!=null&&currentCloseValues.length>0){var highValue=this.filterValue(currentHighValues[0],yMin,useLogScale);var lowValue=this.filterValue(currentLowValues[0],yMin,useLogScale);var openValue=this.filterValue(currentOpenValues[0],yMin,useLogScale);var closeValue=this.filterValue(currentCloseValues[0],yMin,useLogScale);if(highValue!=null&&lowValue!=null){var highCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(highValue-yMin)));var lowCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(lowValue-yMin)));if(highCoordinate<chartTopPos){highCoordinate=chartTopPos;}else if(highCoordinate>chartBottomPos){highCoordinate=chartBottomPos;}
if(lowCoordinate<chartTopPos){lowCoordinate=chartTopPos;}else if(lowCoordinate>chartBottomPos){lowCoordinate=chartBottomPos;}
var centerLine=ChartElementFactory.createLine(layer,currentXPosition,highCoordinate,currentXPosition,lowCoordinate,1);centerLine.setStrokeColor(ChartColor.orange);area.addElement(centerLine);}
if(openValue!=null){var openCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(openValue-yMin)));if(openCoordinate<chartTopPos){openCoordinate=chartTopPos;}else if(openCoordinate>chartBottomPos){openCoordinate=chartBottomPos;}
var openLine=ChartElementFactory.createLine(layer,currentXPosition-sideLength,openCoordinate,currentXPosition,openCoordinate,1);openLine.setStrokeColor(ChartColor.orange);area.addElement(openLine);}
if(closeValue!=null){var closeCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(closeValue-yMin)));if(closeCoordinate<chartTopPos){closeCoordinate=chartTopPos;}else if(closeCoordinate>chartBottomPos){closeCoordinate=chartBottomPos;}
var closeLine=ChartElementFactory.createLine(layer,currentXPosition,closeCoordinate,currentXPosition+sideLength,closeCoordinate,1);closeLine.setStrokeColor(ChartColor.orange);area.addElement(closeLine);}}}};},{instance:"HLOCGraphEngine"},{});
var SignalsEngine=function(){DefaultGraphEngine.call(this);};SignalsEngine=stjs.extend(SignalsEngine,DefaultGraphEngine,[],function(constructor,prototype){constructor.instance=null;constructor.BORDER_PADDING=3;constructor.SIGNALS_BASELINE_WIDTH=8;constructor.SIGNALS_HEIGHT=4;constructor.getInstance=function(){if(SignalsEngine.instance==null){SignalsEngine.instance=new SignalsEngine();}
return SignalsEngine.instance;};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var which=Serie.Y;var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartInnerTopPos=stjs.trunc(bounds.getInnerTop())+SignalsEngine.BORDER_PADDING;var chartInnerBottomPos=stjs.trunc(bounds.getInnerBottom())-SignalsEngine.BORDER_PADDING;var startIndex=context.getMainMinIndex(Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMainMaxIndex(Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;if(this.isSpecialAggregatedSerie(serie)){startIndex=0;endIndex=serie.getLength()-1;}
var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
context.setMinIndex(serieId,startIndex,Serie.X);context.setMaxIndex(serieId,endIndex,Serie.X);var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(serie.getColorStrategy()!=null){var cs=serie.getColorStrategy();if(cs.getPositiveColor()!=null){positiveColor=cs.getPositiveColor();}
if(cs.getNegativeColor()!=null){negativeColor=cs.getNegativeColor();}}
for(var i=0;i<renderingWidth;i++){var currentXPosition=i+chartLeftPos;var currentSignalValues=serie.getAggregatedValues(AggregationStrategy.MIN_MAX,context,i,chartWidth,which,true);if(currentSignalValues!=null){var sellSignal=false;var buySignal=false;for(var index in currentSignalValues){if(!(currentSignalValues).hasOwnProperty(index))
continue;var signalValue=currentSignalValues[index];if(signalValue!=null){sellSignal=sellSignal||signalValue<0;buySignal=buySignal||signalValue>0;}}
if(sellSignal){var signal=ChartElementFactory.createSimpleIsocelesTriangle(layer,currentXPosition,chartInnerTopPos,SignalsEngine.SIGNALS_BASELINE_WIDTH,SignalsEngine.SIGNALS_HEIGHT);signal.setStrokeColor(negativeColor);signal.setFillColor(negativeColor);signal.setFillShape(true);area.addElement(signal);}
if(buySignal){var signal=ChartElementFactory.createSimpleIsocelesTriangle(layer,currentXPosition,chartInnerBottomPos,SignalsEngine.SIGNALS_BASELINE_WIDTH,-SignalsEngine.SIGNALS_HEIGHT);signal.setStrokeColor(positiveColor);signal.setFillColor(positiveColor);signal.setFillShape(true);area.addElement(signal);}}}};prototype.isSpecialAggregatedSerie=function(serie){if(serie!=null&&!serie.isIndexed()&&(serie)["getMainSerie"]){var indSerie=serie;var mainSerie=indSerie.getMainSerie();var mainPeriod=mainSerie!=null?mainSerie.getPeriod():null;if(mainPeriod==null||!(mainPeriod.isLive()||(mainPeriod.isIntraday()&&mainPeriod.getValue()>MultiIntradayServletRequest.MAX_INTRADAY))||mainPeriod.getFrom()==null||mainPeriod.getTo()==null){return false;}else{return true;}}
return false;};},{instance:"SignalsEngine"},{});
var FinancialTitleEngine=function(options){DefaultTitleEngine.call(this,options);var titleHeight=options.getBigLabelFontSize();if(options.isPopOverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,options.getZoomIconSize()));}
this.initialHeight=titleHeight+DefaultLayout.DEFAULT_PADDING_PIXELS;this.valueLabelsOffset=0;this.forceShortTitle=false;};FinancialTitleEngine=stjs.extend(FinancialTitleEngine,DefaultTitleEngine,[],function(constructor,prototype){constructor.SEPARATION_WIDTH=25;prototype.initialHeight=0;prototype.valueLabelsOffset=0;prototype.forceShortTitle=false;prototype.titles=null;prototype.values=null;prototype.priceFormat=null;prototype.volumeFormat=null;prototype.update=function(chartView,chartData,context){if(chartData!=null&&chartData.getMainSerie()!=null){var mainSerie=chartData.getMainSerie();if(mainSerie.getStock()!=null){this.title=mainSerie.getStock().getName();this.alternateTitle=mainSerie.getStock().getSymbol();}}
var titleStyle=chartView.getStyleModel().getTitleStyle();var titleHeight=titleStyle.getTitleFontSize();if(titleStyle.isPopoverAllowed()){titleHeight=stjs.trunc(Math.max(titleHeight,titleStyle.getZoomIconSize()));}
this.initialHeight=titleHeight+DefaultLayout.DEFAULT_PADDING_PIXELS;};prototype.createMainGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var layer=chartView.getGroundLayer();var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();if(chartData.getDataSerieCount()>1){chartView.getLayout().updateTitleArea(2*this.initialHeight);this.valueLabelsOffset=this.initialHeight;}else{chartView.getLayout().updateTitleArea(this.initialHeight);this.valueLabelsOffset=0;}
this.usedWidth=0;if(this.showEnlargeIcon){this.rightWidth=this.createTitleIcon(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}else{this.rightWidth=this.createCopyrightLabel(layer,chartView,titleArea,titleStyle);this.usedWidth=this.rightWidth;}
var areaBound=titleArea.getAreaBound();var maxValueWidth=0;if(context.getRange(this.associatedAxisId)!=null&&context.getRange(this.associatedAxisId)[1]!=null){this.valueFormatter.setFormat(context.getFormat(this.associatedAxisId));var valueString=this.valueFormatter.formatValue(context.getRange(this.associatedAxisId)[1]);maxValueWidth=chartView.getTextWidth(valueString,titleStyle.getFont(),titleStyle.getValueFontSize(),titleStyle.isValueBold());}
var availableWidth=stjs.trunc((areaBound.getInnerWidth()-this.usedWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH-maxValueWidth;this.displayedTitle=this.getTitle(chartView,availableWidth);this.forceShortTitle=false;if(chartData.getDataSerieCount()==1){var mainLabel=this.createTitleLabel(layer,this.displayedTitle,chartView,titleStyle.getTitleColor(),titleArea,titleStyle,0);this.usedWidth+=mainLabel!=null?mainLabel.getWidth():0;}else{this.usedWidth+=this.createTitleLabels(layer,chartView,chartData,context,titleArea,titleStyle);}
var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);this.priceFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);this.volumeFormat=context.getFormat(FinancialLayout.BOTTOM_AXIS_LEFT);this.createValueLabels(overlayLayer,chartView,chartData,context,titleArea,titleStyle,this.usedWidth);};prototype.createInteractiveGraphics=function(chartView,chartData,context){if(!this.showTitle){return;}
var overlayLayer=chartView.getOverlayLayer();var titleArea=chartView.getArea(this.correspondingAreaId);var titleStyle=chartView.getStyleModel().getTitleStyle();var position=context.getCurrentPosition();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeAreaBounds=volumeGraphArea.getAreaBound();this.priceFormat=context.getFormat(DefaultLayout.Y1_AXIS_AREA);this.volumeFormat=context.getFormat(FinancialLayout.BOTTOM_AXIS_LEFT);this.createValueLabels(overlayLayer,chartView,chartData,context,titleArea,titleStyle,this.usedWidth);if(this.currentIcon!=null&&position!=null&&this.currentIcon.isInside(position.getX(),position.getY())){var copyIcon=this.currentIcon.copyTo(overlayLayer);copyIcon.setBackgroundColor(ChartColor.orange);titleArea.addElement(copyIcon);}};prototype.createTitleLabels=function(layer,chartView,chartData,context,area,style){var seriesCount=chartData.getSerieCount();var titlesWidth=0;this.titles={};var titleType=style.getType();var volumeInTitle=titleType==TitleStyle.SHOW_VALUE_VOLUME;for(var j=0;j<seriesCount;j++){var currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieLabel=this.createTitleLabel(layer,currentSerie.getName(),chartView,currentSerie.getColor(),area,style,titlesWidth);this.titles[currentSerie.getId()]=currentSerieLabel;var currentLabelWidth=currentSerieLabel!=null?currentSerieLabel.getWidth():0;titlesWidth+=currentLabelWidth+FinancialTitleEngine.SEPARATION_WIDTH;if(volumeInTitle){titlesWidth+=2*FinancialTitleEngine.SEPARATION_WIDTH;}}}
var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var availableWidth=stjs.trunc((graphAreaBound.getOuterWidth(true)-this.usedWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH;if(titlesWidth>availableWidth&&volumeInTitle){this.forceShortTitle=true;for(var j=1;j<seriesCount;j++){var currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){var currentSerieLabel=this.titles[currentSerie.getId()];currentSerieLabel.setX(currentSerieLabel.getX()-2*j*FinancialTitleEngine.SEPARATION_WIDTH);titlesWidth-=2*FinancialTitleEngine.SEPARATION_WIDTH;}}}
return titlesWidth;};prototype.createTitleLabel=function(layer,title,chartView,color,area,style,previousTitlesWidth){if(!this.showTitle){return null;}
title=title!=null?title.replace("_","/"):"";var fontSize=style.getTitleFontSize();var isBold=style.isTitleBold();var areaBound=area.getAreaBound();var titleWidth=chartView.getLabelWidth(title,style.getFont(),fontSize,isBold);var height=this.initialHeight;var yCenter=stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var xPos=stjs.trunc(areaBound.getInnerLeft())+previousTitlesWidth;var titleLabel=ChartElementFactory.createLabel(layer,0.0,title,xPos,yCenter,titleWidth,height);titleLabel.setAlign(Label.ALIGN_LEFT);titleLabel.setColor(color);titleLabel.setFontSize(fontSize);titleLabel.setBold(isBold);area.addElement(titleLabel);return titleLabel;};prototype.createValueLabels=function(layer,chartView,chartData,context,area,style,usedWidth){var graphArea=chartView.getArea(this.associatedGraphId);var graphBound=graphArea.getAreaBound();var currentPosition=context.getCurrentPosition();if(!this.showValue||currentPosition==null||!graphBound.isInside(currentPosition.getX(),currentPosition.getY())){return 0;}
var graphWidth=stjs.trunc(graphBound.getContentWidth());var currentPointsBySerie=context.getClosestPointsFromCurrentPosition(graphBound.getContentLeft(),graphWidth);if(currentPointsBySerie==null){return 0;}
var valuesWidth=0;var seriesCount=chartData.getSerieCount();var currentSerie=chartData.getSerie(0);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){valuesWidth+=this.createValueLabel(currentSerie,currentPointsBySerie[currentSerie.getId()],layer,chartView,area,style,valuesWidth,style.getTitleColor());valuesWidth+=FinancialTitleEngine.SEPARATION_WIDTH;}
for(var j=1;j<seriesCount;j++){currentSerie=chartData.getSerie(j);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){valuesWidth+=this.createValueLabel(currentSerie,currentPointsBySerie[currentSerie.getId()],layer,chartView,area,style,valuesWidth,currentSerie.getColor());valuesWidth+=FinancialTitleEngine.SEPARATION_WIDTH;}}
return valuesWidth;};prototype.createValueLabel=function(currentSerie,currentPoints,layer,chartView,area,style,previousValuesWidth,color){var pointCount=currentPoints!=null?currentPoints.length:0;var currentPriceValue=Double.NEGATIVE_INFINITY;var currentVolumeValue=0.0;for(var i=0;i<pointCount;i++){var currentPoint=currentPoints[i];if(currentPoint!=null){var priceValue=currentPoint[Serie.Y];var volumeValue=currentPoint[FinancialSerie.VOLUME];if(volumeValue!=null&&volumeValue>currentVolumeValue){currentVolumeValue=volumeValue;currentPriceValue=priceValue;}else if(currentVolumeValue<=0.0&&priceValue!=null&&priceValue>currentPriceValue){currentVolumeValue=0.0;currentPriceValue=priceValue;}}}
if(currentPriceValue!=Double.NEGATIVE_INFINITY){this.valueFormatter.setFormat(this.priceFormat);var priceValueString=this.valueFormatter.formatValue(currentPriceValue);this.valueFormatter.setFormat(this.volumeFormat);var volumeValueString=this.valueFormatter.formatValue(currentVolumeValue);var valueString=priceValueString;var titleType=style.getType();if(titleType==TitleStyle.HIDE_VALUES){return 0;}else if(this.forceShortTitle||titleType==TitleStyle.SHOW_MAIN_VALUE){if(this.associatedGraphId==FinancialLayout.BOTTOM_GRAPH_AREA){if(currentVolumeValue>0.0){valueString=volumeValueString;}else{valueString="";}}}else if(titleType==TitleStyle.SHOW_VALUE_VOLUME&&currentVolumeValue>0.0){valueString=priceValueString+" ("+volumeValueString+")";}
var fontSize=style.getValueFontSize();var isBold=style.isValueBold();var valueWidth=chartView.getLabelWidth(valueString,style.getFont(),fontSize,isBold);var areaBound=area.getAreaBound();var graphArea=chartView.getArea(this.associatedGraphId);var graphAreaBound=graphArea.getAreaBound();var availableWidth=stjs.trunc((graphAreaBound.getOuterWidth(true)-this.usedWidth-previousValuesWidth))-2*FinancialTitleEngine.SEPARATION_WIDTH;var xCenter=stjs.trunc(Math.round(graphAreaBound.getLeft()+((graphAreaBound.getOuterWidth(true)+this.usedWidth-2*this.rightWidth)/2.0)));var height=this.initialHeight;var align=Label.ALIGN_CENTER;var xPos=xCenter+previousValuesWidth;if(this.valueLabelsOffset>0){xPos=this.titles[currentSerie.getId()].getX();align=Label.ALIGN_LEFT;}else if(valueWidth>availableWidth){if(this.associatedGraphId==FinancialLayout.BOTTOM_GRAPH_AREA){valueString=volumeValueString;}else{valueString=priceValueString;}
valueWidth=chartView.getLabelWidth(valueString,style.getFont(),fontSize,isBold);}
var yCenter=this.valueLabelsOffset+stjs.trunc(Math.round((areaBound.getContentTop()+height+fontSize)/2.0));var valueLabel=ChartElementFactory.createLabel(layer,0.0,valueString,xPos,yCenter,valueWidth,height);valueLabel.setAlign(align);valueLabel.setColor(color);valueLabel.setFontSize(fontSize);valueLabel.setBold(isBold);area.addElement(valueLabel);return valueWidth;}
return 0;};},{titles:{name:"Map",arguments:[null,"Label"]},values:{name:"Array",arguments:["Label"]},currentIcon:"ChartIcon",valueFormatter:"Formatter"},{});
var FinancialXAxisEngine=function(options){DefaultXAxisEngine.call(this,options);};FinancialXAxisEngine=stjs.extend(FinancialXAxisEngine,DefaultXAxisEngine,[],function(constructor,prototype){prototype.createInteractiveGraphics=function(chartView,chartData,context){var layer=chartView.getOverlayLayer();var xAxisStyle=chartView.getStyleModel().getXAxisStyle();var graphArea=chartView.getArea(this.associatedGraphId);var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(xAxisStyle.isVisible()&&xAxisStyle.isShowLabelHighlight()&&(graphArea.isPointInside(context.getCurrentPosition())||volumeGraphArea.isPointInside(context.getCurrentPosition()))&&!chartData.isEmpty()){this.createHighlightLabel(layer,chartView,chartData,context);}};},{labelsParameters:{name:"Array",arguments:[{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]}]},messages:"ChartMessagesRepository",position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var VolumeAxisEngine=function(options,correspondingAreaId,pos){DefaultY1AxisEngine.call(this,options);this.labelsFormatter=new AbbreviateNumberFormatter();this.labelsFormatter.setFormat("0");this.correspondingAreaId=correspondingAreaId;this.associatedGraphId=FinancialLayout.BOTTOM_GRAPH_AREA;this.position=pos;};VolumeAxisEngine=stjs.extend(VolumeAxisEngine,DefaultY1AxisEngine,[],function(constructor,prototype){prototype.update=function(chartView,chartData,context){DefaultYAxisEngine.prototype.update.call(this,chartView,chartData,context);this.logScale=false;};},{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
var VolumeGraphEngine=function(options){GraphEngine.call(this,options);this.showIndicatorsDescriptions=options.isShowIndicatorsDescriptions();this.showIndicatorsSignals=true;this.labelsXPositionsByArea={};this.currentBarWidth=1;this.volumeColorStrategy=options.getVolumeColorStrategy();};VolumeGraphEngine=stjs.extend(VolumeGraphEngine,GraphEngine,[],function(constructor,prototype){constructor.MAX_BAR_WIDTH=7;constructor.DESCRIPTIONS_LABEL_FONT_SIZE=10;constructor.DESCRIPTIONS_LABEL_Y_MARGIN=3;prototype.showIndicatorsDescriptions=false;prototype.showIndicatorsSignals=false;prototype.labelsXPositionsByArea=null;prototype.currentBarWidth=0;prototype.volumeColorStrategy=null;prototype.createMainGraphics=function(chartView,chartData,context){this.createMainGraphGraphics(chartView,chartData,context);var groundLayer=chartView.getGroundLayer();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var graphStyle=chartView.getStyleModel().getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);var mainSerie=chartData.getMainSerie();this.currentBarWidth=this.computeCurrentBarWidth(volumeGraphArea,mainSerie,context);this.createBackground(groundLayer,volumeGraphArea,graphStyle);this.createBackgroundGrid(groundLayer,volumeGraphArea,graphStyle,context.getLabelsPosition(DefaultLayout.X_AXIS_AREA),context.getLabelsPosition(FinancialLayout.BOTTOM_AXIS_LEFT));this.createBorders(groundLayer,volumeGraphArea,graphStyle);var mainLayer=chartView.getMainLayer();if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&chartData.getMainSerie()!=null){this.createGraphElement(mainLayer,volumeGraphArea,mainSerie,context,graphStyle);}
this.createIndicatorsGraphics(chartView,chartData,context);if(chartData.isEmpty()){this.emptyPriceAreas(chartView);this.displayNoPriceMessage(chartView);}};prototype.computeCurrentBarWidth=function(area,serie,context){if(area==null||serie==null){return this.currentBarWidth;}
var bounds=area.getAreaBound();var serieId=serie.getId();var chartWidth=stjs.trunc(bounds.getContentWidth());var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;var barWidth=stjs.trunc(Math.round(stjs.trunc(chartWidth/(2*serieLength))));if(barWidth<=0){barWidth=1;}else if(barWidth>VolumeGraphEngine.MAX_BAR_WIDTH){barWidth=VolumeGraphEngine.MAX_BAR_WIDTH;}
return barWidth;};prototype.createMainGraphGraphics=function(chartView,chartData,context){var saved=false;var savedColor=null;var savedStrat=null;var mainSerie=chartData.getMainSerie();var type=mainSerie!=null?mainSerie.getType():null;if(type==null){type=this.getDefaultType();}
if(!chartData.isIntraday()&&mainSerie!=null&&(type==null||type==Chart.ChartType.LINE)){saved=true;savedStrat=mainSerie.getColorStrategy();savedColor=mainSerie.getColor();mainSerie.setColor(FinancialEngineModel.COLORS_ARRAY[0]);mainSerie.setColorStrategy(null);}
GraphEngine.prototype.createMainGraphics.call(this,chartView,chartData,context);if(saved){mainSerie.setColor(savedColor);mainSerie.setColorStrategy(savedStrat);}};prototype.displayNoPriceMessage=function(chartView){var groundLayer=chartView.getGroundLayer();var noPriceMessage=ChartMessagesRepository.getInstance().get("noPrice");if(this.chartData.isIntraday()){var mainSerie=this.chartData.getMainSerie();if(mainSerie==null||mainSerie.getPeriod()==null||!mainSerie.getPeriod().spanSeveralDays()){noPriceMessage=ChartMessagesRepository.getInstance().get("noIntradayPrice");}}
var graphArea=chartView.getArea(FinancialLayout.GRAPH_AREA);var graphStyle=chartView.getStyleModel().getStyle(DefaultLayout.GRAPH_AREA);this.createBorders(groundLayer,graphArea,graphStyle);var fontSize=graphStyle.getFontSize();var textColor=graphStyle.getTextColor();var colorGradientParam=graphStyle.getTextColorGradientParams();var font=graphStyle.getFont();var isBold=graphStyle.isBoldFont();var labelWidth=stjs.trunc(Math.ceil(chartView.getLabelWidth(noPriceMessage,font,fontSize,isBold)));var areaBound=graphArea.getAreaBound();var xCenter=stjs.trunc(Math.round(areaBound.getContentLeft()+(areaBound.getContentWidth()/2.0)));var yCenter=stjs.trunc(Math.round(areaBound.getContentTop()+(areaBound.getContentHeight()/2.0)));var label=ChartElementFactory.createLabel(groundLayer,null,noPriceMessage,xCenter,yCenter,labelWidth,fontSize);label.setAlign(Label.ALIGN_CENTER);label.setBaseline(Label.BASELINE_MIDDLE);label.setColor(textColor);label.setColorGradientParam(colorGradientParam);label.setBold(isBold);label.setFont(font);label.setFontSize(fontSize);graphArea.addElement(label);};prototype.emptyPriceAreas=function(chartView){var y1AxisArea=chartView.getArea(FinancialLayout.Y1_AXIS_AREA);if(y1AxisArea!=null){y1AxisArea.clearElements();}
var y2AxisArea=chartView.getArea(FinancialLayout.Y2_AXIS_AREA);if(y2AxisArea!=null){y2AxisArea.clearElements();}
var graphArea=chartView.getArea(FinancialLayout.GRAPH_AREA);if(graphArea!=null){graphArea.clearElements();}
var xAxisArea=chartView.getArea(FinancialLayout.X_AXIS_AREA);if(xAxisArea!=null){xAxisArea.clearElements();}
var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(volumeGraphArea!=null){volumeGraphArea.clearElements();}
var bottomLeftAxisArea=chartView.getArea(FinancialLayout.BOTTOM_AXIS_LEFT);if(bottomLeftAxisArea!=null){bottomLeftAxisArea.clearElements();}
var bottomRightAxisArea=chartView.getArea(FinancialLayout.BOTTOM_AXIS_RIGHT);if(bottomRightAxisArea!=null){bottomRightAxisArea.clearElements();}};prototype.getGraphEngine=function(serieType){var type=serieType==null?this.defaultType:serieType;if(type==Chart.ChartType.LINE){return DefaultLineGraphEngine.getInstance();}else if(type==Chart.ChartType.POINT){return DefaultPointGraphEngine.getInstance();}else if(type==Chart.ChartType.AREA){return DefaultAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.BAR){var barGraphEngine=DefaultBarGraphEngine.getInstance();barGraphEngine.setBarType(this.barType);return barGraphEngine;}else if(type==Chart.ChartType.BID_ASK){return BidAskAreaEngine.getInstance();}else if(type==Chart.ChartType.HLOC){return HLOCGraphEngine.getInstance();}else if(type==Chart.ChartType.CANDLESTICK){return CandlesticksGraphEngine.getInstance();}else if(type==Chart.ChartType.HL_AREA){return HighLowAreaGraphEngine.getInstance();}else if(type==Chart.ChartType.NONE){return null;}else{return DefaultLineGraphEngine.getInstance();}};prototype.createGraphElement=function(layer,area,serie,context,style){var bounds=area.getAreaBound();var serieId=serie.getId();var mainField=FinancialSerie.VOLUME;var yMin=context.getMin(serieId,mainField);var yMax=context.getMax(serieId,mainField);var renderingRatio=style.getRenderingRatio();if(renderingRatio==null||renderingRatio<0||renderingRatio>1.0){renderingRatio=1.0;}
var chartLeftPos=stjs.trunc(bounds.getContentLeft());var chartRightPos=stjs.trunc((bounds.getOuterWidth(true)+bounds.getLeft()));var chartTopPos=stjs.trunc(bounds.getContentTop());var chartWidth=stjs.trunc(bounds.getContentWidth());var chartHeight=stjs.trunc(bounds.getContentHeight());var renderingWidth=stjs.trunc(Math.round(chartWidth*renderingRatio));var chartBottomPos=chartTopPos+chartHeight;var startIndex=context.getMinIndex(serieId,Serie.X);startIndex=(startIndex==null)?0:startIndex;var endIndex=context.getMaxIndex(serieId,Serie.X);endIndex=(endIndex==null)?(serie.getLength()-1):endIndex;var serieLength=endIndex-startIndex+1;if(!serie.isEnabled()||serieLength<=1||chartWidth<=1||renderingWidth<=0||chartHeight<=0){return;}
var positiveColor=ChartColor.greenOld;var negativeColor=ChartColor.redOld;if(this.volumeColorStrategy!=null){if(this.volumeColorStrategy.getPositiveColor()!=null){positiveColor=this.volumeColorStrategy.getPositiveColor();}
if(this.volumeColorStrategy.getNegativeColor()!=null){negativeColor=this.volumeColorStrategy.getNegativeColor();}}
var heightRatio=chartHeight/(yMax-yMin);var yCoordinate=0;var barWidth=this.currentBarWidth;if(barWidth==null||barWidth<=0){barWidth=1;}
var xRectCorrection=stjs.trunc(Math.floor(barWidth/2.0));var normalBar=ChartOption.NORMAL_BAR;for(var i=0;i<renderingWidth;i++){var xRect=i+chartLeftPos-xRectCorrection;var currentPointsIndices=serie.getCorrespondingIndices(context,i,chartWidth,true);if(currentPointsIndices!=null&&currentPointsIndices.length>0){var currentVolumeValue=null;var currentMainValue=null;var previousPointMainValue=null;var volumeMaxIndex=null;if(currentPointsIndices.length==1){volumeMaxIndex=currentPointsIndices[0];}else{var first=currentPointsIndices[0];var last=currentPointsIndices[1];currentVolumeValue=Double.NEGATIVE_INFINITY;for(var j=first;j<=last;j++){var currentIndexVolumeValue=serie.getValueAsDouble(j,mainField);if(currentIndexVolumeValue!=null&&currentIndexVolumeValue>currentVolumeValue){currentVolumeValue=currentIndexVolumeValue;volumeMaxIndex=j;}}}
currentVolumeValue=serie.getValueAsDouble(volumeMaxIndex,mainField);currentMainValue=serie.getValueAsDouble(volumeMaxIndex,Serie.Y);previousPointMainValue=serie.getValueAsDouble(volumeMaxIndex-1,Serie.Y);yCoordinate=stjs.trunc(Math.round(chartBottomPos-heightRatio*(currentVolumeValue-yMin)));yCoordinate=VolumeGraphEngine.filterYCoordinate(yCoordinate,chartTopPos,chartBottomPos,currentVolumeValue,normalBar);var height=yCoordinate-chartBottomPos+1;if(currentVolumeValue<=0){height=0;currentMainValue=null;previousPointMainValue=null;}else if(height>=0){height=-1;}
var bar=ChartElementFactory.createRect(layer,xRect,chartBottomPos,barWidth,height);if(previousPointMainValue==null||currentMainValue>=previousPointMainValue){bar.setFillColor(positiveColor);}else{bar.setFillColor(negativeColor);}
area.addElement(bar);}}};constructor.filterYCoordinate=function(yValue,chartTopPos,chartBottomPos,currentValue,barType){var res=yValue;if(res<chartTopPos){res=chartTopPos;}
if(res>chartBottomPos){res=chartBottomPos;}
if(res==chartBottomPos&&currentValue>0){res=chartBottomPos-1;}
if(res==chartTopPos&&currentValue<0&&ChartOption.INVERSE_NEGATIVE_BAR.equals(barType)){res=chartTopPos+1;}
return res;};prototype.createInteractiveGraphics=function(chartView,chartData,context){GraphEngine.prototype.createInteractiveGraphics.call(this,chartView,chartData,context);var overlayLayer=chartView.getOverlayLayer();var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeGraphAreaBounds=volumeGraphArea.getAreaBound();var volumeGraphStyle=chartView.getStyleModel().getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);var mainGraphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var position=context.getCurrentPosition();var type=volumeGraphStyle.getHighlightType();if(type==null){return;}
if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&volumeGraphArea.isPointInside(position)&&volumeGraphAreaBounds.isVisible()){this.createPositionLines(overlayLayer,volumeGraphArea,context,volumeGraphStyle);if(type.indexOf(GraphStyle.CIRCLE_HIGHLIGHT)!=-1&&context.getCurrentPosition()!=null){var currentPositionOnGraph=stjs.trunc(Math.round(context.getCurrentPosition().getX()-volumeGraphAreaBounds.getContentLeft()));var mainSerie=chartData.getMainSerie();var isLogScale=mainSerie.isLogScale();mainSerie.setLogScale(false);var closestDataPointPosition=context.getClosestDataPointPosition(mainSerie,currentPositionOnGraph,volumeGraphAreaBounds,AggregationStrategy.MAX,FinancialSerie.VOLUME,FinancialSerie.VOLUME,null);mainSerie.setLogScale(isLogScale);if(closestDataPointPosition!=null&&volumeGraphArea.isPointInside(closestDataPointPosition)){this.createCircleHighlight(overlayLayer,closestDataPointPosition,volumeGraphArea,mainSerie,volumeGraphStyle);}}
if(type.indexOf(GraphStyle.COLOR_HIGHLIGHT)!=-1){}
if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.VERTICAL_LINE_HIGHLIGHT)!=-1){var mainGraphBound=mainGraphArea.getAreaBound();var yInnerStart=stjs.trunc(mainGraphBound.getInnerTop());var yInnerEnd=stjs.trunc((mainGraphBound.getInnerHeight()+yInnerStart));var mainGraphVerticalLine=ChartElementFactory.createLine(overlayLayer,position.getX(),yInnerStart,position.getX(),yInnerEnd,volumeGraphStyle.getHighlightLineWidth());mainGraphVerticalLine.setStrokeColor(volumeGraphStyle.getHighlightLineColor());mainGraphVerticalLine.setStrokeColorGradientParam(volumeGraphStyle.getHighlightLineColorGradientParams());mainGraphArea.addElement(mainGraphVerticalLine);}}else if(mainGraphArea.isPointInside(position)){if(type.indexOf(GraphStyle.LINES_HIGHLIGHT)!=-1||type.indexOf(GraphStyle.VERTICAL_LINE_HIGHLIGHT)!=-1){var volumeGraphBound=volumeGraphArea.getAreaBound();var yInnerStart=stjs.trunc(volumeGraphBound.getInnerTop());var yInnerEnd=stjs.trunc((volumeGraphBound.getInnerHeight()+yInnerStart));var volumeGraphVerticalLine=ChartElementFactory.createLine(overlayLayer,position.getX(),yInnerStart,position.getX(),yInnerEnd,volumeGraphStyle.getHighlightLineWidth());volumeGraphVerticalLine.setStrokeColor(volumeGraphStyle.getHighlightLineColor());volumeGraphVerticalLine.setStrokeColorGradientParam(volumeGraphStyle.getHighlightLineColorGradientParams());volumeGraphArea.addElement(volumeGraphVerticalLine);}}};prototype.createIndicatorsGraphics=function(chartView,chartData,context){var indicatorLayer=chartView.getMainLayer();var indicators=chartData.getActiveIndicators();this.createIndicators(indicatorLayer,indicators,chartView,context);if(this.showIndicatorsSignals){this.createSignals(indicatorLayer,indicators,chartView,context);}
if(this.showIndicatorsDescriptions){this.createDescriptions(indicatorLayer,chartData,chartView,context);}};prototype.createIndicators=function(indicatorLayer,indicators,chartView,context){var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null){var indicatorArea=indicator.getCorrespondingAreaId();var correspondingArea=chartView.getArea(indicatorArea);var correspondingStyle=chartView.getStyleModel().getStyle(indicatorArea);if(correspondingArea!=null&&correspondingArea.getAreaBound()!=null&&correspondingArea.getAreaBound().isVisible()){var indicatorSeries=indicator.getSeries();var indicatorSeriesCount=indicatorSeries!=null?indicatorSeries.length:0;for(var j=0;j<indicatorSeriesCount;j++){var currentSerie=indicatorSeries[j];if(currentSerie!=null&&currentSerie.getId()!="Volume"){var graphEngine=this.getGraphEngine(currentSerie.getType());if(currentSerie.getName()=="Histogram"){var barGraphEngine=DefaultBarGraphEngine.getInstance();var savedType=barGraphEngine.getBarType();barGraphEngine.setBarType(ChartOption.INVERSE_NEGATIVE_BAR);correspondingStyle.setBarWidth(this.currentBarWidth);barGraphEngine.createGraphElement(indicatorLayer,correspondingArea,currentSerie,context,correspondingStyle);barGraphEngine.setBarType(savedType);}else if(graphEngine!=null){graphEngine.createGraphElement(indicatorLayer,correspondingArea,currentSerie,context,correspondingStyle);}}}}}}};prototype.createDescriptions=function(indicatorLayer,chartData,chartView,context){var indicators=chartData.getActiveIndicators();var series=chartData.getSeries();this.labelsXPositionsByArea={};var seriesCount=series!=null?series.length:null;for(var i=1;i<seriesCount;i++){var serie=series[i];if(serie!=null&&serie.isEnabled()&&!serie.isEmpty()&&serie.getId()!=YesterdayLine.INDICATOR_ID){var serieName=serie.getName();var currentStock=serie.getStock?serie.getStock():null;if(currentStock!=null&&currentStock.getSymbol()!=null){serieName=currentStock.getSymbol();if(currentStock.getMarketExtension()!=null){serieName+=currentStock.getMarketExtension();}}
this.addLabel(indicatorLayer,Layout.Position.LEFT,DefaultLayout.GRAPH_AREA,serieName+" ",serie.getColor(),chartView);}}
var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null){var indicatorPosition=indicator.getAxisPosition();var indicatorArea=indicator.getCorrespondingAreaId();var descriptions=indicator.getDescription();var descCount=descriptions!=null?descriptions.length:0;var separatorIndex=indicatorPosition==Layout.Position.RIGHT?0:descCount-1;for(var index=0;index<descCount;index++){var separator=index==separatorIndex?" ":"";var description=descriptions[index];if(description!=null&&description["text"]!=null){this.addLabel(indicatorLayer,indicatorPosition,indicatorArea,description["text"]+separator,description["color"],chartView);}}}}};prototype.addLabel=function(layer,position,areaId,text,color,chartView){var area=chartView.getArea(areaId);if(area==null||area.getAreaBound()==null||!area.getAreaBound().isVisible()){return;}
if(color==null){color=ChartColor.black;}
var areaBounds=area.getAreaBound();var style=chartView.getStyleModel().getStyle(areaId);var font="Georgia";var fontSize=VolumeGraphEngine.DESCRIPTIONS_LABEL_FONT_SIZE;var bold=false;if(style!=null){font=style.getFont();bold=style.isBoldFont();}
var left=stjs.trunc(areaBounds.getInnerLeft());var right=stjs.trunc(areaBounds.getInnerRight());var top=stjs.trunc(areaBounds.getInnerTop());var labelsXPosition=this.labelsXPositionsByArea[areaId];if(labelsXPosition==null){labelsXPosition={};labelsXPosition[String.valueOf(Layout.Position.LEFT)]=left+1;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=right-1;labelsXPosition[String.valueOf(Layout.Position.TOP)]=top+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN;this.labelsXPositionsByArea[areaId]=labelsXPosition;}
var currentLeft=labelsXPosition[String.valueOf(Layout.Position.LEFT)];var currentRight=labelsXPosition[String.valueOf(Layout.Position.RIGHT)];var currentTop=labelsXPosition[String.valueOf(Layout.Position.TOP)];var currentRemainingWidth=currentRight-currentLeft;var neededWidth=chartView.getTextWidth(text,font,fontSize,bold);if(currentRemainingWidth<neededWidth){currentLeft=left+1;currentRight=right-1;currentTop=currentTop+fontSize+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN;labelsXPosition[String.valueOf(Layout.Position.LEFT)]=currentLeft;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=currentRight;labelsXPosition[String.valueOf(Layout.Position.TOP)]=currentTop;}
var labelLeftPos=0;if(position==Layout.Position.RIGHT){currentRight=currentRight-neededWidth;labelLeftPos=currentRight;labelsXPosition[String.valueOf(Layout.Position.RIGHT)]=currentRight;}else{labelLeftPos=currentLeft;labelsXPosition[String.valueOf(Layout.Position.LEFT)]=currentLeft+neededWidth;}
var label=ChartElementFactory.createLabel(layer,null,text,labelLeftPos,currentTop,neededWidth,fontSize+VolumeGraphEngine.DESCRIPTIONS_LABEL_Y_MARGIN);label.setBaseline(Label.BASELINE_TOP);label.setColor(color);label.setBold(bold);label.setFont(font);label.setFontSize(fontSize);area.addElement(label);};prototype.createSignals=function(indicatorLayer,indicators,chartView,context){var indicatorsCount=indicators!=null?indicators.length:0;for(var i=0;i<indicatorsCount;i++){var indicator=indicators[i];if(indicator!=null&&indicator.isHasSignals()&&indicator.getSignals()!=null){var indicatorArea=indicator.getCorrespondingAreaId();var correspondingArea=chartView.getArea(indicatorArea);var correspondingStyle=chartView.getStyleModel().getStyle(indicatorArea);if(correspondingArea!=null&&correspondingArea.getAreaBound()!=null&&correspondingArea.getAreaBound().isVisible()){var signalSerie=indicator.getSignals();SignalsEngine.getInstance().createGraphElement(indicatorLayer,correspondingArea,signalSerie,context,correspondingStyle);}}}};prototype.isShowIndicatorsDescriptions=function(){return this.showIndicatorsDescriptions;};prototype.setShowIndicatorsDescriptions=function(showIndicatorsDescriptions){this.showIndicatorsDescriptions=showIndicatorsDescriptions;};prototype.isShowIndicatorsSignals=function(){return this.showIndicatorsSignals;};prototype.setShowIndicatorsSignals=function(showIndicatorsSignals){this.showIndicatorsSignals=showIndicatorsSignals;};},{labelsXPositionsByArea:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},volumeColorStrategy:"ColorStrategy",aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},defaultType:{name:"Enum",arguments:["Chart.ChartType"]}},{});
var IndicatorsEngine=function(){DefaultLineGraphEngine.call(this);};IndicatorsEngine=stjs.extend(IndicatorsEngine,DefaultLineGraphEngine,[],null,{instance:"DefaultLineGraphEngine"},{});
var FinancialChartContext=function(){ChartContext.call(this);};FinancialChartContext=stjs.extend(FinancialChartContext,ChartContext,[],function(constructor,prototype){prototype.update=function(data,aggregationStrategy){this.data=data;this.aggregationStrategy=aggregationStrategy;var mainSerie=data.getMainSerie();if(data==null||data.getSerieCount()==0||mainSerie==null){return;}
var series=data.getMainGraphSeries();var yesterdayLine=data.getSerieById(YesterdayLine.INDICATOR_ID);if(yesterdayLine!=null){var xRange=this.getRange(DefaultLayout.X_AXIS_AREA);if(xRange==null){yesterdayLine.setEnabled(true);yesterdayLine.update(mainSerie,data.getExtremums());yesterdayLine.computeChangeValues(Serie.Y);}else{yesterdayLine.update(mainSerie,xRange);yesterdayLine.computeChangeValues(Serie.Y);yesterdayLine.setEnabled(false);}}
var addedReferencePrice=false;if(mainSerie!=null&&mainSerie.isEmpty()&&mainSerie.isIntraday()){addedReferencePrice=true;var startXValue=mainSerie.getStartXValue();var endXValue=mainSerie.getEndXValue();var referenceValue=mainSerie.getReferenceValue();var referencePoint=IntradaySerie.createReferencePricePoint(startXValue,referenceValue);mainSerie.addPoint(0,referencePoint);var referencePoint2=IntradaySerie.createReferencePricePoint(endXValue,referenceValue);mainSerie.addPoint(1,referencePoint2);}
this.updateSeriesContext(series);if(addedReferencePrice){mainSerie.removeAllPoints();}
this.setRange(FinancialLayout.BOTTOM_AXIS_LEFT,[0.0,this.getMax(mainSerie.getId(),FinancialSerie.VOLUME)]);};prototype.setIndicatorsMinMaxInRange=function(range){var extremums=this.data.getExtremums();if(extremums==null){return;}
var startXValue=extremums[0];var endXValue=extremums[1];if(range!=null){var rangeStartXValue=range[0];var rangeEndXValue=range[1];if(!isNaN(rangeStartXValue)&&rangeStartXValue>startXValue&&rangeStartXValue<endXValue){startXValue=rangeStartXValue;}
if(!isNaN(rangeEndXValue)&&rangeEndXValue>startXValue&&rangeEndXValue<endXValue){endXValue=rangeEndXValue;}}
var activeIndicators=this.data.getActiveIndicators();var indicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var k=0;k<indicatorsCount;k++){var activeIndicator=activeIndicators[k];var indicatorMinValue=Double.POSITIVE_INFINITY;var indicatorMaxValue=Double.NEGATIVE_INFINITY;var serieCount=0;var series=null;if(activeIndicator!=null&&activeIndicator.getSeries()!=null&&activeIndicator.getCorrespondingAreaId()!=DefaultLayout.GRAPH_AREA){series=activeIndicator.getSeries();serieCount=series.length;}
for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();var currentSerieMinIndex=currentSerie.findIndexClosestToXValue(startXValue);var currentSerieMaxIndex=currentSerie.findIndexClosestToXValue(endXValue);this.setMinIndex(serieId,currentSerieMinIndex,Serie.X);this.setMaxIndex(serieId,currentSerieMaxIndex,Serie.X);var currentSerieMinXValue=currentSerie.getValue(currentSerieMinIndex,Serie.X);var currentSerieMaxXValue=currentSerie.getValue(currentSerieMaxIndex,Serie.X);this.setMin(serieId,Serie.X,currentSerieMinXValue);this.setMax(serieId,Serie.X,currentSerieMaxXValue);var currentMinValue=Double.POSITIVE_INFINITY;var currentMaxValue=Double.NEGATIVE_INFINITY;for(var j=currentSerieMinIndex;j<=currentSerieMaxIndex;j++){var currentValue=currentSerie.getValueAsDouble(j,Serie.Y);if(currentValue!=null&&!isNaN(currentValue)&&currentValue<currentMinValue){currentMinValue=currentValue;}
if(currentValue!=null&&!isNaN(currentValue)&&currentValue>currentMaxValue){currentMaxValue=currentValue;}}
if(currentMinValue<indicatorMinValue){indicatorMinValue=currentMinValue;}
if(currentMaxValue>indicatorMaxValue){indicatorMaxValue=currentMaxValue;}}}
if(indicatorMinValue!=Double.POSITIVE_INFINITY&&indicatorMaxValue!=Double.NEGATIVE_INFINITY){this.setRange(activeIndicator.getId(),[indicatorMinValue,indicatorMaxValue]);}}};prototype.setSeriesMinMaxInRange=function(range,series){var globalPercentChanges=ChartContext.prototype.setSeriesMinMaxInRange.call(this,range,series);if(globalPercentChanges==null){return null;}
this.setIndicatorsMinMaxInRange(range);var mainSerie=this.data.getMainSerie();if(mainSerie!=null&&mainSerie.isEnabled()){var serieId=mainSerie.getId();var mainSerieMinIndex=this.getMinIndex(serieId,Serie.X);var mainSerieMaxIndex=this.getMaxIndex(serieId,Serie.X);var volumeMax=0;for(var j=mainSerieMinIndex;j<=mainSerieMaxIndex;j++){var currentVolumeValue=mainSerie.getValueAsInteger(j,FinancialSerie.VOLUME);if(currentVolumeValue!=null&&!isNaN(currentVolumeValue)&&currentVolumeValue>volumeMax){volumeMax=currentVolumeValue;}}
this.setMin(serieId,FinancialSerie.VOLUME,0);this.setMax(serieId,FinancialSerie.VOLUME,volumeMax);}
return globalPercentChanges;};prototype.adjustIndicatorsRange=function(){var activeIndicators=this.data.getActiveIndicators();var indicatorsCount=activeIndicators!=null?activeIndicators.length:0;for(var k=0;k<indicatorsCount;k++){var activeIndicator=activeIndicators[k];var currentIndicatorRange=this.getRange(activeIndicator.getId());var serieCount=0;var series=null;var indicatorMinValue=0;var indicatorMaxValue=0;if(activeIndicator!=null&&activeIndicator.getSeries()!=null&&currentIndicatorRange!=null&&currentIndicatorRange[0]!=null&&currentIndicatorRange[1]!=null){series=activeIndicator.getSeries();serieCount=series.length;indicatorMinValue=currentIndicatorRange[0];indicatorMaxValue=currentIndicatorRange[1];}
for(var i=0;i<serieCount;i++){var currentSerie=series[i];if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()){var serieId=currentSerie.getId();this.setMin(serieId,Serie.Y,indicatorMinValue);this.setMax(serieId,Serie.Y,indicatorMaxValue);}}}};prototype.adjustY1Range=function(newY1Range){var newY1Min=newY1Range!=null?newY1Range[0]:null;var newY1Max=newY1Range!=null?newY1Range[1]:null;if(newY1Min!=null&&newY1Max!=null){var referenceValue=this.data.getMainSerie().getReferenceValue();this.adjustRefValue=referenceValue!=0.0?referenceValue:1.0;var adjustedMinPercent=100.0*(newY1Min-this.adjustRefValue)/Math.abs(this.adjustRefValue);var adjustedMaxPercent=100.0*(newY1Max-this.adjustRefValue)/Math.abs(this.adjustRefValue);this.setRange(DefaultLayout.Y1_AXIS_AREA,[newY1Min,newY1Max]);this.setRange(DefaultLayout.Y2_AXIS_AREA,[adjustedMinPercent,adjustedMaxPercent]);}
this.adjustSeriesMinMax(this.data.getMainGraphSeries());var yesterdayLine=this.data.getSerieById(YesterdayLine.INDICATOR_ID);var y2Range=this.getRange(DefaultLayout.Y2_AXIS_AREA);if(yesterdayLine!=null&&y2Range!=null&&newY1Min!=null&&newY1Max!=null){var min=y2Range[0];var max=y2Range[1];if(min!=null&&max!=null&&min<=0.0&&max>=0.0){yesterdayLine.setEnabled(true);this.setMin(yesterdayLine.getId(),yesterdayLine.getMainField(),newY1Min);this.setMax(yesterdayLine.getId(),yesterdayLine.getMainField(),newY1Max);}}};prototype.adjustY2Range=function(newY2Range){if(newY2Range!=null){this.setRange(DefaultLayout.Y2_AXIS_AREA,[newY2Range[0],newY2Range[1]]);}
this.adjustSeriesMinMax(this.data.getMainGraphSeries());};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},currentPosition:"Point2D",ranges:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},labelsPosition:{name:"Map",arguments:[null,{name:"Array",arguments:[null]}]},formats:{name:"Map",arguments:[null,null]},seriesMinValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMaxValues:{name:"Map",arguments:[null,{name:"Map",arguments:[null,"Object"]}]},seriesMinIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]},seriesMaxIndices:{name:"Map",arguments:[null,{name:"Map",arguments:[null,null]}]}},{});
var FinancialEngineModel=function(){DefaultEngineModel.call(this);this.fContext=new FinancialChartContext();this.context=this.fContext;};FinancialEngineModel=stjs.extend(FinancialEngineModel,DefaultEngineModel,[],function(constructor,prototype){prototype.bottomLeftAxisEngine=null;prototype.bottomRightAxisEngine=null;prototype.delimiterEngine=null;prototype.volumeAggregationStrategy=null;prototype.volumeField=null;prototype.fContext=null;prototype.showYesterdayLine=false;prototype.options=null;constructor.COLORS_ARRAY=[ChartColor.orange,ChartColor.black,ChartColor.blue,ChartColor.kaki,ChartColor.cyan,ChartColor.brown,ChartColor.salmon,ChartColor.yellow,ChartColor.darkGrey,ChartColor.grey,ChartColor.lightBlue,ChartColor.lightGrey];prototype.init=function(options){DefaultEngineModel.prototype.init.call(this,options);this.options=options;this.volumeField=FinancialSerie.VOLUME;this.aggregationStrategy=AggregationStrategy.MAX;this.showYesterdayLine=options.isShowYesterday();this.titleEngine=new FinancialTitleEngine(options);this.xAxisEngine=new FinancialXAxisEngine(options);this.legendEngine=new FinancialLegendEngine(options);this.bottomLeftAxisEngine=new VolumeAxisEngine(options,FinancialLayout.BOTTOM_AXIS_LEFT,Layout.Position.LEFT);this.bottomRightAxisEngine=new VolumeAxisEngine(options,FinancialLayout.BOTTOM_AXIS_RIGHT,Layout.Position.RIGHT);this.delimiterEngine=new DefaultDelimiterEngine(options);this.graphEngine=new VolumeGraphEngine(options);if(options!=null){var customEngineModel=options.getCustomEngineModel();if(customEngineModel!=null){if((customEngineModel)["init"]!=null){options.setCustomeEngineModel(null);customEngineModel.init(options);options.setCustomeEngineModel(customEngineModel);}
var validEngines={};var tmp={};this.extendEngine(customEngineModel,validEngines,"titleEngine");this.extendEngine(customEngineModel,validEngines,"xAxisEngine");this.extendEngine(customEngineModel,validEngines,"y1AxisEngine");this.extendEngine(customEngineModel,validEngines,"y2AxisEngine");this.extendEngine(customEngineModel,validEngines,"graphEngine");this.extendEngine(customEngineModel,validEngines,"legendEngine");this.extendEngine(customEngineModel,validEngines,"tooltipEngine");if(options.isAllowOverlayDrawing()){this.extendEngine(customEngineModel,validEngines,"drawEngine");}
this.extendEngine(customEngineModel,validEngines,"bottomLeftAxisEngine");this.extendEngine(customEngineModel,validEngines,"bottomRightAxisEngine");this.extendEngine(customEngineModel,validEngines,"delimiterEngine");SQW.$.extend(true,tmp,customEngineModel,validEngines);SQW.$.extend(true,this,tmp);}}
this.engines[DefaultLayout.TITLE_AREA]=this.titleEngine;this.engines[DefaultLayout.X_AXIS_AREA]=this.xAxisEngine;this.engines[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisEngine;this.engines[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisEngine;this.engines[DefaultLayout.GRAPH_AREA]=this.graphEngine;this.engines[DefaultLayout.LEGEND_AREA]=this.legendEngine;this.engines[DefaultLayout.TOOLTIP_AREA]=this.tooltipEngine;this.engines[DrawEngine.ID]=this.drawEngine;this.engines[FinancialLayout.BOTTOM_AXIS_LEFT]=this.bottomLeftAxisEngine;this.engines[FinancialLayout.BOTTOM_AXIS_RIGHT]=this.bottomRightAxisEngine;this.engines[FinancialLayout.DELIMITER_AREA]=this.delimiterEngine;};prototype.extend=function(options){};prototype.updateRange=function(xRange,chartView,chartData){this.context.setRange(DefaultLayout.X_AXIS_AREA,xRange);this.setupSeriesColor(chartData);if(this.showYesterdayLine&&chartData.isIntraday()){var yesterdayLine=chartData.getSerieById(YesterdayLine.INDICATOR_ID);if(yesterdayLine==null){var yesterdayLineColor=ChartColor.orange;var yesterdayLineDashed=true;if(this.options!=null){yesterdayLineColor=this.options.getYesterdayLineColor();yesterdayLineDashed=this.options.isYesterdayLineDashed();}
yesterdayLine=new YesterdayLine(chartData.getMainSerie(),xRange,yesterdayLineColor,yesterdayLineDashed);chartData.addSerie(yesterdayLine);}
yesterdayLine.update(chartData.getMainSerie(),xRange);}else if(chartData.getSerieById(YesterdayLine.INDICATOR_ID)!=null){chartData.removeSerie(YesterdayLine.INDICATOR_ID);}
if(!chartData.isIntraday()&&xRange!=null&&xRange[0]!=null&&xRange[1]!=null){var serieCount=chartData.getSerieCount();for(var i=0;i<serieCount;i++){var serie=chartData.getSerie(i);if(serie!=null){serie.setForcedInterval(xRange[0],xRange[1]);}}}
chartData.updateContextDependentIndicators();this.context.update(chartData,this.aggregationStrategy);this.setCustomMinMaxAxis(chartData.getMainSerie());var styleModel=chartView.getStyleModel();if(chartData.isActiveIndicator(IndicatorsManager.VOLUME_INDICATOR_ID)&&chartData.getActiveIndicatorSerie("Volume")!=null){var bottomLeftAxisStyle=styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_LEFT);bottomLeftAxisStyle.setVisible(true);var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var bottomAxisLeft=this.engines[FinancialLayout.BOTTOM_AXIS_LEFT];bottomAxisLeft.computePrettyLabels(volumeGraphArea,this.context.getRange(FinancialLayout.BOTTOM_AXIS_LEFT),0,bottomLeftAxisStyle,false);this.context.setRange(FinancialLayout.BOTTOM_AXIS_LEFT,bottomAxisLeft.getRange());this.context.setLabelsPosition(FinancialLayout.BOTTOM_AXIS_LEFT,bottomAxisLeft.getLabelsPosition());this.context.setFormat(FinancialLayout.BOTTOM_AXIS_LEFT,"0");if(bottomAxisLeft.getRange()!=null){this.context.setMin(chartData.getMainSerie().getId(),FinancialSerie.VOLUME,bottomAxisLeft.getRange()[0]);this.context.setMax(chartData.getMainSerie().getId(),FinancialSerie.VOLUME,bottomAxisLeft.getRange()[1]);}}else{this.adjustBottomAxis(FinancialLayout.BOTTOM_AXIS_LEFT,chartView,chartData);}
this.adjustBottomAxis(FinancialLayout.BOTTOM_AXIS_RIGHT,chartView,chartData);var layout=chartView.getLayout();if(layout.setShowBottomGraph&&layout.isShowBottomGraph){var bottomGraphStyle=styleModel.getStyle(FinancialLayout.BOTTOM_GRAPH_AREA);if(bottomGraphStyle!=null&&!bottomGraphStyle.isVisible()){if(layout.isShowBottomGraph()){layout.setShowBottomGraph(false);chartView.refreshLayout();}}else if(!chartData.isEmpty()&&chartData.hasValidBottomIndicators()){if(!layout.isShowBottomGraph()){layout.setShowBottomGraph(true);chartView.refreshLayout();}}else if(layout.isShowBottomGraph()){layout.setShowBottomGraph(false);chartView.refreshLayout();}}
var graphArea=chartView.getArea(DefaultLayout.GRAPH_AREA);var mainYAxis=this.engines[DefaultLayout.Y1_AXIS_AREA];var step=mainYAxis.computePrettyLabels(graphArea,this.context.getRange(DefaultLayout.Y1_AXIS_AREA),this.context.getPrecision(),chartView.getStyleModel().getY1AxisStyle(),chartData.isLogScale());if(chartData.isMainCurrency()){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));this.context.setFormat(FinancialLayout.BOTTOM_AXIS_RIGHT,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));}else if(chartData.isSwissDots()){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_3_DECIMALS));}else if(step==1||step>=5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.NO_DECIMALS));}else if(step==0.1||step>=0.5){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_1_DECIMAL));}else if(step>=0.01||ArrayUtil.getRangeSpan(mainYAxis.getRange())>=0.01){this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS));}else{this.context.setFormat(DefaultLayout.Y1_AXIS_AREA,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));this.context.setFormat(FinancialLayout.BOTTOM_AXIS_RIGHT,String.valueOf(AbbreviateNumberFormatter.EXACTLY_4_DECIMALS));}
if(chartData.getMainSerie()!=null&&(chartData.getMainSerie()).isIntraday()){this.context.setFormat(DefaultLayout.X_AXIS_AREA,DateTimeFormatter.FORMAT_TIME);}else{this.context.setFormat(DefaultLayout.X_AXIS_AREA,DateTimeFormatter.FORMAT_DATE);}
if(step!=null){this.context.adjustY1Range(mainYAxis.getRange());this.context.setLabelsPosition(DefaultLayout.Y1_AXIS_AREA,mainYAxis.getLabelsPosition());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,mainYAxis.getLabelsPosition());}else{var y2Axis=this.engines[DefaultLayout.Y2_AXIS_AREA];y2Axis.setRange(this.context.getRange(DefaultLayout.Y2_AXIS_AREA));this.context.adjustY2Range(y2Axis.getRange());this.context.setLabelsPosition(DefaultLayout.Y2_AXIS_AREA,y2Axis.getLabelsPosition());}
(this.context).adjustIndicatorsRange();for(var engineId in this.engines){var engine=this.engines[engineId];if(engine!=null){engine.update(chartView,chartData,this.context);}}};prototype.adjustBottomAxis=function(axisId,chartView,chartData){var styleModel=chartView.getStyleModel();var correspondingBottomAxisStyle=styleModel.getStyle(axisId);var correspondingBottomAxis=this.engines[axisId];var bottomGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);if(correspondingBottomAxisStyle!=null&&correspondingBottomAxis!=null&&bottomGraphArea!=null){var axisPos=correspondingBottomAxisStyle.getPosition();var correspondingIndicators=chartData.getActiveIndicatorsAssociatedWith(FinancialLayout.BOTTOM_GRAPH_AREA,axisPos);if(correspondingIndicators!=null&&correspondingIndicators[0]!=null){var correspondingIndicator=correspondingIndicators[0];var indicatorId=correspondingIndicator.getId();correspondingBottomAxisStyle.setVisible(true);var step=correspondingBottomAxis.computePrettyLabels(bottomGraphArea,this.context.getRange(indicatorId),this.context.getPrecision(),correspondingBottomAxisStyle,false);this.context.setRange(axisId,correspondingBottomAxis.getRange());this.context.setRange(indicatorId,correspondingBottomAxis.getRange());this.context.setLabelsPosition(axisId,correspondingBottomAxis.getLabelsPosition());if(step==1||step>=5){this.context.setFormat(axisId,String.valueOf(AbbreviateNumberFormatter.NO_DECIMALS));}else{this.context.setFormat(axisId,String.valueOf(AbbreviateNumberFormatter.EXACTLY_2_DECIMALS));}
if(correspondingBottomAxis.getRange()!=null){this.context.setMin(indicatorId,Serie.Y,correspondingBottomAxis.getRange()[0]);this.context.setMax(indicatorId,Serie.Y,correspondingBottomAxis.getRange()[1]);}}else{correspondingBottomAxisStyle.setVisible(false);}}else if(correspondingBottomAxisStyle!=null){correspondingBottomAxisStyle.setVisible(false);}};prototype.setupSeriesColor=function(chartData){var mainSerie=chartData.getMainSerie();if(mainSerie==null){return;}else{var seriesCount=chartData.getSerieCount();for(var i=1;i<seriesCount;i++){var currentSerie=chartData.getSerie(i);if(currentSerie!=null&&currentSerie.isEnabled()&&!currentSerie.isEmpty()&&currentSerie.isInteractionAllowed()){currentSerie.setColor(FinancialEngineModel.COLORS_ARRAY[i%FinancialEngineModel.COLORS_ARRAY.length]);currentSerie.setColorStrategy(null);}}}};prototype.createInteractiveGraphics=function(chartView,data){var volumeGraphArea=chartView.getArea(FinancialLayout.BOTTOM_GRAPH_AREA);var volumeGraphAreaBound=volumeGraphArea.getAreaBound();var titleEngine=this.engines[DefaultLayout.TITLE_AREA];var mainSerie=data.getMainSerie();var mainField=mainSerie!=null?mainSerie.getMainField():"";if(volumeGraphArea!=null&&volumeGraphAreaBound!=null&&volumeGraphAreaBound.isVisible()&&volumeGraphArea.isPointInside(this.context.getCurrentPosition())){titleEngine.setAssociatedGraphId(FinancialLayout.BOTTOM_GRAPH_AREA);titleEngine.setAssociatedAxisId(FinancialLayout.BOTTOM_AXIS_LEFT);}else{titleEngine.setAssociatedGraphId(DefaultLayout.GRAPH_AREA);titleEngine.setAssociatedAxisId(DefaultLayout.Y1_AXIS_AREA);}
DefaultEngineModel.prototype.createInteractiveGraphics.call(this,chartView,data);};prototype.updateXType=function(xType){};},{bottomLeftAxisEngine:"AxisEngine",bottomRightAxisEngine:"AxisEngine",delimiterEngine:"Engine",volumeAggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},fContext:"FinancialChartContext",options:"ChartOption",COLORS_ARRAY:{name:"Array",arguments:["ChartColor"]},aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},customMainAxisMinMax:{name:"Array",arguments:[null]},context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
var CompareBoxPopover=function(compareCallback,startYear,endYear){this.compareCallback=compareCallback;this.box=$(window.document.createElement("div"));this.box.addClass(CompareBoxPopover.COMPARE_BOX_CSS_CLASS);var choosersContainer=$(window.document.createElement("div"));choosersContainer.addClass(CompareBoxPopover.CHOOSERS_CSS_CLASS);var titleChooserContainer=$(window.document.createElement("div"));titleChooserContainer.addClass(CompareBoxPopover.TITLE_CHOOSER_CSS_CLASS);var titleChooserTitle=$(window.document.createElement("div"));titleChooserTitle.addClass(CompareBoxPopover.CHOOSERS_TITLE_CSS_CLASS);titleChooserTitle.text(ChartMessagesRepository.getInstance().get("compareWith")+" :");var titleChooserContent=$(window.document.createElement("div"));titleChooserContent.addClass(CompareBoxPopover.TITLE_CHOOSER_SELECTION_CSS_CLASS);var c1Container=$(window.document.createElement("div"));c1Container.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var title1=$(window.document.createElement("span"));title1.text(ChartMessagesRepository.getInstance().get("title")+" 1");title1.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);var inputContainer=$(window.document.createElement("div"));this.stockSearch1=new GeneralStockSearch(inputContainer,SqwStockSearchOptions.getDefault());c1Container.append(title1);c1Container.append(inputContainer);var c2Container=this.createCompareElement(ChartMessagesRepository.getInstance().get("title")+" 2");titleChooserContent.append(c1Container);titleChooserContent.append(c2Container);titleChooserContainer.append(titleChooserTitle);titleChooserContainer.append(titleChooserContent);var periodChooserContainer=$(window.document.createElement("div"));periodChooserContainer.addClass(CompareBoxPopover.PERIOD_CHOOSER_CSS_CLASS);var periodChooserTitle=$(window.document.createElement("div"));periodChooserTitle.addClass(CompareBoxPopover.CHOOSERS_TITLE_CSS_CLASS);periodChooserTitle.text(ChartMessagesRepository.getInstance().get("definePeriod")+" :");var periodChooserContent=$(window.document.createElement("div"));periodChooserContent.addClass(CompareBoxPopover.PERIOD_CHOOSER_SELECTION_CSS_CLASS);var fromContainer=$(window.document.createElement("div"));fromContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var fromPrefix=$(window.document.createElement("span"));fromPrefix.text(ChartMessagesRepository.getInstance().get("from"));fromPrefix.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);this.fromDatepicker=new DatePicker(startYear,endYear);fromContainer.append(fromPrefix);fromContainer.append(this.fromDatepicker.getElement());var toContainer=$(window.document.createElement("div"));toContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var toPrefix=$(window.document.createElement("span"));toPrefix.text(ChartMessagesRepository.getInstance().get("to"));toPrefix.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);this.toDatepicker=new DatePicker(startYear,endYear);toContainer.append(toPrefix);toContainer.append(this.toDatepicker.getElement());periodChooserContent.append(fromContainer);periodChooserContent.append(toContainer);periodChooserContainer.append(periodChooserTitle);periodChooserContainer.append(periodChooserContent);var bottomContainer=$(window.document.createElement("div"));bottomContainer.addClass(CompareBoxPopover.BOTTOM_CSS_CLASS);var drawButton=$(window.document.createElement("button"));drawButton.addClass(CompareBoxPopover.DRAW_BUTTON_CSS_CLASS);drawButton.text(ChartMessagesRepository.getInstance().get("draw"));var self=this;var openTest=stjs.bind(this,function(ev,THIS){var stocks=[self.getStock1(),self.getStock2()];var period=[self.getFrom(),self.getTo()];self.compareCallback(stocks,period);return false;},1);drawButton.on("click",openTest);bottomContainer.append(drawButton);choosersContainer.append(titleChooserContainer);choosersContainer.append(periodChooserContainer);this.box.append(choosersContainer);this.box.append(bottomContainer);};CompareBoxPopover=stjs.extend(CompareBoxPopover,null,[],function(constructor,prototype){constructor.ALL_STOCKTYPES="share,index,currency,warrant,etf,commodity,bond";constructor.COMPARE_BOX_CSS_CLASS="compare-box";constructor.CHOOSERS_CSS_CLASS="choosers-container";constructor.TITLE_CHOOSER_CSS_CLASS="title-chooser";constructor.PERIOD_CHOOSER_CSS_CLASS="period-chooser";constructor.TITLE_CHOOSER_SELECTION_CSS_CLASS="title-chooser-content";constructor.PERIOD_CHOOSER_SELECTION_CSS_CLASS="period-chooser-content";constructor.DRAW_BUTTON_CSS_CLASS="compare-draw-button";constructor.CHOOSERS_TITLE_CSS_CLASS="chooser-title";constructor.CHOOSER_ELEMENT_CSS_CLASS="chooser-element";constructor.CHOOSER_ELEMENT_TITLE_CSS_CLASS="chooser-element-title";constructor.BOTTOM_CSS_CLASS="compare-box-button-container";prototype.box=null;prototype.stockSearch1=null;prototype.stockSearch2=null;prototype.fromDatepicker=null;prototype.toDatepicker=null;prototype.compareCallback=null;prototype.createCompareElement=function(prefixTitle){var compareContainer=$(window.document.createElement("div"));compareContainer.addClass(CompareBoxPopover.CHOOSER_ELEMENT_CSS_CLASS);var compareElementTitle=$(window.document.createElement("span"));compareElementTitle.text(prefixTitle);compareElementTitle.addClass(CompareBoxPopover.CHOOSER_ELEMENT_TITLE_CSS_CLASS);var stockSearchContainer=$(window.document.createElement("div"));this.stockSearch2=new GeneralStockSearch(stockSearchContainer,SqwStockSearchOptions.getDefault());compareContainer.append(compareElementTitle);compareContainer.append(stockSearchContainer);return compareContainer;};prototype.getBox=function(){return this.box;};prototype.getStock1=function(){return this.stockSearch1.getSelectedStock();};prototype.getStock2=function(){return this.stockSearch2.getSelectedStock();};prototype.getFrom=function(){if(this.fromDatepicker!=null){return this.fromDatepicker.getSelectedDate();}else{return null;}};prototype.getTo=function(){if(this.toDatepicker!=null){return this.toDatepicker.getSelectedDate();}else{return null;}};prototype.blur=function(){this.stockSearch1.close(null,null);this.stockSearch1.setSelectedStock(null);this.stockSearch2.close(null,null);this.stockSearch2.setSelectedStock(null);};prototype.setPeriod=function(minXValue,maxXValue){this.fromDatepicker.selectDateTime(minXValue);this.toDatepicker.selectDateTime(maxXValue);};prototype.show=function(){this.box.show();};prototype.hide=function(){this.box.hide();};},{box:"SqwJQuery",stockSearch1:"GeneralStockSearch",stockSearch2:"GeneralStockSearch",fromDatepicker:"DatePicker",toDatepicker:"DatePicker",compareCallback:{name:"Callback2",arguments:[{name:"Array",arguments:["Stock"]},{name:"Array",arguments:["Date"]}]}},{});
var GeneralStockSearch=function(container,options){SqwStockSearch.call(this,container,options,ServerRequest.getBaseURL());var servletUrl=ServerRequest.getBaseURL()+ServerRequest.WEB_SERVICE_PREFIX_URL;servletUrl+="MetaSearchServlet?";if(options.stockTypes!=null){servletUrl+="stocktypes="+options.stockTypes+"&";}
var that=this;this.simpleUrl=servletUrl;this.clickHandler=stjs.bind(this,function(ev,THIS){var stockSearch=that.container.get(0);if(!SQW.$.contains(stockSearch,ev.target)&&!SQW.$(ev.target).is(stockSearch)){that.selectedStock=null;that.close(null,null);if(that.options.selectCallback!=null){that.options.selectCallback(null);}
return true;}
var row=SQW.$(ev.target).closest("tr");if(row.size()>0&&SQW.$.contains(stockSearch,row.get(0))){that.close(row.data("searchResult"),row.data("stockKey"));that.selectedStock=row.data("stock");if(that.options.selectCallback!=null){that.options.selectCallback(that.selectedStockKey);}
return true;}
return true;},1);};GeneralStockSearch=stjs.extend(GeneralStockSearch,SqwStockSearch,[],function(constructor,prototype){prototype.simpleUrl=null;prototype.selectedStock=null;prototype.currencySearch=false;prototype.keyboardSelect=function(){if(this.selectedResultIndex>0){var row=this.results.find("tr:nth-child("+this.selectedResultIndex+")");if(row.size()>0){this.close(row.data("searchResult"),row.data("stockKey"));this.selectedStock=row.data("stock");if(this.options.selectCallback!=null){this.options.selectCallback(this.selectedStockKey);}}}};prototype.search=function(){var currentVal=this.input.val();if(currentVal!=null&&(currentVal.indexOf("_")!=-1||currentVal.indexOf("/")!=-1)){this.url=this.simpleUrl+"count=10&market=cu&";this.currencySearch=true;}else{this.url=this.simpleUrl+"count=20&market=&";this.currencySearch=false;}
this.selectedStock=null;SqwStockSearch.prototype.search.call(this);};prototype.getSelectedStock=function(){return this.selectedStock;};prototype.getSuccessCallback=function(){var that=this;var currentSearchCallbackId=this.searchId;return function(response,status,jqxhr){if(currentSearchCallbackId!=that.searchId){return;}
var searchResults=response["results"];var table=null;if(!that.currencySearch){table=that.createResultTable(searchResults);}else{table=that.createCurrencyResultTable(searchResults);}
that.results.html("");if(searchResults.length>0){that.results.append(table);that.displayResults();}else{that.results.hide();}};};prototype.createCurrencyResultTable=function(searchResults){var table=SQW.$("<table/>");var currencies=[];var keys=[];var index=-1;for(var i=0;i<searchResults.length;i++){var r1=new SqwStockSearchResult(searchResults[i]);var r2=new SqwStockSearchResult(searchResults[i]);var key=SqwStockSearch.createKey(r1.getIsin(),r1.getStockExchangeId(),r1.getCurrency());var currencyStock=Stock.stockSearchResult2Stock(key,r1);if(currencyStock!=null){var row1=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r1.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r1.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+r1.getMarketName()+"</td>"+"<td class='currency'>"+r1.getCurrency()+"<img src=\"/gifs/flag_"+r1.getCurrency()+".gif\"></td>"+"</tr>");row1.data("stockKey",key);row1.data("searchResult",r1);row1.data("stock",currencyStock);currencies[++index]=row1;keys[index]=key;var inverseCurr=currencyStock.getInverseCurrency();if(inverseCurr!=null){r2.setCurrency(inverseCurr.getCurrency());r2.setSymbol(inverseCurr.getSymbol());r2.setName(inverseCurr.getName());r2.setIsin(inverseCurr.getIsin());var row2=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(inverseCurr.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(inverseCurr.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+inverseCurr.getMarketName()+"</td>"+"<td class='currency'>"+inverseCurr.getCurrency()+"<img src=\"/gifs/flag_"+inverseCurr.getCurrency()+".gif\"></td>"+"</tr>");row2.data("stockKey",inverseCurr.getKey());row2.data("searchResult",r2);row2.data("stock",inverseCurr);currencies[++index]=row2;keys[index]=inverseCurr.getKey();}}}
var uniqueKeys=SQW.utils.array.unique(keys);for(var i=0;i<uniqueKeys.length;i++){table.append(this.getRow(currencies,uniqueKeys[i]));}
return table;};prototype.getRow=function(currencies,key){for(var i=0;i<currencies.length;i++){var currency=currencies[i];if(currency.data("stockKey").equals(key)){return currency;}}
return null;};prototype.createResultTable=function(searchResults){var table=SQW.$("<table/>");for(var i=0;i<searchResults.length;i++){var r=new SqwStockSearchResult(searchResults[i]);var key=SqwStockSearch.createKey(r.getIsin(),r.getStockExchangeId(),r.getCurrency());var row=SQW.$("<tr><td class='symbol'>"+SqwStockSearch.mark(r.getSymbol(),this.previousInputValue)+"</td>"+"<td class='name'>"+SqwStockSearch.mark(r.getName(),this.previousInputValue)+"</td>"+"<td class='market'>"+r.getMarketName()+"</td>"+"<td class='currency'>"+r.getCurrency()+"<img src=\"/gifs/flag_"+r.getCurrency()+".gif\"></td>"+"</tr>");row.data("stockKey",key);row.data("searchResult",r);row.data("stock",Stock.stockSearchResult2Stock(key,r));table.append(row);}
return table;};prototype.setSelectedStock=function(stock){this.selectedStock=stock;};},{selectedStock:"Stock",container:"SqwJQuery",input:"SqwJQuery",results:"SqwJQuery",options:"SqwStockSearchOptions",interval:"TimeoutHandler",clickHandler:"EventHandler",arrowHandler:"EventHandler",clearKeyboardSelection:"EventHandler",selectedSearchResult:"SqwStockSearchResult"},{});
var DatePicker=function(startYear,endYear){this.datepicker=$(window.document.createElement("span"));this.minDate=new Date();this.minDate.setMilliseconds(0);this.minDate.setSeconds(0);this.minDate.setMinutes(0);this.minDate.setHours(0);this.minDate.setDate(1);this.minDate.setMonth(0);this.minDate.setFullYear(startYear);this.maxDate=new Date();this.maxDate.setMilliseconds(0);this.maxDate.setSeconds(0);this.maxDate.setMinutes(0);this.maxDate.setHours(0);this.maxDate.setDate(31);this.maxDate.setMonth(11);this.maxDate.setFullYear(endYear);this.dayPicker=this.createSelectElement(1,31);this.monthPicker=this.createSelectElement(1,12);this.yearPicker=this.createSelectElement(startYear,endYear);this.datepicker.append(this.dayPicker);this.datepicker.append(this.monthPicker);this.datepicker.append(this.yearPicker);};DatePicker=stjs.extend(DatePicker,null,[],function(constructor,prototype){prototype.datepicker=null;prototype.dayPicker=null;prototype.monthPicker=null;prototype.yearPicker=null;prototype.minDate=null;prototype.maxDate=null;prototype.getElement=function(){return this.datepicker;};prototype.addClass=function(classId){this.datepicker.addClass(classId);};prototype.createSelectElement=function(from,to){var selectElement=$(window.document.createElement("select"));if(from==null||to==null||isNaN(from)||isNaN(to)||from>to){return selectElement;}
for(var i=from;i<=to;i++){var currentOption=$(window.document.createElement("option"));currentOption.val(i);var text=String.valueOf(i);if(i<10){text="0"+text;}
currentOption.text(text);selectElement.append(currentOption);}
return selectElement;};prototype.getSelectedDate=function(){var dayElement=this.dayPicker.find(":selected");var monthElement=this.monthPicker.find(":selected");var yearElement=this.yearPicker.find(":selected");if(dayElement==null||monthElement==null||yearElement==null){return null;}
var day=parseInt(dayElement.text());var month=parseInt(monthElement.text());var year=parseInt(yearElement.text());if(day==null||month==null||year==null||isNaN(day)||isNaN(month)||isNaN(year)){return null;}
var date=new Date();date.setMilliseconds(0);date.setSeconds(0);date.setMinutes(0);date.setHours(0);date.setFullYear(year);date.setMonth(month-1);date.setDate(day);return date;};prototype.selectDateTime=function(timeValue){if(timeValue!=null){this.selectDate(DateUtil.createDate(timeValue));}};prototype.selectDate=function(toSelect){if(toSelect!=null){var day=stjs.trunc(toSelect.getDate());var month=stjs.trunc(toSelect.getMonth());var year=stjs.trunc(toSelect.getFullYear());this.dayPicker.val(day);this.monthPicker.val(month+1);this.yearPicker.val(year);}};},{datepicker:"SqwJQuery",dayPicker:"SqwJQuery",monthPicker:"SqwJQuery",yearPicker:"SqwJQuery",minDate:"Date",maxDate:"Date"},{});
var PeriodChooser=function(aTools){this.periodElements={};this.container=this.createPeriodsContainer(aTools);};PeriodChooser=stjs.extend(PeriodChooser,null,[],function(constructor,prototype){constructor.POPOVER_PERIODS_CSS_CLASS="chart-popover-periods-container";constructor.POPOVER_PERIODS_ELEMENT_CSS_CLASS="chart-popover-periods-element";constructor.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS="chart-popover-periods-selected-element";prototype.container=null;prototype.periodElements=null;prototype.selectedPeriod=null;prototype.getContainer=function(){return this.container;};prototype.isClickable=function(period){if(period!=null){return this.selectedPeriod!=period.toString();}else{return false;}};prototype.selectPeriod=function(period){if(this.selectedPeriod!=null){this.unselect(this.selectedPeriod);}
if(period!=null){this.selectedPeriod=period.toString();this.select(this.selectedPeriod);}else{this.selectedPeriod=null;}};prototype.select=function(periodParam){var element=this.periodElements[periodParam];if(element!=null){element.removeClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);element.addClass(PeriodChooser.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS);}};prototype.unselect=function(periodParam){var element=this.periodElements[periodParam];if(element!=null){element.removeClass(PeriodChooser.POPOVER_PERIODS_SELECTED_ELEMENT_CSS_CLASS);element.addClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);}};prototype.createPeriodsContainer=function(aTools){var container=SQW.$(window.document.createElement("div"));container.addClass(PeriodChooser.POPOVER_PERIODS_CSS_CLASS);var messagesRepo=ChartMessagesRepository.getInstance();this.createPeriodListElement(container,messagesRepo.get("intraday"),aTools,"live",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1week"),aTools,"5days","1minute");this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1month"),aTools,"month",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("6months"),aTools,"6months",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("1year"),aTools,"year",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("maximum"),aTools,"maximum",null);this.addTextToElement(container," | ");this.createPeriodListElement(container,messagesRepo.get("YTD"),aTools,"yearToDate",null);return container;};prototype.addTextToElement=function(parent,text){if(parent==null){return;}
var textNode=window.document.createTextNode(text);parent.append(textNode);};prototype.createPeriodListElement=function(parent,text,aTools,periodParam,freqParam){if(parent==null){return;}
var element=SQW.$(window.document.createElement("span"));element.addClass(PeriodChooser.POPOVER_PERIODS_ELEMENT_CSS_CLASS);element.text(text);var period=Period.getInstance(periodParam,null);var self=this;var onClickHandler=stjs.bind(this,function(ev,THIS){if(self.isClickable(period)){self.selectPeriod(period);aTools.selectPeriod(periodParam,freqParam);}
return false;},1);element.on("click",onClickHandler);this.periodElements[period.toString()]=element;parent.append(element);};prototype.show=function(){this.container.show();};prototype.hide=function(){this.container.hide();};},{container:"SqwJQuery",periodElements:{name:"Map",arguments:[null,"SqwJQuery"]}},{});
var FinancialPopover=function(){this.pageReloadDelayed=false;this.customPeriod=false;this.currentChartContainerHeight=-1;this.overlay=SQW.$(window.document.createElement("div"));this.overlay.addClass(FinancialPopover.POPOVER_OVERLAY_CSS_CLASS);this.overlay.on("click",this.getOnCloseEventHandler());this.closeBox=SQW.$(window.document.createElement("div"));this.closeBox.addClass(FinancialPopover.POPOVER_CLOSE_BOX_CSS_CLASS);this.closeBox.on("click",this.getOnCloseEventHandler());this.atoolsContainer=SQW.$(window.document.createElement("div"));this.atoolsContainer.addClass(FinancialPopover.POPOVER_WINDOW_CSS_CLASS);this.periodChooser=new PeriodChooser(this);this.periodsContainer=this.periodChooser.getContainer();this.wrapperElement=SQW.$(window.document.createElement("div"));this.wrapperElement.addClass(FinancialPopover.POPOVER_WRAPPER_CSS_CLASS);this.wrapperElement.append(this.overlay);this.wrapperElement.append(this.atoolsContainer);this.hide();SQW.$(window.document.body).append(this.wrapperElement);SQW.$(window).resize(this.getOnResizeEventHandler());this.centerContainer();this.atoolsContainer.append(this.closeBox);this.addChart(FinancialPopover.POPOVER_CHART_PARENT_CSS_CLASS);this.atoolsContainer.append(this.periodsContainer);var now=new Date();this.compareBox=new CompareBoxPopover(this.getCompareCallback(),1998,parseInt(now.getFullYear()));this.atoolsContainer.append(this.compareBox.getBox());};FinancialPopover=stjs.extend(FinancialPopover,null,[PopOver,Observer],function(constructor,prototype){constructor.POPOVER_OVERLAY_CSS_CLASS="chart-popover-overlay";constructor.POPOVER_WINDOW_CSS_CLASS="chart-popover-window";constructor.POPOVER_CHART_PARENT_CSS_CLASS="chart-popover-parent";constructor.POPOVER_WRAPPER_CSS_CLASS="chart-popover-wrapper";constructor.POPOVER_CLOSE_BOX_CSS_CLASS="chart-popover-close-box";constructor.MARGIN=60;prototype.currentChartContainerHeight=0;prototype.wrapperElement=null;prototype.overlay=null;prototype.atoolsContainer=null;prototype.closeBox=null;prototype.compareBox=null;prototype.periodChooser=null;prototype.periodsContainer=null;prototype.chartParent=null;prototype.chart=null;constructor.instance=null;prototype.resizeTimer=null;prototype.pageReloadFunctionId=null;prototype.pageReloadDelayed=false;prototype.pageReloadFunction=null;prototype.periodBoxStartTime=null;prototype.periodBoxEndTime=null;prototype.customPeriod=false;prototype.centerContainer=function(){var chartWidth=this.atoolsContainer.width();var chartHeight=this.atoolsContainer.height();var availableWidth=SQW.$(window).width();var availableHeight=SQW.$(window).height();if(chartWidth<availableWidth&&chartHeight<availableHeight){this.atoolsContainer.css("position","fixed");}else{this.atoolsContainer.css("position","absolute");}};prototype.getOnResizeEventHandler=function(){var self=this;return stjs.bind(this,function(ev,THIS){clearTimeout(self.resizeTimer);var recenterContainer=function(){self.centerContainer();return false;};self.resizeTimer=setTimeout(recenterContainer,100);return true;},1);};prototype.getCompareCallback=function(){var self=this;return function(compareStocks,datePeriod){var mainChart=self.chart;var options=mainChart.getChartOption();var stocks=options.getStocks();if(stocks==null||stocks.length<=0||compareStocks==null||compareStocks.length<=0){return;}
var mainStock=stocks[0];var newStocks=[mainStock];var compareCount=compareStocks!=null?compareStocks.length:0;for(var i=0;i<compareCount;i++){var currentStock=compareStocks[i];if(currentStock!=null){newStocks.push(currentStock);}}
if(datePeriod!=null){var startDate=datePeriod[0];var endDate=datePeriod[1];if(startDate==null){startDate=DateUtil.createDate(mainChart.getChartData().getMinXValue());}
if(endDate==null){endDate=DateUtil.createDate(mainChart.getChartData().getMaxXValue());}
var startTime=startDate.getTime();var endTime=endDate.getTime();if(startTime>endTime){var tmp=endTime;var tmpDate=endDate;endTime=startTime;startTime=tmp;endDate=startDate;startDate=tmpDate;}
var currentPeriod=mainChart.getPeriod();options.setStocks(newStocks);if(currentPeriod==null||!currentPeriod.isIntraday()||currentPeriod.getFrom()==null||currentPeriod.getTo()==null||!DateUtil.isSameDay(currentPeriod.getFrom(),startDate)||!DateUtil.isSameDay(currentPeriod.getTo(),endDate)){var wrapperPeriod=Period.getInstanceBetweenDates(startDate,endDate);mainChart.setPeriod(wrapperPeriod);self.periodBoxStartTime=startTime;self.periodBoxEndTime=endTime+DateUtil.MS_DAY_24H-1;self.customPeriod=true;}else if(mainChart.getDataProvider()!=null){mainChart.getDataProvider().updateConfig(options);self.periodBoxStartTime=null;self.periodBoxEndTime=null;self.customPeriod=false;}
var zoomHistory=[];mainChart.setZoomHistory(zoomHistory);mainChart.setZoomLevel(null);mainChart.refresh();}};};prototype.addChart=function(chartParentClass){this.chartParent=SQW.$(window.document.createElement("div"));this.chartParent.addClass(chartParentClass);this.atoolsContainer.append(this.chartParent);var optionsParam=SQW.$.extend(true,{},FinancialChartOption.getDefaultFinancialChartOption());optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setShowVolume(true);this.chart=new FinancialChart(this.chartParent,optionsParam);};prototype.init=function(trigger){this.updateView(trigger.getChartOption());this.initActiveChart(trigger);var data=trigger.getChartData();if(data!=null){this.compareBox.setPeriod(data.getMinXValue(),data.getMaxXValue());}
var serie=data.getMainSerie();this.periodChooser.selectPeriod(serie.getPeriod());};prototype.updateView=function(chartOption){var percent=100;if(chartOption.isShowCompareBox()){this.compareBox.show();percent=70;}else{this.compareBox.hide();}
var periodHeight=0;if(chartOption.isShowPeriodMenu()){this.periodChooser.show();periodHeight=this.periodChooser.getContainer().height();}else{this.periodChooser.hide();}
var absPixelToRemove=periodHeight+FinancialPopover.MARGIN;this.chartParent.css("height","calc("+percent+"% - "+absPixelToRemove+"px)");};constructor.getInstance=function(){if(FinancialPopover.instance==null){FinancialPopover.instance=new FinancialPopover();}
return FinancialPopover.instance;};prototype.open=function(trigger){this.delayPageReload(trigger.getChartOption());Chart.pauseAll();this.init(trigger);this.show();this.chart.unpause();this.chart.refresh();};prototype.close=function(){this.managePageReload();this.chart.getChartData().detachAll();this.hide();this.compareBox.blur();Chart.unpauseAll();this.chart.pause();};prototype.show=function(){this.overlay.css("display","block");this.wrapperElement.css("visibility","visible");};prototype.hide=function(){this.overlay.css("display","none");this.wrapperElement.css("visibility","hidden");};prototype.getOnCloseEventHandler=function(){var self=this;var eh=stjs.bind(this,function(ev,THIS){self.close();return false;},1);return eh;};prototype.delayPageReload=function(option){this.pageReloadFunctionId=option.getReloadFunctionId();if(this.pageReloadFunctionId!=null&&(typeof SQW.$(window).prop(this.pageReloadFunctionId))!="undefined"){this.pageReloadFunction=SQW.$(window).prop(this.pageReloadFunctionId);var self=this;var delayedReloadPageFunction=function(){self.pageReloadDelayed=true;return null;};SQW.$(window).prop(this.pageReloadFunctionId,delayedReloadPageFunction);}};prototype.managePageReload=function(){if(this.pageReloadFunctionId!=null&&(typeof SQW.$(window).prop(this.pageReloadFunctionId))!="undefined"){SQW.$(window).prop(this.pageReloadFunctionId,this.pageReloadFunction);if(this.pageReloadDelayed&&this.pageReloadFunction!=null){this.pageReloadFunction();}}};prototype.initActiveChart=function(trigger){if(trigger==null){return;}
var initialSetting=trigger.getChartOption();var optionsParam=FinancialChartOption.extendFinancialChartOption(initialSetting);optionsParam.setDisplayAtStartup(false);optionsParam.setPopOverAllowed(false);optionsParam.setAnimateChart(false);optionsParam.setShowVolume(true);optionsParam.setStyleModel(initialSetting.getCustomStyleModel());optionsParam.setEngineModel(initialSetting.getCustomEngineModel());optionsParam.setLayout(new FinancialLayout());optionsParam.setShowCopyright(false);optionsParam.setWidthParam("10000");optionsParam.setXAxisPosition(Layout.Position.BOTTOM);optionsParam.setY1AxisPosition(Layout.Position.RIGHT);optionsParam.setY2AxisPosition(Layout.Position.LEFT);optionsParam.setShowLegend(optionsParam.isShowLegendInPopover());var provider=DataProviderFactory.getInstance().getProvider(initialSetting);var newProvider=provider.clone();var providerClass="popOverProvider";DataProviderFactory.getInstance().registerProvider(providerClass,newProvider);optionsParam.setProviderClass(providerClass);this.chartParent.empty();this.chart.init(this.chartParent,optionsParam);this.chart.getChartData().attach(this);};prototype.getId=function(){return"aTools";};prototype.update=function(newData){if(this.periodBoxStartTime!=null||this.periodBoxEndTime!=null){if(this.periodBoxStartTime==null){this.periodBoxStartTime=newData.getMinXValue();}
if(this.periodBoxEndTime==null){this.periodBoxEndTime=newData.getMaxXValue();}
var data=this.chart.getChartData();this.compareBox.setPeriod(this.periodBoxStartTime,this.periodBoxEndTime);if(this.customPeriod){this.periodChooser.selectPeriod(null);}else{this.periodChooser.selectPeriod(this.chart.getPeriod());}
this.periodBoxStartTime=null;this.periodBoxEndTime=null;this.chart.setZoomLevel(null);this.chart.render(null);}else{this.compareBox.setPeriod(newData.getMinXValue(),newData.getMaxXValue());var zoomLevel=this.chart.getZoomLevel();this.chart.setZoomLevel(zoomLevel);this.chart.render(zoomLevel);this.periodChooser.selectPeriod(this.chart.getPeriod());}};prototype.selectPeriod=function(periodParam,freqParam){if(this.chart!=null){this.customPeriod=false;this.chart.updatePeriodAndFrequency(periodParam,freqParam);this.periodBoxStartTime=null;this.periodBoxEndTime=null;this.chart.reset();}};},{wrapperElement:"SqwJQuery",overlay:"SqwJQuery",atoolsContainer:"SqwJQuery",closeBox:"SqwJQuery",compareBox:"CompareBoxPopover",periodChooser:"PeriodChooser",periodsContainer:"SqwJQuery",chartParent:"SqwJQuery",chart:"FinancialChart",instance:"FinancialPopover",resizeTimer:"TimeoutHandler",pageReloadFunction:"Function0"},{});
var DefaultDelimiterStyle=function(option){Style.call(this,option);this.visible=option.isGraphHeightModifiable();this.backgroundColor=option.getDelimiterHighlightColor();this.setAbsoluteHeight(option.getDelimiterHeightPixels());if(this.backgroundColor==null){this.backgroundColor=ChartColor.orange;}};DefaultDelimiterStyle=stjs.extend(DefaultDelimiterStyle,Style,[],null,{style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var DefaultVolumeGraphStyle=function(options){DefaultBarGraphStyle.call(this,options);this.visible=options.isShowVolume();this.setHeightRatio(options.getVolumeHeightRatio());this.halfSpacing=options.getGraphsHalfSpacing();};DefaultVolumeGraphStyle=stjs.extend(DefaultVolumeGraphStyle,DefaultBarGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
var FinancialStyleModel=function(){DefaultStyleModel.call(this);};FinancialStyleModel=stjs.extend(FinancialStyleModel,DefaultStyleModel,[],function(constructor,prototype){prototype.bottomLeftAxisStyle=null;prototype.bottomRightAxisStyle=null;prototype.bottomGraphStyle=null;prototype.delimiterStyle=null;prototype.init=function(options){DefaultStyleModel.prototype.init.call(this,options);this.bottomLeftAxisStyle=new DefaultYAxisStyle(options);this.bottomLeftAxisStyle.setPosition(options.getVolumeAxisPosition());this.bottomLeftAxisStyle.setVisible(options.getVolumeAxisPosition()!=Layout.Position.NONE);this.bottomRightAxisStyle=new DefaultYAxisStyle(options);this.bottomRightAxisStyle.setPosition(Layout.Position.RIGHT);this.bottomRightAxisStyle.setVisible(false);this.bottomGraphStyle=new DefaultVolumeGraphStyle(options);this.delimiterStyle=new DefaultDelimiterStyle(options);if(this.titleStyle!=null&&options.getTitleType()==null){this.titleStyle.setType(TitleStyle.SHOW_VALUE_VOLUME);}
var customStyleModel=options.getCustomStyleModel();if(customStyleModel!=null){if((customStyleModel)["init"]!=null){options.setCustomeStyleModel(null);customStyleModel.init(options);options.setCustomeStyleModel(customStyleModel);}
var validStyles={};var tmp={};this.extendStyle(customStyleModel,validStyles,"titleStyle");this.extendStyle(customStyleModel,validStyles,"xAxisStyle");this.extendStyle(customStyleModel,validStyles,"y1AxisStyle");this.extendStyle(customStyleModel,validStyles,"y2AxisStyle");this.extendStyle(customStyleModel,validStyles,"graphStyle");this.extendStyle(customStyleModel,validStyles,"legendStyle");this.extendStyle(customStyleModel,validStyles,"tooltipStyle");this.extendStyle(customStyleModel,validStyles,"drawStyle");this.extendStyle(customStyleModel,validStyles,"bottomLeftAxisStyle");this.extendStyle(customStyleModel,validStyles,"bottomRightAxisStyle");this.extendStyle(customStyleModel,validStyles,"bottomGraphStyle");this.extendStyle(customStyleModel,validStyles,"delimiterStyle");SQW.$.extend(true,tmp,customStyleModel,validStyles);SQW.$.extend(true,this,tmp);}
this.styles[DefaultLayout.TITLE_AREA]=this.titleStyle;this.styles[DefaultLayout.X_AXIS_AREA]=this.xAxisStyle;this.styles[DefaultLayout.Y1_AXIS_AREA]=this.y1AxisStyle;this.styles[DefaultLayout.Y2_AXIS_AREA]=this.y2AxisStyle;this.styles[DefaultLayout.GRAPH_AREA]=this.graphStyle;this.styles[DefaultLayout.LEGEND_AREA]=this.legendStyle;this.styles[DefaultLayout.TOOLTIP_AREA]=this.tooltipStyle;this.styles[DrawStyle.ID]=this.drawStyle;this.styles[FinancialLayout.BOTTOM_AXIS_LEFT]=this.bottomLeftAxisStyle;this.styles[FinancialLayout.BOTTOM_AXIS_RIGHT]=this.bottomRightAxisStyle;this.styles[FinancialLayout.BOTTOM_GRAPH_AREA]=this.bottomGraphStyle;this.styles[FinancialLayout.DELIMITER_AREA]=this.delimiterStyle;};prototype.extend=function(options){};},{bottomLeftAxisStyle:"AxisStyle",bottomRightAxisStyle:"AxisStyle",bottomGraphStyle:"GraphStyle",delimiterStyle:"Style",globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
var FinancialLayout=function(){DefaultLayout.call(this);this.showBottomArea=true;};FinancialLayout=stjs.extend(FinancialLayout,DefaultLayout,[],function(constructor,prototype){constructor.BOTTOM_AXIS_LEFT="bottomLeftAxisAreaId";constructor.BOTTOM_AXIS_RIGHT="bottomRightAxisAreaId";constructor.BOTTOM_GRAPH_AREA="bottomGraphAreaId";constructor.DELIMITER_AREA="delimiterAreaId";prototype.showBottomArea=false;prototype.init=function(styleModel){DefaultLayout.prototype.init.call(this,styleModel);this.addArea(FinancialLayout.BOTTOM_AXIS_LEFT,ChartView.AreaType.AXIS,styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_LEFT));this.addArea(FinancialLayout.BOTTOM_AXIS_RIGHT,ChartView.AreaType.AXIS,styleModel.getStyle(FinancialLayout.BOTTOM_AXIS_RIGHT));this.addArea(FinancialLayout.BOTTOM_GRAPH_AREA,ChartView.AreaType.GRAPH,styleModel.getStyle(FinancialLayout.BOTTOM_GRAPH_AREA));this.addArea(FinancialLayout.DELIMITER_AREA,ChartView.AreaType.CUSTOM,styleModel.getStyle(FinancialLayout.DELIMITER_AREA));};prototype.updateYAxis=function(){DefaultLayout.prototype.updateYAxis.call(this);this.updateBottomAxis(FinancialLayout.BOTTOM_AXIS_LEFT);this.updateBottomAxis(FinancialLayout.BOTTOM_AXIS_RIGHT);var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];delimiterAreaBound.setLeft(graphAreaBound.getLeft());delimiterAreaBound.setWidth(graphAreaBound.getWidth());};prototype.updateBottomAxis=function(bottomAxisId){var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var bottomAxisStyle=this.areasStyle[bottomAxisId];var bottomAxisPosition=bottomAxisStyle.getPosition();var graphAreaBound=this.areasBound[DefaultLayout.GRAPH_AREA];var bottomGraphBound=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomAxisBound=this.areasBound[bottomAxisId];var mainAxisSameSideAsBottom=null;var mainAxisBoundsSameSide=null;var mainAxisCurrentWidth=0;if(y1AxisStyle.getPosition()==bottomAxisPosition){mainAxisSameSideAsBottom=y1AxisStyle;mainAxisBoundsSameSide=this.areasBound[DefaultLayout.Y1_AXIS_AREA];mainAxisCurrentWidth=mainAxisBoundsSameSide.getWidth();}else if(y2AxisStyle.getPosition()==bottomAxisPosition){mainAxisSameSideAsBottom=y2AxisStyle;mainAxisBoundsSameSide=this.areasBound[DefaultLayout.Y2_AXIS_AREA];mainAxisCurrentWidth=mainAxisBoundsSameSide.getWidth();}
var bottomAxisNewWidth=bottomAxisStyle!=null?bottomAxisStyle.getWidth(this.currentWidth):0;if(bottomAxisPosition==Layout.Position.NONE){bottomGraphBound.setLeft(graphAreaBound.getLeft());bottomGraphBound.setWidth(graphAreaBound.getWidth());}else if(mainAxisSameSideAsBottom!=null&&mainAxisBoundsSameSide!=null&&mainAxisCurrentWidth<=mainAxisCurrentWidth){bottomGraphBound.setLeft(graphAreaBound.getLeft());bottomGraphBound.setWidth(graphAreaBound.getWidth());bottomAxisBound.setLeft(mainAxisBoundsSameSide.getLeft());bottomAxisBound.setWidth(mainAxisBoundsSameSide.getWidth());}else{var newAxisLeft=mainAxisBoundsSameSide!=null?mainAxisBoundsSameSide.getLeft():bottomAxisBound.getLeft();var widthDiff=bottomAxisNewWidth-mainAxisCurrentWidth;var newChartLeft=graphAreaBound.getLeft();var newChartWidth=graphAreaBound.getWidth()-widthDiff;if(bottomAxisPosition==Layout.Position.LEFT){newChartLeft+=widthDiff;}else{newAxisLeft-=widthDiff;}
graphAreaBound.setLeft(newChartLeft);graphAreaBound.setWidth(newChartWidth);bottomGraphBound.setLeft(newChartLeft);bottomGraphBound.setWidth(newChartWidth);bottomAxisBound.setLeft(newAxisLeft);bottomAxisBound.setWidth(bottomAxisNewWidth);if(mainAxisBoundsSameSide!=null){mainAxisBoundsSameSide.setLeft(newAxisLeft);mainAxisBoundsSameSide.setWidth(bottomAxisNewWidth);}
var titleAreaBound=this.areasBound[DefaultLayout.TITLE_AREA];titleAreaBound.setLeft(newChartLeft);titleAreaBound.setWidth(newChartWidth);var xAreaBound=this.areasBound[DefaultLayout.X_AXIS_AREA];xAreaBound.setLeft(newChartLeft);xAreaBound.setWidth(newChartWidth);var legendAreaBound=this.areasBound[DefaultLayout.LEGEND_AREA];legendAreaBound.setLeft(newChartLeft);legendAreaBound.setWidth(newChartWidth);}};prototype.refresh=function(chartView,width,height){DefaultLayout.prototype.refresh.call(this,chartView,width,height);var bottomGraphStyle=this.areasStyle[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomGraphBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomLeftAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];if(!this.showBottomArea){bottomGraphBounds.setVisible(false);bottomLeftAxisBounds.setVisible(false);bottomRightAxisBounds.setVisible(false);delimiterAreaBound.setVisible(false);return;}
var chartAreaBounds=this.areasBound[DefaultLayout.GRAPH_AREA];var titleAreaBounds=this.areasBound[DefaultLayout.TITLE_AREA];var xAxisAreaBounds=this.areasBound[DefaultLayout.X_AXIS_AREA];var y1AxisAreaBounds=this.areasBound[DefaultLayout.Y1_AXIS_AREA];var y2AxisAreaBounds=this.areasBound[DefaultLayout.Y2_AXIS_AREA];var y1AxisStyle=this.areasStyle[DefaultLayout.Y1_AXIS_AREA];var y2AxisStyle=this.areasStyle[DefaultLayout.Y2_AXIS_AREA];var bottomLeftAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterStyle=this.areasStyle[FinancialLayout.DELIMITER_AREA];var chartLeftPos=chartAreaBounds.getLeft();var chartWidth=chartAreaBounds.getWidth();var newChartHeight=chartAreaBounds.getHeight();var chartOuterHeight=stjs.trunc(chartAreaBounds.getOuterHeight(true));var totalBottomHeight=bottomGraphStyle.getHeight(chartOuterHeight);var delimiterHeight=delimiterStyle.getHeight(chartOuterHeight);var topHalfSpacing=delimiterHeight/2.0;var bottomHalfSpacing=topHalfSpacing;if(delimiterHeight==null||delimiterHeight<0){delimiterHeight=0;topHalfSpacing=0.0;bottomHalfSpacing=0.0;}
if(totalBottomHeight==null||totalBottomHeight<bottomHalfSpacing){totalBottomHeight=0.0;topHalfSpacing=delimiterHeight;bottomHalfSpacing=0.0;bottomGraphBounds.setVisible(false);bottomLeftAxisBounds.setVisible(false);bottomRightAxisBounds.setVisible(false);}else{bottomGraphBounds.setVisible(true);bottomLeftAxisBounds.setVisible(true);bottomRightAxisBounds.setVisible(true);}
if(totalBottomHeight!=null&&(chartOuterHeight-totalBottomHeight)<topHalfSpacing){newChartHeight=0.0;topHalfSpacing=0.0;totalBottomHeight=chartOuterHeight;bottomHalfSpacing=delimiterHeight;chartAreaBounds.setVisible(false);y1AxisAreaBounds.setVisible(false);y2AxisAreaBounds.setVisible(false);}else{newChartHeight-=totalBottomHeight;newChartHeight-=topHalfSpacing;chartAreaBounds.setVisible(true);y1AxisAreaBounds.setVisible(true);y2AxisAreaBounds.setVisible(true);}
totalBottomHeight-=bottomHalfSpacing;chartAreaBounds.setHeight(newChartHeight);var topGraphHeight=newChartHeight>0?chartAreaBounds.getOuterHeight(true):0.0;var bottomYStartPos=chartAreaBounds.getTop()+topGraphHeight+delimiterHeight;var leftMainAxis=null;var rightMainAxis=null;if(y1AxisAreaBounds!=null){y1AxisAreaBounds.setHeight(newChartHeight);if(y1AxisStyle.getPosition()==Layout.Position.LEFT){leftMainAxis=y1AxisAreaBounds;}else{rightMainAxis=y1AxisAreaBounds;}}
if(y2AxisAreaBounds!=null){y2AxisAreaBounds.setHeight(newChartHeight);if(y2AxisStyle.getPosition()==Layout.Position.LEFT){leftMainAxis=y2AxisAreaBounds;}else{rightMainAxis=y2AxisAreaBounds;}}
var bottomLeftAxisWidth=0;var bottomLeftAxisLeftPos=0;var bottomLeftAxisLeftPadding=0;var bottomLeftAxisRightPadding=0;var addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&bottomLeftAxisStyle.isShowAxisTicks();var bottomLeftAxisPosition=bottomLeftAxisStyle.getPosition();if(bottomLeftAxisPosition!=Layout.Position.NONE){if(bottomLeftAxisPosition==Layout.Position.LEFT){if(leftMainAxis!=null){bottomLeftAxisLeftPos=leftMainAxis.getLeft();bottomLeftAxisWidth=leftMainAxis.getWidth();bottomLeftAxisLeftPadding=leftMainAxis.getPaddingLeft();bottomLeftAxisRightPadding=leftMainAxis.getPaddingRight();}else{var currentAxisWidth=bottomLeftAxisStyle.getWidth(width);if(currentAxisWidth==null){bottomLeftAxisWidth=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,bottomLeftAxisStyle.getFont(),bottomLeftAxisStyle.getFontSize(),false);}else{bottomLeftAxisWidth=currentAxisWidth;}
bottomLeftAxisLeftPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;bottomLeftAxisRightPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;if(addSpaceForTicks){bottomLeftAxisRightPadding+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
var bottomLeftAxisOuterWidth=bottomLeftAxisWidth+bottomLeftAxisLeftPadding+bottomLeftAxisRightPadding;chartWidth-=bottomLeftAxisOuterWidth;bottomLeftAxisLeftPos=chartLeftPos;chartLeftPos+=bottomLeftAxisOuterWidth;chartAreaBounds.setLeft(chartLeftPos);chartAreaBounds.setWidth(chartWidth);titleAreaBounds.setLeft(chartLeftPos);titleAreaBounds.setWidth(chartWidth);xAxisAreaBounds.setLeft(chartLeftPos);xAxisAreaBounds.setWidth(chartWidth);}}else{bottomLeftAxisWidth=0;}}
var bottomRightAxisWidth=0;var bottomRightAxisLeftPos=0;var bottomRightAxisLeftPadding=0;var bottomRightAxisRightPadding=0;addSpaceForTicks=width>=DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT&&bottomRightAxisStyle.isShowAxisTicks();var bottomRightAxisPosition=bottomRightAxisStyle.getPosition();if(bottomRightAxisPosition!=Layout.Position.NONE){if(bottomRightAxisPosition==Layout.Position.RIGHT){if(rightMainAxis!=null){bottomRightAxisLeftPos=rightMainAxis.getLeft();bottomRightAxisWidth=rightMainAxis.getWidth();bottomRightAxisLeftPadding=rightMainAxis.getPaddingLeft();bottomRightAxisRightPadding=rightMainAxis.getPaddingRight();}else{var currentBottomAxisWidth=bottomRightAxisStyle.getWidth(width);if(currentBottomAxisWidth==null){bottomRightAxisWidth=chartView.getLabelWidth(DefaultLayout.DEFAULT_LABEL_VALUE,bottomRightAxisStyle.getFont(),bottomRightAxisStyle.getFontSize(),false);}else{bottomRightAxisWidth=currentBottomAxisWidth;}
bottomRightAxisLeftPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;bottomRightAxisRightPadding=DefaultLayout.DEFAULT_PADDING_PIXELS;if(addSpaceForTicks){bottomRightAxisLeftPadding+=DefaultLayout.DEFAULT_PADDING_PIXELS;}
var bottomRightAxisOuterWidth=bottomRightAxisWidth+bottomRightAxisLeftPadding+bottomRightAxisRightPadding;chartWidth-=bottomRightAxisOuterWidth;chartAreaBounds.setWidth(chartWidth);titleAreaBounds.setWidth(chartWidth);xAxisAreaBounds.setWidth(chartWidth);bottomRightAxisLeftPos=chartLeftPos+chartAreaBounds.getOuterWidth(true);}}else{bottomRightAxisWidth=0;}}
var contentHeight=totalBottomHeight;var paddingLeft=chartAreaBounds.getPaddingLeft();var paddingRight=chartAreaBounds.getPaddingRight();var paddingTop=chartAreaBounds.getPaddingBottom();var paddingBottom=0;contentHeight-=(paddingTop+paddingBottom);var marginLeft=chartAreaBounds.getMarginLeft();var marginRight=chartAreaBounds.getMarginRight();var marginTop=0;var marginBottom=0;contentHeight-=(marginTop+marginBottom);var borderLeft=chartAreaBounds.getBorderLeft();var borderRight=chartAreaBounds.getBorderRight();var borderTop=chartAreaBounds.getBorderTop();var borderBottom=chartAreaBounds.getBorderBottom();contentHeight-=(borderTop+borderBottom);bottomGraphBounds.reset();bottomGraphBounds.setLeft(chartLeftPos);bottomGraphBounds.setTop(bottomYStartPos);bottomGraphBounds.setWidth(chartWidth);bottomGraphBounds.setHeight(contentHeight);bottomGraphBounds.setPaddings(paddingLeft,paddingTop,paddingRight,paddingBottom);bottomGraphBounds.setMargins(marginLeft,marginTop,marginRight,marginBottom);bottomGraphBounds.setBorders(borderLeft,borderTop,borderRight,borderBottom);delimiterAreaBound.reset();delimiterAreaBound.setLeft(chartLeftPos);delimiterAreaBound.setTop(bottomYStartPos-delimiterHeight);delimiterAreaBound.setWidth(chartWidth);delimiterAreaBound.setHeight(delimiterHeight);delimiterAreaBound.setPaddings(paddingLeft,0,paddingRight,0);delimiterAreaBound.setBorders(borderLeft,0,borderRight,0);bottomLeftAxisBounds.reset();bottomLeftAxisBounds.setLeft(bottomLeftAxisLeftPos);bottomLeftAxisBounds.setTop(bottomYStartPos);bottomLeftAxisBounds.setWidth(bottomLeftAxisWidth);bottomLeftAxisBounds.setHeight(contentHeight);bottomLeftAxisBounds.setPaddingLeft(bottomLeftAxisLeftPadding);bottomLeftAxisBounds.setPaddingRight(bottomLeftAxisRightPadding);bottomLeftAxisBounds.setPaddingTop(paddingTop);bottomLeftAxisBounds.setPaddingBottom(paddingBottom);bottomLeftAxisBounds.setMarginTop(borderTop+marginTop);bottomLeftAxisBounds.setMarginBottom(borderBottom+marginBottom+DefaultLayout.DEFAULT_PADDING_PIXELS);bottomRightAxisBounds.reset();bottomRightAxisBounds.setLeft(bottomRightAxisLeftPos);bottomRightAxisBounds.setTop(bottomYStartPos);bottomRightAxisBounds.setWidth(bottomRightAxisWidth);bottomRightAxisBounds.setHeight(contentHeight);bottomRightAxisBounds.setPaddingLeft(bottomRightAxisLeftPadding);bottomRightAxisBounds.setPaddingRight(bottomRightAxisRightPadding);bottomRightAxisBounds.setPaddingTop(paddingTop);bottomRightAxisBounds.setPaddingBottom(paddingBottom);bottomRightAxisBounds.setMarginTop(borderTop+marginTop);bottomRightAxisBounds.setMarginBottom(borderBottom+marginBottom+DefaultLayout.DEFAULT_PADDING_PIXELS);if(bottomRightAxisWidth<=0){bottomRightAxisBounds.setVisible(false);}};prototype.setShowBottomGraph=function(showBottomGraph){this.showBottomArea=showBottomGraph;var bottomGraphBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];var bottomLeftAxisBounds=this.areasBound[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisAreaBound=this.areasBound[FinancialLayout.BOTTOM_AXIS_RIGHT];var delimiterAreaBound=this.areasBound[FinancialLayout.DELIMITER_AREA];bottomGraphBounds.setVisible(showBottomGraph);bottomLeftAxisBounds.setVisible(showBottomGraph);bottomRightAxisAreaBound.setVisible(showBottomGraph);delimiterAreaBound.setVisible(showBottomGraph);};prototype.isShowBottomGraph=function(){return this.showBottomArea;};prototype.updateFontsSize=function(width,height){var currentFontSize=this.currentFontSize;DefaultLayout.prototype.updateFontsSize.call(this,width,height);var bottomLeftAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_LEFT];var bottomRightAxisStyle=this.areasStyle[FinancialLayout.BOTTOM_AXIS_RIGHT];if(width<DefaultLayout.MINIMUM_WIDTH_FOR_NORMAL_FONT||height<DefaultLayout.MINIMUM_HEIGHT_FOR_NORMAL_FONT){if(currentFontSize!=DefaultLayout.SMALL_FONTS){bottomLeftAxisStyle.setFontSize(bottomLeftAxisStyle.getFontSize()-1);bottomLeftAxisStyle.setLabelsHeight(bottomLeftAxisStyle.getFontSize()+2);bottomRightAxisStyle.setFontSize(bottomRightAxisStyle.getFontSize()-1);bottomRightAxisStyle.setLabelsHeight(bottomRightAxisStyle.getFontSize()+2);}}else{if(currentFontSize!=DefaultLayout.NORMAL_FONTS){bottomLeftAxisStyle.setFontSize(bottomLeftAxisStyle.getFontSize()+1);bottomLeftAxisStyle.setLabelsHeight(bottomLeftAxisStyle.getFontSize()+2);bottomRightAxisStyle.setFontSize(bottomRightAxisStyle.getFontSize()+1);bottomRightAxisStyle.setLabelsHeight(bottomRightAxisStyle.getFontSize()+2);}}};prototype.moveDelimiter=function(newY){var bottomGraphStyle=this.areasStyle[FinancialLayout.BOTTOM_GRAPH_AREA];var delimiterBounds=this.areasBound[FinancialLayout.DELIMITER_AREA];if(delimiterBounds!=null&&delimiterBounds.isVisible()){var topGraphAreaBounds=this.areasBound[DefaultLayout.GRAPH_AREA];var bottomGraphAreaBounds=this.areasBound[FinancialLayout.BOTTOM_GRAPH_AREA];if(bottomGraphAreaBounds==null||!bottomGraphAreaBounds.isVisible()){bottomGraphAreaBounds=topGraphAreaBounds;}
if(topGraphAreaBounds==null||!topGraphAreaBounds.isVisible()){topGraphAreaBounds=bottomGraphAreaBounds;}
if(topGraphAreaBounds==null){return;}
var minY=topGraphAreaBounds.getTop();var maxY=(bottomGraphAreaBounds.getTop()+bottomGraphAreaBounds.getOuterHeight(true)-delimiterBounds.getHeight());var validYPos=newY;if(newY<minY){validYPos=minY;}else if(newY>maxY){validYPos=maxY;}
var heightRatio=1.0-(validYPos-minY)/(maxY-minY);bottomGraphStyle.setHeightRatio(heightRatio);}};},{areasStyle:{name:"Map",arguments:[null,"Style"]},areasBound:{name:"Map",arguments:[null,"AreaBound"]},globalStyle:"GlobalStyle",areas:{name:"Map",arguments:[null,"Area"]}},{});
var dateFormat=function(){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return function(date,mask,utc){var dF=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(date)=="[object String]"&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date;if(isNaN(date))throw SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}
var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(mask,utc){return dateFormat(this,mask,utc);};
/**
 * React v0.14.7
 *
 * Copyright 2013-2015, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){"use strict";var r=e(35),o=e(45),a=e(61),i=e(23),u=e(104),s={};i(s,a),i(s,{findDOMNode:u("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:u("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:u("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:u("renderToString","ReactDOMServer","react-dom/server",o,o.renderToString),renderToStaticMarkup:u("renderToStaticMarkup","ReactDOMServer","react-dom/server",o,o.renderToStaticMarkup)}),s.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,s.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=o,t.exports=s},{104:104,23:23,35:35,45:45,61:61}],2:[function(e,t,n){"use strict";var r=e(63),o=e(106),a=e(136),i={componentDidMount:function(){this.props.autoFocus&&a(o(this))}},u={Mixin:i,focusDOMComponent:function(){a(r.getNode(this._rootNodeID))}};t.exports=u},{106:106,136:136,63:63}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function a(e){switch(e){case w.topCompositionStart:return R.compositionStart;case w.topCompositionEnd:return R.compositionEnd;case w.topCompositionUpdate:return R.compositionUpdate}}function i(e,t){return e===w.topKeyDown&&t.keyCode===_}function u(e,t){switch(e){case w.topKeyUp:return-1!==b.indexOf(t.keyCode);case w.topKeyDown:return t.keyCode!==_;case w.topKeyPress:case w.topMouseDown:case w.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r,o){var l,c;if(E?l=a(e):S?u(e,r)&&(l=R.compositionEnd):i(e,r)&&(l=R.compositionStart),!l)return null;M&&(S||l!==R.compositionStart?l===R.compositionEnd&&S&&(c=S.getData()):S=m.getPooled(t));var p=g.getPooled(l,n,r,o);if(c)p.data=c;else{var d=s(r);null!==d&&(p.data=d)}return h.accumulateTwoPhaseDispatches(p),p}function c(e,t){switch(e){case w.topCompositionEnd:return s(t);case w.topKeyPress:var n=t.which;return n!==N?null:(I=!0,P);case w.topTextInput:var r=t.data;return r===P&&I?null:r;default:return null}}function p(e,t){if(S){if(e===w.topCompositionEnd||u(e,t)){var n=S.getData();return m.release(S),S=null,n}return null}switch(e){case w.topPaste:return null;case w.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case w.topCompositionEnd:return M?null:t.data;default:return null}}function d(e,t,n,r,o){var a;if(a=D?c(e,r):p(e,r),!a)return null;var i=y.getPooled(R.beforeInput,n,r,o);return i.data=a,h.accumulateTwoPhaseDispatches(i),i}var f=e(15),h=e(19),v=e(128),m=e(20),g=e(88),y=e(92),C=e(146),b=[9,13,27,32],_=229,E=v.canUseDOM&&"CompositionEvent"in window,x=null;v.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=v.canUseDOM&&"TextEvent"in window&&!x&&!r(),M=v.canUseDOM&&(!E||x&&x>8&&11>=x),N=32,P=String.fromCharCode(N),w=f.topLevelTypes,R={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[w.topCompositionEnd,w.topKeyPress,w.topTextInput,w.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[w.topBlur,w.topCompositionEnd,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[w.topBlur,w.topCompositionStart,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[w.topBlur,w.topCompositionUpdate,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]}},I=!1,S=null,T={eventTypes:R,extractEvents:function(e,t,n,r,o){return[l(e,t,n,r,o),d(e,t,n,r,o)]}};t.exports=T},{128:128,146:146,15:15,19:19,20:20,88:88,92:92}],4:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},a=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){a.forEach(function(t){o[r(t,e)]=o[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},u={isUnitlessNumber:o,shorthandPropertyExpansions:i};t.exports=u},{}],5:[function(e,t,n){"use strict";var r=e(4),o=e(128),a=e(69),i=(e(130),e(103)),u=e(141),s=e(148),l=(e(151),s(function(e){return u(e)})),c=!1,p="cssFloat";if(o.canUseDOM){var d=document.createElement("div").style;try{d.font=""}catch(f){c=!0}void 0===document.documentElement.style.cssFloat&&(p="styleFloat")}var h={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=l(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=p),a)n[o]=a;else{var u=c&&r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};a.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),t.exports=h},{103:103,128:128,130:130,141:141,148:148,151:151,4:4,69:69}],6:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(24),a=e(23),i=e(142);a(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?i(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{142:142,23:23,24:24}],7:[function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function o(e){var t=x.getPooled(R.change,S,e,D(e));b.accumulateTwoPhaseDispatches(t),E.batchedUpdates(a,t)}function a(e){C.enqueueEvents(e),C.processEventQueue(!1)}function i(e,t){I=e,S=t,I.attachEvent("onchange",o)}function u(){I&&(I.detachEvent("onchange",o),I=null,S=null)}function s(e,t,n){return e===w.topChange?n:void 0}function l(e,t,n){e===w.topFocus?(u(),i(t,n)):e===w.topBlur&&u()}function c(e,t){I=e,S=t,T=e.value,k=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(I,"value",L),I.attachEvent("onpropertychange",d)}function p(){I&&(delete I.value,I.detachEvent("onpropertychange",d),I=null,S=null,T=null,k=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==T&&(T=t,o(e))}}function f(e,t,n){return e===w.topInput?n:void 0}function h(e,t,n){e===w.topFocus?(p(),c(t,n)):e===w.topBlur&&p()}function v(e,t,n){return e!==w.topSelectionChange&&e!==w.topKeyUp&&e!==w.topKeyDown||!I||I.value===T?void 0:(T=I.value,S)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===w.topClick?n:void 0}var y=e(15),C=e(16),b=e(19),_=e(128),E=e(81),x=e(90),D=e(112),M=e(117),N=e(118),P=e(146),w=y.topLevelTypes,R={change:{phasedRegistrationNames:{bubbled:P({onChange:null}),captured:P({onChangeCapture:null})},dependencies:[w.topBlur,w.topChange,w.topClick,w.topFocus,w.topInput,w.topKeyDown,w.topKeyUp,w.topSelectionChange]}},I=null,S=null,T=null,k=null,O=!1;_.canUseDOM&&(O=M("change")&&(!("documentMode"in document)||document.documentMode>8));var A=!1;_.canUseDOM&&(A=M("input")&&(!("documentMode"in document)||document.documentMode>9));var L={get:function(){return k.get.call(this)},set:function(e){T=""+e,k.set.call(this,e)}},U={eventTypes:R,extractEvents:function(e,t,n,o,a){var i,u;if(r(t)?O?i=s:u=l:N(t)?A?i=f:(i=v,u=h):m(t)&&(i=g),i){var c=i(e,t,n);if(c){var p=x.getPooled(R.change,c,o,a);return p.type="change",b.accumulateTwoPhaseDispatches(p),p}}u&&u(e,t,n)}};t.exports=U},{112:112,117:117,118:118,128:128,146:146,15:15,16:16,19:19,81:81,90:90}],8:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=e(12),a=e(65),i=e(69),u=e(122),s=e(123),l=e(142),c={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:s,processUpdates:function(e,t){for(var n,i=null,c=null,p=0;p<e.length;p++)if(n=e[p],n.type===a.MOVE_EXISTING||n.type===a.REMOVE_NODE){var d=n.fromIndex,f=n.parentNode.childNodes[d],h=n.parentID;f?void 0:l(!1),i=i||{},i[h]=i[h]||[],i[h][d]=f,c=c||[],c.push(f)}var v;if(v=t.length&&"string"==typeof t[0]?o.dangerouslyRenderMarkup(t):t,c)for(var m=0;m<c.length;m++)c[m].parentNode.removeChild(c[m]);for(var g=0;g<e.length;g++)switch(n=e[g],n.type){case a.INSERT_MARKUP:r(n.parentNode,v[n.markupIndex],n.toIndex);break;case a.MOVE_EXISTING:r(n.parentNode,i[n.parentID][n.fromIndex],n.toIndex);break;case a.SET_MARKUP:u(n.parentNode,n.content);break;case a.TEXT_CONTENT:s(n.parentNode,n.content);break;case a.REMOVE_NODE:}}};i.measureMethods(c,"DOMChildrenOperations",{updateTextContent:"updateTextContent"}),t.exports=c},{12:12,122:122,123:123,142:142,65:65,69:69}],10:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(142),a={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=a,n=e.Properties||{},i=e.DOMAttributeNamespaces||{},s=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},c=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in n){u.properties.hasOwnProperty(p)?o(!1):void 0;var d=p.toLowerCase(),f=n[p],h={attributeName:d,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(f,t.MUST_USE_ATTRIBUTE),mustUseProperty:r(f,t.MUST_USE_PROPERTY),hasSideEffects:r(f,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(f,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(f,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(f,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(f,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.mustUseAttribute&&h.mustUseProperty?o(!1):void 0,!h.mustUseProperty&&h.hasSideEffects?o(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:o(!1),s.hasOwnProperty(p)){var v=s[p];h.attributeName=v}i.hasOwnProperty(p)&&(h.attributeNamespace=i[p]),l.hasOwnProperty(p)&&(h.propertyName=l[p]),c.hasOwnProperty(p)&&(h.mutationMethod=c[p]),u.properties[p]=h}}},i={},u={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=i[e];return r||(i[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:a};t.exports=u},{142:142}],11:[function(e,t,n){"use strict";function r(e){return c.hasOwnProperty(e)?!0:l.hasOwnProperty(e)?!1:s.test(e)?(c[e]=!0,!0):(l[e]=!0,!1)}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var a=e(10),i=e(69),u=e(120),s=(e(151),/^[a-zA-Z_][\w\.\-]*$/),l={},c={},p={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+u(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+u(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+u(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+u(t):""},setValueForProperty:function(e,t,n){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else if(o(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var u=r.attributeName,s=r.attributeNamespace;s?e.setAttributeNS(s,u,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(u,""):e.setAttribute(u,""+n)}else{var l=r.propertyName;r.hasSideEffects&&""+e[l]==""+n||(e[l]=n)}}else a.isCustomAttribute(t)&&p.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var o=n.propertyName,i=a.getDefaultValueForProperty(e.nodeName,o);n.hasSideEffects&&""+e[o]===i||(e[o]=i)}}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};i.measureMethods(p,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),t.exports=p},{10:10,120:120,151:151,69:69}],12:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(128),a=e(133),i=e(134),u=e(138),s=e(142),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){o.canUseDOM?void 0:s(!1);for(var t,n={},p=0;p<e.length;p++)e[p]?void 0:s(!1),t=r(e[p]),t=u(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=a(v.join(""),i),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),d.hasOwnProperty(h)?s(!1):void 0,d[h]=C,f+=1)}}return f!==d.length?s(!1):void 0,d.length!==e.length?s(!1):void 0,d},dangerouslyReplaceNodeWithMarkup:function(e,t){o.canUseDOM?void 0:s(!1),t?void 0:s(!1),"html"===e.tagName.toLowerCase()?s(!1):void 0;var n;n="string"==typeof t?a(t,i)[0]:t,e.parentNode.replaceChild(n,e)}};t.exports=p},{128:128,133:133,134:134,138:138,142:142}],13:[function(e,t,n){"use strict";var r=e(146),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];t.exports=o},{146:146}],14:[function(e,t,n){"use strict";var r=e(15),o=e(19),a=e(94),i=e(63),u=e(146),s=r.topLevelTypes,l=i.getFirstReactDOM,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r,u){if(e===s.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var d;if(t.window===t)d=t;else{var f=t.ownerDocument;d=f?f.defaultView||f.parentWindow:window}var h,v,m="",g="";if(e===s.topMouseOut?(h=t,m=n,v=l(r.relatedTarget||r.toElement),v?g=i.getID(v):v=d,v=v||d):(h=d,v=t,g=n),h===v)return null;var y=a.getPooled(c.mouseLeave,m,r,u);y.type="mouseleave",y.target=h,y.relatedTarget=v;var C=a.getPooled(c.mouseEnter,g,r,u);return C.type="mouseenter",C.target=v,C.relatedTarget=h,o.accumulateEnterLeaveDispatches(y,C,m,g),p[0]=y,p[1]=C,p}};t.exports=d},{146:146,15:15,19:19,63:63,94:94}],15:[function(e,t,n){"use strict";var r=e(145),o=r({bubbled:null,captured:null}),a=r({topAbort:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topVolumeChange:null,topWaiting:null,topWheel:null}),i={topLevelTypes:a,PropagationPhases:o};t.exports=i},{145:145}],16:[function(e,t,n){"use strict";var r=e(17),o=e(18),a=e(54),i=e(100),u=e(108),s=e(142),l=(e(151),{}),c=null,p=function(e,t){e&&(o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},d=function(e){return p(e,!0)},f=function(e){return p(e,!1)},h=null,v={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){h=e},getInstanceHandle:function(){return h},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){"function"!=typeof n?s(!1):void 0;var o=l[t]||(l[t]={});o[e]=n;var a=r.registrationNameModules[t];a&&a.didPutListener&&a.didPutListener(e,t,n)},getListener:function(e,t){var n=l[t];return n&&n[e]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=l[t];o&&delete o[e]},deleteAllListeners:function(e){for(var t in l)if(l[t][e]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete l[t][e]}},extractEvents:function(e,t,n,o,a){for(var u,s=r.plugins,l=0;l<s.length;l++){var c=s[l];if(c){var p=c.extractEvents(e,t,n,o,a);p&&(u=i(u,p))}}return u},enqueueEvents:function(e){e&&(c=i(c,e))},processEventQueue:function(e){var t=c;c=null,e?u(t,d):u(t,f),c?s(!1):void 0,a.rethrowCaughtError()},__purge:function(){l={}},__getListenerBank:function(){return l}};t.exports=v},{100:100,108:108,142:142,151:151,17:17,18:18,54:54}],17:[function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:i(!1),!l.plugins[n]){t.extractEvents?void 0:i(!1),l.plugins[n]=t;var r=t.eventTypes;for(var a in r)o(r[a],t,a)?void 0:i(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?i(!1):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];a(u,t,n)}return!0}return e.registrationName?(a(e.registrationName,t,n),!0):!1}function a(e,t,n){l.registrationNameModules[e]?i(!1):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=e(142),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){u?i(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?i(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{142:142}],18:[function(e,t,n){"use strict";function r(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel}function o(e){return e===m.topMouseMove||e===m.topTouchMove}function a(e){return e===m.topMouseDown||e===m.topTouchStart}function i(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?f.invokeGuardedCallbackWithCatch(o,n,e,r):f.invokeGuardedCallback(o,n,e,r),e.currentTarget=null}function u(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)i(e,t,n[o],r[o]);else n&&i(e,t,n,r);e._dispatchListeners=null,e._dispatchIDs=null}function s(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function l(e){var t=s(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)?h(!1):void 0;var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function p(e){return!!e._dispatchListeners}var d=e(15),f=e(54),h=e(142),v=(e(151),{Mount:null,injectMount:function(e){v.Mount=e}}),m=d.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:a,executeDirectDispatch:c,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:l,hasDispatches:p,getNode:function(e){return v.Mount.getNode(e)},getID:function(e){return v.Mount.getID(e)},injection:v};t.exports=g},{142:142,15:15,151:151,54:54}],19:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,a=r(e,n,o);a&&(n._dispatchListeners=v(n._dispatchListeners,a),n._dispatchIDs=v(n._dispatchIDs,e))}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,o,e)}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=y(e,r);o&&(n._dispatchListeners=v(n._dispatchListeners,o),n._dispatchIDs=v(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e.dispatchMarker,null,e)}function l(e){m(e,a)}function c(e){m(e,i)}function p(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,u,e,t)}function d(e){m(e,s)}var f=e(15),h=e(16),v=(e(151),e(100)),m=e(108),g=f.PropagationPhases,y=h.getListener,C={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};t.exports=C},{100:100,108:108,15:15,151:151,16:16}],20:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(24),a=e(23),i=e(115);a(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),a=o.length;for(e=0;r>e&&n[e]===o[e];e++);var i=r-e;for(t=1;i>=t&&n[r-t]===o[a-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{115:115,23:23,24:24}],21:[function(e,t,n){"use strict";var r,o=e(10),a=e(128),i=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(a.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|s,allowTransparency:i,alt:null,async:s,autoComplete:null,autoPlay:s,capture:i|s,cellPadding:null,cellSpacing:null,charSet:i,challenge:i,checked:u|s,classID:i,className:r?i:u,cols:i|p,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:i,"default":s,defer:s,dir:null,disabled:i|s,download:d,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:s,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,inputMode:i,integrity:null,is:i,keyParams:i,keyType:i,kind:null,label:null,lang:null,list:i,loop:u|s,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,minLength:i,multiple:u|s,muted:u|s,name:null,nonce:i,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,reversed:s,role:i,rows:i|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:i|s,selected:u|s,shape:null,size:i|p,sizes:i,span:p,spellCheck:null,src:null,srcDoc:u,srcLang:null,srcSet:i,start:c,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:i,wmode:i,wrap:null,about:i,datatype:i,inlist:i,prefix:i,property:i,resource:i,"typeof":i,vocab:i,autoCapitalize:i,autoCorrect:i,autoSave:null,color:null,itemProp:i,itemScope:i|s,itemType:i,itemID:i,itemRef:i,results:null,security:i,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,128:128}],22:[function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?l(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?l(!1):void 0}function a(e){r(e),null!=e.checked||null!=e.onChange?l(!1):void 0}function i(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=e(72),s=e(71),l=e(142),c=(e(151),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},d={},f={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop);o instanceof Error&&!(o.message in d)&&(d[o.message]=!0,i(n))}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(a(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(a(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=f},{142:142,151:151,71:71,72:72}],23:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var a=arguments[o];if(null!=a){var i=Object(a);for(var u in i)r.call(i,u)&&(n[u]=i[u])}}return n}t.exports=r},{}],24:[function(e,t,n){"use strict";var r=e(142),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},a=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},i=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r),a}return new o(e,t,n,r)},s=function(e,t,n,r,o){var a=this;if(a.instancePool.length){var i=a.instancePool.pop();return a.call(i,e,t,n,r,o),i}return new a(e,t,n,r,o)},l=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},c=10,p=o,d=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||p,n.poolSize||(n.poolSize=c),n.release=l,n},f={addPoolingTo:d,oneArgumentPooler:o,twoArgumentPooler:a,threeArgumentPooler:i,fourArgumentPooler:u,fiveArgumentPooler:s};t.exports=f},{142:142}],25:[function(e,t,n){"use strict";var r=(e(60),e(106)),o=(e(151),"_getDOMNodeDidWarn"),a={getDOMNode:function(){return this.constructor[o]=!0,r(this)}};t.exports=a},{106:106,151:151,60:60}],26:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=h++,d[e[m]]={}),d[e[m]]}var o=e(15),a=e(16),i=e(17),u=e(55),s=e(69),l=e(99),c=e(23),p=e(117),d={},f=!1,h=0,v={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",
topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),g=c({},u,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(g.handleTopLevel),g.ReactEventListener=e}},setEnabled:function(e){g.ReactEventListener&&g.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!g.ReactEventListener||!g.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,a=r(n),u=i.registrationNameDependencies[e],s=o.topLevelTypes,l=0;l<u.length;l++){var c=u[l];a.hasOwnProperty(c)&&a[c]||(c===s.topWheel?p("wheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):p("mousewheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):g.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):c===s.topScroll?p("scroll",!0)?g.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):g.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",g.ReactEventListener.WINDOW_HANDLE):c===s.topFocus||c===s.topBlur?(p("focus",!0)?(g.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),g.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):p("focusin")&&(g.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),g.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),a[s.topBlur]=!0,a[s.topFocus]=!0):v.hasOwnProperty(c)&&g.ReactEventListener.trapBubbledEvent(c,v[c],n),a[c]=!0)}},trapBubbledEvent:function(e,t,n){return g.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return g.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!f){var e=l.refreshScrollValues;g.ReactEventListener.monitorScrollValue(e),f=!0}},eventNameDispatchConfigs:a.eventNameDispatchConfigs,registrationNameModules:a.registrationNameModules,putListener:a.putListener,getListener:a.getListener,deleteListener:a.deleteListener,deleteAllListeners:a.deleteAllListeners});s.measureMethods(g,"ReactBrowserEventEmitter",{putListener:"putListener",deleteListener:"deleteListener"}),t.exports=g},{117:117,15:15,16:16,17:17,23:23,55:55,69:69,99:99}],27:[function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=a(t,null))}var o=e(74),a=e(116),i=e(124),u=e(125),s=(e(151),{instantiateChildren:function(e,t,n){if(null==e)return null;var o={};return u(e,r,o),o},updateChildren:function(e,t,n,r){if(!t&&!e)return null;var u;for(u in t)if(t.hasOwnProperty(u)){var s=e&&e[u],l=s&&s._currentElement,c=t[u];if(null!=s&&i(l,c))o.receiveComponent(s,c,n,r),t[u]=s;else{s&&o.unmountComponent(s,u);var p=a(c,null);t[u]=p}}for(u in e)!e.hasOwnProperty(u)||t&&t.hasOwnProperty(u)||o.unmountComponent(e[u]);return t},unmountChildren:function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];o.unmountComponent(n)}}});t.exports=s},{116:116,124:124,125:125,151:151,74:74}],28:[function(e,t,n){"use strict";function r(e){return(""+e).replace(b,"//")}function o(e,t){this.func=e,this.context=t,this.count=0}function a(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function i(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);g(e,a,r),o.release(r)}function u(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,n){var o=e.result,a=e.keyPrefix,i=e.func,u=e.context,s=i.call(u,t,e.count++);Array.isArray(s)?l(s,o,n,m.thatReturnsArgument):null!=s&&(v.isValidElement(s)&&(s=v.cloneAndReplaceKey(s,a+(s!==t?r(s.key||"")+"/":"")+n)),o.push(s))}function l(e,t,n,o,a){var i="";null!=n&&(i=r(n)+"/");var l=u.getPooled(t,i,o,a);g(e,s,l),u.release(l)}function c(e,t,n){if(null==e)return e;var r=[];return l(e,r,null,t,n),r}function p(e,t,n){return null}function d(e,t){return g(e,p,null)}function f(e){var t=[];return l(e,t,null,m.thatReturnsArgument),t}var h=e(24),v=e(50),m=e(134),g=e(125),y=h.twoArgumentPooler,C=h.fourArgumentPooler,b=/\/(?!\/)/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,y),u.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(u,C);var _={forEach:i,map:c,mapIntoWithKeyPrefixInternal:l,count:d,toArray:f};t.exports=_},{125:125,134:134,24:24,50:50}],29:[function(e,t,n){"use strict";function r(e,t){var n=E.hasOwnProperty(t)?E[t]:null;D.hasOwnProperty(t)&&(n!==b.OVERRIDE_BASE?m(!1):void 0),e.hasOwnProperty(t)&&(n!==b.DEFINE_MANY&&n!==b.DEFINE_MANY_MERGED?m(!1):void 0)}function o(e,t){if(t){"function"==typeof t?m(!1):void 0,d.isValidElement(t)?m(!1):void 0;var n=e.prototype;t.hasOwnProperty(C)&&x.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==C){var a=t[o];if(r(n,o),x.hasOwnProperty(o))x[o](e,a);else{var i=E.hasOwnProperty(o),l=n.hasOwnProperty(o),c="function"==typeof a,p=c&&!i&&!l&&t.autobind!==!1;if(p)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=a,n[o]=a;else if(l){var f=E[o];!i||f!==b.DEFINE_MANY_MERGED&&f!==b.DEFINE_MANY?m(!1):void 0,f===b.DEFINE_MANY_MERGED?n[o]=u(n[o],a):f===b.DEFINE_MANY&&(n[o]=s(n[o],a))}else n[o]=a}}}}function a(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in x;o?m(!1):void 0;var a=n in e;a?m(!1):void 0,e[n]=r}}}function i(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:m(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?m(!1):void 0,e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return i(o,n),i(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,n)}}var p=e(30),d=e(50),f=(e(71),e(70),e(67)),h=e(23),v=e(135),m=e(142),g=e(145),y=e(146),C=(e(151),y({mixins:null})),b=g({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),_=[],E={mixins:b.DEFINE_MANY,statics:b.DEFINE_MANY,propTypes:b.DEFINE_MANY,contextTypes:b.DEFINE_MANY,childContextTypes:b.DEFINE_MANY,getDefaultProps:b.DEFINE_MANY_MERGED,getInitialState:b.DEFINE_MANY_MERGED,getChildContext:b.DEFINE_MANY_MERGED,render:b.DEFINE_ONCE,componentWillMount:b.DEFINE_MANY,componentDidMount:b.DEFINE_MANY,componentWillReceiveProps:b.DEFINE_MANY,shouldComponentUpdate:b.DEFINE_ONCE,componentWillUpdate:b.DEFINE_MANY,componentDidUpdate:b.DEFINE_MANY,componentWillUnmount:b.DEFINE_MANY,updateComponent:b.OVERRIDE_BASE},x={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=h({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=h({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=h({},e.propTypes,t)},statics:function(e,t){a(e,t)},autobind:function(){}},D={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t)},isMounted:function(){return this.updater.isMounted(this)},setProps:function(e,t){this.updater.enqueueSetProps(this,e),t&&this.updater.enqueueCallback(this,t)},replaceProps:function(e,t){this.updater.enqueueReplaceProps(this,e),t&&this.updater.enqueueCallback(this,t)}},M=function(){};h(M.prototype,p.prototype,D);var N={createClass:function(e){var t=function(e,t,n){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.refs=v,this.updater=n||f,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!=typeof r||Array.isArray(r)?m(!1):void 0,this.state=r};t.prototype=new M,t.prototype.constructor=t,_.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:m(!1);for(var n in E)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){_.push(e)}}};t.exports=N},{135:135,142:142,145:145,146:146,151:151,23:23,30:30,50:50,67:67,70:70,71:71}],30:[function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||o}var o=e(67),a=(e(102),e(135)),i=e(142);e(151);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?i(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e)};t.exports=r},{102:102,135:135,142:142,151:151,67:67}],31:[function(e,t,n){"use strict";var r=e(40),o=e(63),a={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=a},{40:40,63:63}],32:[function(e,t,n){"use strict";var r=e(142),o=!1,a={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,a.unmountIDFromEnvironment=e.unmountIDFromEnvironment,a.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,a.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=a},{142:142}],33:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function o(e){}var a=e(32),i=e(34),u=e(50),s=e(60),l=e(69),c=e(71),p=(e(70),e(74)),d=e(80),f=e(23),h=e(135),v=e(142),m=e(124);e(151);o.prototype.render=function(){var e=s.get(this)._currentElement.type;return e(this.props,this.context,this.updater)};var g=1,y={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=g++,this._rootNodeID=e;var r,a,i=this._processProps(this._currentElement.props),l=this._processContext(n),c=this._currentElement.type,f="prototype"in c;f&&(r=new c(i,l,d)),(!f||null===r||r===!1||u.isValidElement(r))&&(a=r,r=new o(c)),r.props=i,r.context=l,r.refs=h,r.updater=d,this._instance=r,s.set(r,this);var m=r.state;void 0===m&&(r.state=m=null),"object"!=typeof m||Array.isArray(m)?v(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingStateQueue&&(r.state=this._processPendingState(r.props,r.context))),void 0===a&&(a=this._renderValidatedComponent()),this._renderedComponent=this._instantiateReactComponent(a);var y=p.mountComponent(this._renderedComponent,e,t,this._processChildContext(n));return r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),y},unmountComponent:function(){var e=this._instance;e.componentWillUnmount&&e.componentWillUnmount(),p.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._instance=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,s.remove(e)},_maskContext:function(e){var t=null,n=this._currentElement.type,r=n.contextTypes;if(!r)return h;t={};for(var o in r)t[o]=e[o];return t},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?v(!1):void 0;for(var o in r)o in t.childContextTypes?void 0:v(!1);return f({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var a in e)if(e.hasOwnProperty(a)){var i;try{"function"!=typeof e[a]?v(!1):void 0,i=e[a](t,a,o,n)}catch(u){i=u}i instanceof Error&&(r(this),n===c.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&p.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,o){var a,i=this._instance,u=this._context===o?i.context:this._processContext(o);t===n?a=n.props:(a=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(a,u));var s=this._processPendingState(a,u),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(a,s,u);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,a,s,u,e,o)):(this._currentElement=n,this._context=o,i.props=a,i.state=s,i.context=u)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var a=f({},o?r[0]:n.state),i=o?1:0;i<r.length;i++){var u=r[i];f(a,"function"==typeof u?u.call(n,a,e,t):u)}return a},_performComponentUpdate:function(e,t,n,r,o,a){var i,u,s,l=this._instance,c=Boolean(l.componentDidUpdate);c&&(i=l.props,u=l.state,s=l.context),l.componentWillUpdate&&l.componentWillUpdate(t,n,r),this._currentElement=e,this._context=a,l.props=t,l.state=n,l.context=r,this._updateRenderedComponent(o,a),c&&o.getReactMountReady().enqueue(l.componentDidUpdate.bind(l,i,u,s),l)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(m(r,o))p.receiveComponent(n,o,e,this._processChildContext(t));else{var a=this._rootNodeID,i=n._rootNodeID;p.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(o);var u=p.mountComponent(this._renderedComponent,a,e,this._processChildContext(t));this._replaceNodeWithMarkupByID(i,u)}},_replaceNodeWithMarkupByID:function(e,t){a.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;i.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=null}return null===e||e===!1||u.isValidElement(e)?void 0:v(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?v(!1):void 0;var r=t.getPublicInstance(),o=n.refs===h?n.refs={}:n.refs;o[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof o?null:e},_instantiateReactComponent:null};l.measureMethods(y,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var C={Mixin:y};t.exports=C},{124:124,135:135,142:142,151:151,23:23,32:32,34:34,50:50,60:60,69:69,70:70,71:71,74:74,80:80}],34:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],35:[function(e,t,n){"use strict";var r=e(34),o=e(46),a=e(49),i=e(59),u=e(63),s=e(69),l=e(74),c=e(81),p=e(82),d=e(106),f=e(121);e(151);a.inject();var h=s.measure("React","render",u.render),v={findDOMNode:d,render:h,unmountComponentAtNode:u.unmountComponentAtNode,version:p,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:i,Mount:u,Reconciler:l,TextComponent:o});t.exports=v},{106:106,121:121,151:151,34:34,46:46,49:49,59:59,63:63,69:69,74:74,81:81,82:82}],36:[function(e,t,n){"use strict";var r={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},o={getNativeProps:function(e,t,n){if(!t.disabled)return t;var o={};for(var a in t)t.hasOwnProperty(a)&&!r[a]&&(o[a]=t[a]);return o}};t.exports=o},{}],37:[function(e,t,n){"use strict";function r(){return this}function o(){var e=this._reactInternalComponent;return!!e}function a(){}function i(e,t){var n=this._reactInternalComponent;n&&(T.enqueueSetPropsInternal(n,e),t&&T.enqueueCallbackInternal(n,t))}function u(e,t){var n=this._reactInternalComponent;n&&(T.enqueueReplacePropsInternal(n,e),t&&T.enqueueCallbackInternal(n,t))}function s(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children?L(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&Y in t.dangerouslySetInnerHTML?void 0:L(!1)),null!=t.style&&"object"!=typeof t.style?L(!1):void 0)}function l(e,t,n,r){var o=R.findReactContainerForID(e);if(o){var a=o.nodeType===z?o.ownerDocument:o;j(t,a)}r.getReactMountReady().enqueue(c,{id:e,registrationName:t,listener:n})}function c(){var e=this;E.putListener(e.id,e.registrationName,e.listener)}function p(){var e=this;e._rootNodeID?void 0:L(!1);var t=R.getNode(e._rootNodeID);switch(t?void 0:L(!1),e._tag){case"iframe":e._wrapperState.listeners=[E.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in G)G.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(_.topLevelTypes[n],G[n],t));break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent(_.topLevelTypes.topError,"error",t),E.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent(_.topLevelTypes.topReset,"reset",t),E.trapBubbledEvent(_.topLevelTypes.topSubmit,"submit",t)]}}function d(){M.mountReadyWrapper(this)}function f(){P.postUpdateWrapper(this)}function h(e){J.call(Z,e)||($.test(e)?void 0:L(!1),Z[e]=!0)}function v(e,t){return e.indexOf("-")>=0||null!=t.is}function m(e){h(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var g=e(2),y=e(5),C=e(10),b=e(11),_=e(15),E=e(26),x=e(31),D=e(36),M=e(41),N=e(42),P=e(43),w=e(47),R=e(63),I=e(64),S=e(69),T=e(80),k=e(23),O=e(102),A=e(105),L=e(142),U=(e(117),e(146)),F=e(122),B=e(123),V=(e(149),e(126),e(151),E.deleteListener),j=E.listenTo,W=E.registrationNameModules,K={string:!0,number:!0},H=U({children:null}),q=U({style:null}),Y=U({__html:null}),z=1,G={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},X={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Q={listing:!0,pre:!0,textarea:!0},$=(k({menuitem:!0},X),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},J={}.hasOwnProperty;m.displayName="ReactDOMComponent",m.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(p,this);break;case"button":r=D.getNativeProps(this,r,n);break;case"input":M.mountWrapper(this,r,n),r=M.getNativeProps(this,r,n);break;case"option":N.mountWrapper(this,r,n),r=N.getNativeProps(this,r,n);break;case"select":P.mountWrapper(this,r,n),r=P.getNativeProps(this,r,n),n=P.processChildContext(this,r,n);break;case"textarea":w.mountWrapper(this,r,n),r=w.getNativeProps(this,r,n)}s(this,r);var o;if(t.useCreateElement){var a=n[R.ownerDocumentContextKey],i=a.createElement(this._currentElement.type);b.setAttributeForID(i,this._rootNodeID),R.getID(i),this._updateDOMProperties({},r,t,i),this._createInitialChildren(t,r,n,i),o=i}else{var u=this._createOpenTagMarkupAndPutListeners(t,r),l=this._createContentMarkup(t,r,n);o=!l&&X[this._tag]?u+"/>":u+">"+l+"</"+this._currentElement.type+">"}switch(this._tag){case"input":t.getReactMountReady().enqueue(d,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(g.focusDOMComponent,this)}return o},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(W.hasOwnProperty(r))o&&l(this._rootNodeID,r,o,e);else{r===q&&(o&&(o=this._previousStyleCopy=k({},t.style)),o=y.createMarkupForStyles(o));var a=null;null!=this._tag&&v(this._tag,t)?r!==H&&(a=b.createMarkupForCustomAttribute(r,o)):a=b.createMarkupForProperty(r,o),a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n;var i=b.createMarkupForID(this._rootNodeID);return n+" "+i},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)r=A(a);else if(null!=i){var u=this.mountChildren(i,e,n);r=u.join("")}}return Q[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&F(r,o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)B(r,a);else if(null!=i)for(var u=this.mountChildren(i,e,n),s=0;s<u.length;s++)r.appendChild(u[s])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,r){var o=t.props,a=this._currentElement.props;switch(this._tag){case"button":o=D.getNativeProps(this,o),a=D.getNativeProps(this,a);break;case"input":M.updateWrapper(this),o=M.getNativeProps(this,o),a=M.getNativeProps(this,a);break;case"option":o=N.getNativeProps(this,o),a=N.getNativeProps(this,a);break;case"select":o=P.getNativeProps(this,o),a=P.getNativeProps(this,a);break;case"textarea":w.updateWrapper(this),o=w.getNativeProps(this,o),a=w.getNativeProps(this,a)}s(this,a),this._updateDOMProperties(o,a,e,null),this._updateDOMChildren(o,a,e,r),!O&&this._nodeWithLegacyProperties&&(this._nodeWithLegacyProperties.props=a),"select"===this._tag&&e.getReactMountReady().enqueue(f,this)},_updateDOMProperties:function(e,t,n,r){var o,a,i;for(o in e)if(!t.hasOwnProperty(o)&&e.hasOwnProperty(o))if(o===q){var u=this._previousStyleCopy;for(a in u)u.hasOwnProperty(a)&&(i=i||{},i[a]="");this._previousStyleCopy=null}else W.hasOwnProperty(o)?e[o]&&V(this._rootNodeID,o):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=R.getNode(this._rootNodeID)),b.deleteValueForProperty(r,o));for(o in t){var s=t[o],c=o===q?this._previousStyleCopy:e[o];if(t.hasOwnProperty(o)&&s!==c)if(o===q)if(s?s=this._previousStyleCopy=k({},s):this._previousStyleCopy=null,c){for(a in c)!c.hasOwnProperty(a)||s&&s.hasOwnProperty(a)||(i=i||{},i[a]="");for(a in s)s.hasOwnProperty(a)&&c[a]!==s[a]&&(i=i||{},i[a]=s[a])}else i=s;else W.hasOwnProperty(o)?s?l(this._rootNodeID,o,s,n):c&&V(this._rootNodeID,o):v(this._tag,t)?(r||(r=R.getNode(this._rootNodeID)),o===H&&(s=null),b.setValueForAttribute(r,o,s)):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=R.getNode(this._rootNodeID)),null!=s?b.setValueForProperty(r,o,s):b.deleteValueForProperty(r,o))}i&&(r||(r=R.getNode(this._rootNodeID)),y.setValueForStyles(r,i))},_updateDOMChildren:function(e,t,n,r){var o=K[typeof e.children]?e.children:null,a=K[typeof t.children]?t.children:null,i=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,l=null!=a?null:t.children,c=null!=o||null!=i,p=null!=a||null!=u;null!=s&&null==l?this.updateChildren(null,n,r):c&&!p&&this.updateTextContent(""),null!=a?o!==a&&this.updateTextContent(""+a):null!=u?i!==u&&this.updateMarkup(""+u):null!=l&&this.updateChildren(l,n,r)},unmountComponent:function(){switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":var e=this._wrapperState.listeners;if(e)for(var t=0;t<e.length;t++)e[t].remove();break;case"input":M.unmountWrapper(this);break;case"html":case"head":case"body":L(!1)}if(this.unmountChildren(),E.deleteAllListeners(this._rootNodeID),x.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._wrapperState=null,this._nodeWithLegacyProperties){var n=this._nodeWithLegacyProperties;n._reactInternalComponent=null,this._nodeWithLegacyProperties=null}},getPublicInstance:function(){if(!this._nodeWithLegacyProperties){var e=R.getNode(this._rootNodeID);e._reactInternalComponent=this,e.getDOMNode=r,e.isMounted=o,e.setState=a,e.replaceState=a,e.forceUpdate=a,e.setProps=i,e.replaceProps=u,e.props=this._currentElement.props,this._nodeWithLegacyProperties=e}return this._nodeWithLegacyProperties}},S.measureMethods(m,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),k(m.prototype,m.Mixin,I.Mixin),t.exports=m},{10:10,102:102,105:105,11:11,117:117,122:122,123:123,126:126,142:142,146:146,149:149,15:15,151:151,2:2,23:23,26:26,31:31,36:36,41:41,42:42,43:43,47:47,5:5,63:63,64:64,69:69,80:80}],38:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(50),a=(e(51),e(147)),i=a({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=i},{147:147,50:50,51:51}],39:[function(e,t,n){"use strict";var r={useCreateElement:!1};t.exports=r},{}],40:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(63),i=e(69),u=e(142),s={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s.hasOwnProperty(t)?u(!1):void 0,null!=n?o.setValueForProperty(r,t,n):o.deleteValueForProperty(r,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);r.processUpdates(e,t)}};i.measureMethods(l,"ReactDOMIDOperations",{dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=l},{11:11,142:142,63:63,69:69,9:9}],41:[function(e,t,n){"use strict";function r(){this._rootNodeID&&d.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);s.asap(r,this);var o=t.name;if("radio"===t.type&&null!=o){for(var a=u.getNode(this._rootNodeID),l=a;l.parentNode;)l=l.parentNode;for(var d=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<d.length;f++){var h=d[f];if(h!==a&&h.form===a.form){var v=u.getID(h);v?void 0:c(!1);var m=p[v];m?void 0:c(!1),s.asap(r,m)}}}return n}var a=e(40),i=e(22),u=e(63),s=e(81),l=e(23),c=e(142),p={},d={getNativeProps:function(e,t,n){var r=i.getValue(t),o=i.getChecked(t),a=l({},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=r?r:e._wrapperState.initialValue,checked:null!=o?o:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return a},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,onChange:o.bind(e)}},mountReadyWrapper:function(e){p[e._rootNodeID]=e},unmountWrapper:function(e){delete p[e._rootNodeID]},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&a.updatePropertyByID(e._rootNodeID,"checked",n||!1);var r=i.getValue(t);null!=r&&a.updatePropertyByID(e._rootNodeID,"value",""+r)}};t.exports=d},{142:142,22:22,23:23,40:40,63:63,81:81}],42:[function(e,t,n){"use strict";var r=e(28),o=e(43),a=e(23),i=(e(151),o.valueContextKey),u={mountWrapper:function(e,t,n){var r=n[i],o=null;if(null!=r)if(o=!1,Array.isArray(r)){for(var a=0;a<r.length;a++)if(""+r[a]==""+t.value){o=!0;break}}else o=""+r==""+t.value;e._wrapperState={selected:o}},getNativeProps:function(e,t,n){var o=a({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(o.selected=e._wrapperState.selected);var i="";return r.forEach(t.children,function(e){null!=e&&("string"==typeof e||"number"==typeof e)&&(i+=e)}),i&&(o.children=i),o}};t.exports=u},{151:151,23:23,28:28,43:43}],43:[function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=i.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,a=u.getNode(e._rootNodeID).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<a.length;o++){var i=r.hasOwnProperty(a[o].value);a[o].selected!==i&&(a[o].selected=i)}}else{for(r=""+n,o=0;o<a.length;o++)if(a[o].value===r)return void(a[o].selected=!0);a.length&&(a[0].selected=!0)}}function a(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);return this._wrapperState.pendingUpdate=!0,s.asap(r,this),n}var i=e(22),u=e(63),s=e(81),l=e(23),c=(e(151),"__ReactDOMSelect_value$"+Math.random().toString(36).slice(2)),p={valueContextKey:c,getNativeProps:function(e,t,n){return l({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=i.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,onChange:a.bind(e),wasMultiple:Boolean(t.multiple)}},processChildContext:function(e,t,n){var r=l({},n);return r[c]=e._wrapperState.initialValue,r},postUpdateWrapper:function(e){
var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=i.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?o(e,Boolean(t.multiple),t.defaultValue):o(e,Boolean(t.multiple),t.multiple?[]:""))}};t.exports=p},{151:151,22:22,23:23,63:63,81:81}],44:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var a=o.text.length,i=a+r;return{start:a,end:i}}function a(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,a=t.focusNode,i=t.focusOffset,u=t.getRangeAt(0);try{u.startContainer.nodeType,u.endContainer.nodeType}catch(s){return null}var l=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),c=l?0:u.toString().length,p=u.cloneRange();p.selectNodeContents(e),p.setEnd(u.startContainer,u.startOffset);var d=r(p.startContainer,p.startOffset,p.endContainer,p.endOffset),f=d?0:p.toString().length,h=f+c,v=document.createRange();v.setStart(n,o),v.setEnd(a,i);var m=v.collapsed;return{start:m?h:f,end:m?f:h}}function i(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),a="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>a){var i=a;a=o,o=i}var u=l(e,o),s=l(e,a);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>a?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=e(128),l=e(114),c=e(115),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:a,setOffsets:p?i:u};t.exports=d},{114:114,115:115,128:128}],45:[function(e,t,n){"use strict";var r=e(49),o=e(78),a=e(82);r.inject();var i={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup,version:a};t.exports=i},{49:49,78:78,82:82}],46:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(31),i=e(63),u=e(23),s=e(105),l=e(123),c=(e(126),function(e){});u(c.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var r=n[i.ownerDocumentContextKey],a=r.createElement("span");return o.setAttributeForID(a,e),i.getID(a),l(a,this._stringText),a}var u=s(this._stringText);return t.renderToStaticMarkup?u:"<span "+o.createMarkupForID(e)+">"+u+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var o=i.getNode(this._rootNodeID);r.updateTextContent(o,n)}}},unmountComponent:function(){a.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=c},{105:105,11:11,123:123,126:126,23:23,31:31,63:63,9:9}],47:[function(e,t,n){"use strict";function r(){this._rootNodeID&&c.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);return u.asap(r,this),n}var a=e(22),i=e(40),u=e(81),s=e(23),l=e(142),c=(e(151),{getNativeProps:function(e,t,n){null!=t.dangerouslySetInnerHTML?l(!1):void 0;var r=s({},t,{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return r},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?l(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:l(!1),r=r[0]),n=""+r),null==n&&(n="");var i=a.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=a.getValue(t);null!=n&&i.updatePropertyByID(e._rootNodeID,"value",""+n)}});t.exports=c},{142:142,151:151,22:22,23:23,40:40,81:81}],48:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(81),a=e(98),i=e(23),u=e(134),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},l={initialize:u,close:o.flushBatchedUpdates.bind(o)},c=[l,s];i(r.prototype,a.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,a){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o,a):p.perform(e,null,t,n,r,o,a)}};t.exports=d},{134:134,23:23,81:81,98:98}],49:[function(e,t,n){"use strict";function r(){M||(M=!0,g.EventEmitter.injectReactEventListener(m),g.EventPluginHub.injectEventPluginOrder(u),g.EventPluginHub.injectInstanceHandle(y),g.EventPluginHub.injectMount(C),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:s,ChangeEventPlugin:a,SelectEventPlugin:_,BeforeInputEventPlugin:o}),g.NativeComponent.injectGenericComponentClass(h),g.NativeComponent.injectTextComponentClass(v),g.Class.injectMixin(p),g.DOMProperty.injectDOMPropertyConfig(c),g.DOMProperty.injectDOMPropertyConfig(D),g.EmptyComponent.injectEmptyComponent("noscript"),g.Updates.injectReconcileTransaction(b),g.Updates.injectBatchingStrategy(f),g.RootIndex.injectCreateReactRootIndex(l.canUseDOM?i.createReactRootIndex:E.createReactRootIndex),g.Component.injectEnvironment(d))}var o=e(3),a=e(7),i=e(8),u=e(13),s=e(14),l=e(128),c=e(21),p=e(25),d=e(31),f=e(48),h=e(37),v=e(46),m=e(56),g=e(57),y=e(59),C=e(63),b=e(73),_=e(84),E=e(85),x=e(86),D=e(83),M=!1;t.exports={inject:r}},{128:128,13:13,14:14,21:21,25:25,3:3,31:31,37:37,46:46,48:48,56:56,57:57,59:59,63:63,7:7,73:73,8:8,83:83,84:84,85:85,86:86}],50:[function(e,t,n){"use strict";var r=e(34),o=e(23),a=(e(102),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),i={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,i,u){var s={$$typeof:a,type:e,key:t,ref:n,props:u,_owner:i};return s};u.createElement=function(e,t,n){var o,a={},s=null,l=null,c=null,p=null;if(null!=t){l=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,c=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(o in t)t.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(a[o]=t[o])}var d=arguments.length-2;if(1===d)a.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];a.children=f}if(e&&e.defaultProps){var v=e.defaultProps;for(o in v)"undefined"==typeof a[o]&&(a[o]=v[o])}return u(e,s,l,c,p,r.current,a)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneAndReplaceProps=function(e,t){var n=u(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},u.cloneElement=function(e,t,n){var a,s=o({},e.props),l=e.key,c=e.ref,p=e._self,d=e._source,f=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,f=r.current),void 0!==t.key&&(l=""+t.key);for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(s[a]=t[a])}var h=arguments.length-2;if(1===h)s.children=n;else if(h>1){for(var v=Array(h),m=0;h>m;m++)v[m]=arguments[m+2];s.children=v}return u(e.type,l,c,p,d,f,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.exports=u},{102:102,23:23,34:34}],51:[function(e,t,n){"use strict";function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e,t){e._store&&!e._store.validated&&null==e.key&&(e._store.validated=!0,a("uniqueKey",e,t))}function a(e,t,n){var o=r();if(!o){var a="string"==typeof n?n:n.displayName||n.name;a&&(o=" Check the top-level render call using <"+a+">.")}var i=h[e]||(h[e]={});if(i[o])return null;i[o]=!0;var u={parentOrOwner:o,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==p.current&&(u.childOwner=" It was passed a child from "+t._owner.getName()+"."),u}function i(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];l.isValidElement(r)&&o(r,t)}else if(l.isValidElement(e))e._store&&(e._store.validated=!0);else if(e){var a=d(e);if(a&&a!==e.entries)for(var i,u=a.call(e);!(i=u.next()).done;)l.isValidElement(i.value)&&o(i.value,t)}}function u(e,t,n,o){for(var a in t)if(t.hasOwnProperty(a)){var i;try{"function"!=typeof t[a]?f(!1):void 0,i=t[a](n,a,e,o)}catch(u){i=u}i instanceof Error&&!(i.message in v)&&(v[i.message]=!0,r())}}function s(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name;t.propTypes&&u(n,t.propTypes,e.props,c.prop),"function"==typeof t.getDefaultProps}}var l=e(50),c=e(71),p=(e(70),e(34)),d=(e(102),e(113)),f=e(142),h=(e(151),{}),v={},m={createElement:function(e,t,n){var r="string"==typeof e||"function"==typeof e,o=l.createElement.apply(this,arguments);if(null==o)return o;if(r)for(var a=2;a<arguments.length;a++)i(arguments[a],e);return s(o),o},createFactory:function(e){var t=m.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=l.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)i(arguments[o],r.type);return s(r),r}};t.exports=m},{102:102,113:113,142:142,151:151,34:34,50:50,70:70,71:71}],52:[function(e,t,n){"use strict";var r,o=e(50),a=e(53),i=e(74),u=e(23),s={injectEmptyComponent:function(e){r=o.createElement(e)}},l=function(e){this._currentElement=null,this._rootNodeID=null,this._renderedComponent=e(r)};u(l.prototype,{construct:function(e){},mountComponent:function(e,t,n){return a.registerNullComponentID(e),this._rootNodeID=e,i.mountComponent(this._renderedComponent,e,t,n)},receiveComponent:function(){},unmountComponent:function(e,t,n){i.unmountComponent(this._renderedComponent),a.deregisterNullComponentID(this._rootNodeID),this._rootNodeID=null,this._renderedComponent=null}}),l.injection=s,t.exports=l},{23:23,50:50,53:53,74:74}],53:[function(e,t,n){"use strict";function r(e){return!!i[e]}function o(e){i[e]=!0}function a(e){delete i[e]}var i={},u={isNullComponentID:r,registerNullComponentID:o,deregisterNullComponentID:a};t.exports=u},{}],54:[function(e,t,n){"use strict";function r(e,t,n,r){try{return t(n,r)}catch(a){return void(null===o&&(o=a))}}var o=null,a={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var e=o;throw o=null,e}}};t.exports=a},{}],55:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue(!1)}var o=e(16),a={handleTopLevel:function(e,t,n,a,i){var u=o.extractEvents(e,t,n,a,i);r(u)}};t.exports=a},{16:16}],56:[function(e,t,n){"use strict";function r(e){var t=d.getID(e),n=p.getReactRootIDFromNodeID(t),r=d.findReactContainerForID(n),o=d.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){i(e)}function i(e){for(var t=d.getFirstReactDOM(v(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0;o<e.ancestors.length;o++){t=e.ancestors[o];var a=d.getID(t)||"";g._handleTopLevel(e.topLevelType,t,a,e.nativeEvent,v(e.nativeEvent))}}function u(e){var t=m(window);e(t)}var s=e(127),l=e(128),c=e(24),p=e(59),d=e(63),f=e(81),h=e(23),v=e(112),m=e(139);h(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(o,c.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:l.canUseDOM?window:null,setHandleTopLevel:function(e){g._handleTopLevel=e},setEnabled:function(e){g._enabled=!!e},isEnabled:function(){return g._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,g.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,g.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=u.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(g._enabled){var n=o.getPooled(e,t);try{f.batchedUpdates(a,n)}finally{o.release(n)}}}};t.exports=g},{112:112,127:127,128:128,139:139,23:23,24:24,59:59,63:63,81:81}],57:[function(e,t,n){"use strict";var r=e(10),o=e(16),a=e(32),i=e(29),u=e(52),s=e(26),l=e(66),c=e(69),p=e(76),d=e(81),f={Component:a.injection,Class:i.injection,DOMProperty:r.injection,EmptyComponent:u.injection,EventPluginHub:o.injection,EventEmitter:s.injection,NativeComponent:l.injection,Perf:c.injection,RootIndex:p.injection,Updates:d.injection};t.exports=f},{10:10,16:16,26:26,29:29,32:32,52:52,66:66,69:69,76:76,81:81}],58:[function(e,t,n){"use strict";function r(e){return a(document.documentElement,e)}var o=e(44),a=e(131),i=e(136),u=e(137),s={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),i(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var a=e.createTextRange();a.collapse(!0),a.moveStart("character",n),a.moveEnd("character",r-n),a.select()}else o.setOffsets(e,t)}};t.exports=s},{131:131,136:136,137:137,44:44}],59:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function a(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function i(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function u(e){return e?e.substr(0,e.lastIndexOf(f)):""}function s(e,t){if(a(e)&&a(t)?void 0:d(!1),i(e,t)?void 0:d(!1),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,i=0;n>=i;i++)if(o(e,i)&&o(t,i))r=i;else if(e.charAt(i)!==t.charAt(i))break;var u=e.substr(0,r);return a(u)?void 0:d(!1),u}function c(e,t,n,r,o,a){e=e||"",t=t||"",e===t?d(!1):void 0;var l=i(t,e);l||i(e,t)?void 0:d(!1);for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||a&&f===t||(h=n(f,l,r)),h===!1||f===t)break;c++<v?void 0:d(!1)}}var p=e(76),d=e(142),f=".",h=f.length,v=1e4,m={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var a=l(e,t);a!==e&&c(e,a,n,r,!1,!0),a!==t&&c(a,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:i,SEPARATOR:f};t.exports=m},{142:142,76:76}],60:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],61:[function(e,t,n){"use strict";var r=e(28),o=e(30),a=e(29),i=e(38),u=e(50),s=(e(51),e(72)),l=e(82),c=e(23),p=e(119),d=u.createElement,f=u.createFactory,h=u.cloneElement,v={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:p},Component:o,createElement:d,cloneElement:h,isValidElement:u.isValidElement,PropTypes:s,createClass:a.createClass,createFactory:f,createMixin:function(e){return e},DOM:i,version:l,__spread:c};t.exports=v},{119:119,23:23,28:28,29:29,30:30,38:38,50:50,51:51,72:72,82:82}],62:[function(e,t,n){"use strict";var r=e(101),o=/\/?>/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};t.exports=a},{101:101}],63:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===W?e.documentElement:e.firstChild:null}function a(e){var t=o(e);return t&&Q.getID(t)}function i(e){var t=u(e);if(t)if(V.hasOwnProperty(t)){var n=V[t];n!==e&&(p(n,t)?L(!1):void 0,V[t]=e)}else V[t]=e;return t}function u(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function s(e,t){var n=u(e);n!==t&&delete V[n],e.setAttribute(B,t),V[t]=e}function l(e){return V.hasOwnProperty(e)&&p(V[e],e)||(V[e]=Q.findReactNodeByID(e)),V[e]}function c(e){var t=N.get(e)._rootNodeID;return D.isNullComponentID(t)?null:(V.hasOwnProperty(t)&&p(V[t],t)||(V[t]=Q.findReactNodeByID(t)),V[t])}function p(e,t){if(e){u(e)!==t?L(!1):void 0;var n=Q.findReactContainerForID(t);if(n&&O(n,e))return!0}return!1}function d(e){delete V[e]}function f(e){var t=V[e];return t&&p(t,e)?void(G=t):!1}function h(e){G=null,M.traverseAncestors(e,f);var t=G;return G=null,t}function v(e,t,n,r,o,a){E.useCreateElement&&(a=T({},a),n.nodeType===W?a[H]=n:a[H]=n.ownerDocument);var i=R.mountComponent(e,t,r,a);e._renderedComponent._topLevelWrapper=e,Q._mountImageIntoNode(i,n,o,r)}function m(e,t,n,r,o){var a=S.ReactReconcileTransaction.getPooled(r);a.perform(v,null,e,t,n,a,r,o),S.ReactReconcileTransaction.release(a)}function g(e,t){for(R.unmountComponent(e),t.nodeType===W&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=a(e);return t?t!==M.getReactRootIDFromNodeID(t):!1}function C(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=u(e);if(t){var n,r=M.getReactRootIDFromNodeID(t),o=e;do if(n=u(o),o=o.parentNode,null==o)return null;while(n!==r);if(o===Y[r])return e}}return null}var b=e(10),_=e(26),E=(e(34),e(39)),x=e(50),D=e(53),M=e(59),N=e(60),P=e(62),w=e(69),R=e(74),I=e(80),S=e(81),T=e(23),k=e(135),O=e(131),A=e(116),L=e(142),U=e(122),F=e(124),B=(e(126),e(151),b.ID_ATTRIBUTE_NAME),V={},j=1,W=9,K=11,H="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),q={},Y={},z=[],G=null,X=function(){};X.prototype.isReactComponent={},X.prototype.render=function(){return this.props};var Q={TopLevelWrapper:X,_instancesByReactRootID:q,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return Q.scrollMonitor(n,function(){I.enqueueElementInternal(e,t),r&&I.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==j&&t.nodeType!==W&&t.nodeType!==K?L(!1):void 0,_.ensureScrollValueMonitoring();var n=Q.registerContainer(t);return q[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var o=A(e,null),a=Q._registerComponent(o,t);return S.batchedUpdates(m,o,a,t,n,r),o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?L(!1):void 0,Q._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){x.isValidElement(t)?void 0:L(!1);var i=new x(X,null,null,null,null,null,t),s=q[a(n)];if(s){var l=s._currentElement,c=l.props;if(F(c,t)){var p=s._renderedComponent.getPublicInstance(),d=r&&function(){r.call(p)};return Q._updateRootComponent(s,i,n,d),p}Q.unmountComponentAtNode(n)}var f=o(n),h=f&&!!u(f),v=y(n),m=h&&!s&&!v,g=Q._renderNewRootComponent(i,n,m,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):k)._renderedComponent.getPublicInstance();return r&&r.call(g),g},render:function(e,t,n){return Q._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=a(e);return t&&(t=M.getReactRootIDFromNodeID(t)),t||(t=M.createReactRootID()),Y[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==j&&e.nodeType!==W&&e.nodeType!==K?L(!1):void 0;var t=a(e),n=q[t];if(!n){var r=(y(e),u(e));return r&&r===M.getReactRootIDFromNodeID(r),!1}return S.batchedUpdates(g,n,e),delete q[t],delete Y[t],!0},findReactContainerForID:function(e){var t=M.getReactRootIDFromNodeID(e),n=Y[t];return n},findReactNodeByID:function(e){var t=Q.findReactContainerForID(e);return Q.findComponentRoot(t,e)},getFirstReactDOM:function(e){return C(e)},findComponentRoot:function(e,t){var n=z,r=0,o=h(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var a,i=n[r++];i;){var u=Q.getID(i);u?t===u?a=i:M.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(i.firstChild)):n.push(i.firstChild),i=i.nextSibling}if(a)return n.length=0,a}n.length=0,L(!1)},_mountImageIntoNode:function(e,t,n,a){if(!t||t.nodeType!==j&&t.nodeType!==W&&t.nodeType!==K?L(!1):void 0,n){var i=o(t);if(P.canReuseMarkup(e,i))return;var u=i.getAttribute(P.CHECKSUM_ATTR_NAME);i.removeAttribute(P.CHECKSUM_ATTR_NAME);var s=i.outerHTML;i.setAttribute(P.CHECKSUM_ATTR_NAME,u);var l=e,c=r(l,s);" (client) "+l.substring(c-20,c+20)+"\n (server) "+s.substring(c-20,c+20),t.nodeType===W?L(!1):void 0}if(t.nodeType===W?L(!1):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(e)}else U(t,e)},ownerDocumentContextKey:H,getReactRootID:a,getID:i,setID:s,getNode:l,getNodeFromInstance:c,isValid:p,purgeID:d};w.measureMethods(Q,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=Q},{10:10,116:116,122:122,124:124,126:126,131:131,135:135,142:142,151:151,23:23,26:26,34:34,39:39,50:50,53:53,59:59,60:60,62:62,69:69,74:74,80:80,81:81}],64:[function(e,t,n){"use strict";function r(e,t,n){m.push({parentID:e,parentNode:null,type:p.INSERT_MARKUP,markupIndex:g.push(t)-1,content:null,fromIndex:null,toIndex:n})}function o(e,t,n){m.push({parentID:e,parentNode:null,type:p.MOVE_EXISTING,markupIndex:null,content:null,fromIndex:t,toIndex:n})}function a(e,t){m.push({parentID:e,parentNode:null,type:p.REMOVE_NODE,markupIndex:null,content:null,fromIndex:t,toIndex:null})}function i(e,t){m.push({parentID:e,parentNode:null,type:p.SET_MARKUP,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function u(e,t){m.push({parentID:e,parentNode:null,type:p.TEXT_CONTENT,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function s(){m.length&&(c.processChildrenUpdates(m,g),l())}function l(){m.length=0,g.length=0}var c=e(32),p=e(65),d=(e(34),e(74)),f=e(27),h=e(107),v=0,m=[],g=[],y={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return f.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r){var o;return o=h(t),f.updateChildren(e,o,n,r)},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],a=0;for(var i in r)if(r.hasOwnProperty(i)){var u=r[i],s=this._rootNodeID+i,l=d.mountComponent(u,s,t,n);u._mountIndex=a++,o.push(l)}return o},updateTextContent:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChild(n[r]);this.setTextContent(e),t=!1}finally{v--,v||(t?l():s())}},updateMarkup:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setMarkup(e),t=!1}finally{v--,v||(t?l():s())}},updateChildren:function(e,t,n){v++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{v--,v||(r?l():s())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=this._reconcilerUpdateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var a,i=0,u=0;for(a in o)if(o.hasOwnProperty(a)){var s=r&&r[a],l=o[a];s===l?(this.moveChild(s,u,i),i=Math.max(s._mountIndex,i),s._mountIndex=u):(s&&(i=Math.max(s._mountIndex,i),this._unmountChild(s)),this._mountChildByNameAtIndex(l,a,u,t,n)),u++}for(a in r)!r.hasOwnProperty(a)||o&&o.hasOwnProperty(a)||this._unmountChild(r[a])}},unmountChildren:function(){var e=this._renderedChildren;f.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){a(this._rootNodeID,e._mountIndex)},setTextContent:function(e){u(this._rootNodeID,e)},setMarkup:function(e){i(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var a=this._rootNodeID+t,i=d.mountComponent(e,a,r,o);e._mountIndex=n,this.createChild(e,i)},_unmountChild:function(e){this.removeChild(e),e._mountIndex=null}}};t.exports=y},{107:107,27:27,32:32,34:34,65:65,74:74}],65:[function(e,t,n){"use strict";var r=e(145),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});t.exports=o},{145:145}],66:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return c?void 0:s(!1),new c(e.type,e.props)}function a(e){return new d(e)}function i(e){return e instanceof d}var u=e(23),s=e(142),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:a,isTextComponent:i,injection:f};t.exports=h},{142:142,23:23}],67:[function(e,t,n){"use strict";function r(e,t){}var o=(e(151),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")},enqueueSetProps:function(e,t){r(e,"setProps")},enqueueReplaceProps:function(e,t){r(e,"replaceProps")}});t.exports=o},{151:151}],68:[function(e,t,n){"use strict";var r=e(142),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{142:142}],69:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],70:[function(e,t,n){"use strict";var r={};t.exports=r},{}],71:[function(e,t,n){"use strict";var r=e(145),o=r({prop:null,context:null,childContext:null});t.exports=o},{145:145}],72:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,a,i){if(o=o||E,i=i||r,null==n[r]){var u=C[a];return t?new Error("Required "+u+" `"+i+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,a,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if(u!==e){var s=C[o],l=m(i);return new Error("Invalid "+s+" `"+a+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function a(){return r(b.thatReturns(null))}function i(e){function t(t,n,r,o,a){var i=t[n];if(!Array.isArray(i)){var u=C[o],s=v(i);return new Error("Invalid "+u+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<i.length;l++){var c=e(i,l,r,o,a+"["+l+"]");if(c instanceof Error)return c}return null}return r(t)}function u(){function e(e,t,n,r,o){if(!y.isValidElement(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function s(e){function t(t,n,r,o,a){if(!(t[n]instanceof e)){var i=C[o],u=e.name||E,s=g(t[n]);return new Error("Invalid "+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o,a){for(var i=t[n],u=0;u<e.length;u++)if(i===e[u])return null;var s=C[o],l=JSON.stringify(e);return new Error("Invalid "+s+" `"+a+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+l+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function c(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,a+"."+l);if(c instanceof Error)return c}return null}return r(t)}function p(e){function t(t,n,r,o,a){for(var i=0;i<e.length;i++){var u=e[i];if(null==u(t,n,r,o,a))return null}var s=C[o];return new Error("Invalid "+s+" `"+a+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!h(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var l in e){var c=e[l];if(c){var p=c(i,l,r,o,a+"."+l);if(p)return p}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||y.isValidElement(e))return!0;var t=_(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!h(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function m(e){var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:"<<anonymous>>"}var y=e(50),C=e(70),b=e(134),_=e(113),E="<<anonymous>>",x={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:a(),arrayOf:i,element:u(),instanceOf:s,node:d(),objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=x},{113:113,134:134,50:50,70:70}],73:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null),this.useCreateElement=!e&&u.useCreateElement}var o=e(6),a=e(24),i=e(26),u=e(39),s=e(58),l=e(98),c=e(23),p={initialize:s.getSelectionInformation,close:s.restoreSelection},d={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[p,d,f],v={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};c(r.prototype,l.Mixin,v),a.addPoolingTo(r),t.exports=r},{23:23,24:24,26:26,39:39,58:58,6:6,98:98}],74:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(75),a={mountComponent:function(e,t,n,o){var a=e.mountComponent(t,n,o);return e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e),a},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,a){var i=e._currentElement;if(t!==i||a!==e._context){var u=o.shouldUpdateRefs(i,t);u&&o.detachRefs(e,i),e.receiveComponent(t,n,a),u&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e);
}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}};t.exports=a},{75:75}],75:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):a.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):a.removeComponentAsRefFrom(t,e,n)}var a=e(68),i={};i.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},i.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},i.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&o(n,e,t._owner)}},t.exports=i},{68:68}],76:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],77:[function(e,t,n){"use strict";var r={isBatchingUpdates:!1,batchedUpdates:function(e){}};t.exports=r},{}],78:[function(e,t,n){"use strict";function r(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!1),t.perform(function(){var r=f(e,null),o=r.mountComponent(n,t,d);return s.addChecksumToMarkup(o)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}function o(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!0),t.perform(function(){var r=f(e,null);return r.mountComponent(n,t,d)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}var a=e(48),i=e(50),u=e(59),s=e(62),l=e(77),c=e(79),p=e(81),d=e(135),f=e(116),h=e(142);t.exports={renderToString:r,renderToStaticMarkup:o}},{116:116,135:135,142:142,48:48,50:50,59:59,62:62,77:77,79:79,81:81}],79:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=a.getPooled(null),this.useCreateElement=!1}var o=e(24),a=e(6),i=e(98),u=e(23),s=e(134),l={initialize:function(){this.reactMountReady.reset()},close:s},c=[l],p={getTransactionWrappers:function(){return c},getReactMountReady:function(){return this.reactMountReady},destructor:function(){a.release(this.reactMountReady),this.reactMountReady=null}};u(r.prototype,i.Mixin,p),o.addPoolingTo(r),t.exports=r},{134:134,23:23,24:24,6:6,98:98}],80:[function(e,t,n){"use strict";function r(e){u.enqueueUpdate(e)}function o(e,t){var n=i.get(e);return n?n:null}var a=(e(34),e(50)),i=e(60),u=e(81),s=e(23),l=e(142),c=(e(151),{isMounted:function(e){var t=i.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t){"function"!=typeof t?l(!1):void 0;var n=o(e);return n?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){"function"!=typeof t?l(!1):void 0,e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var a=n._pendingStateQueue||(n._pendingStateQueue=[]);a.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");n&&c.enqueueSetPropsInternal(n,t)},enqueueSetPropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props,u=s({},i.props,t);n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,u)),r(n)},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");n&&c.enqueueReplacePropsInternal(n,t)},enqueueReplacePropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props;n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,t)),r(n)},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=c},{142:142,151:151,23:23,34:34,50:50,60:60,81:81}],81:[function(e,t,n){"use strict";function r(){N.ReactReconcileTransaction&&b?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=N.ReactReconcileTransaction.getPooled(!1)}function a(e,t,n,o,a,i){r(),b.batchedUpdates(e,t,n,o,a,i)}function i(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?m(!1):void 0,g.sort(i);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var a=0;a<o.length;a++)e.callbackQueue.enqueue(o[a],r.getPublicInstance())}}function s(e){return r(),b.isBatchingUpdates?void g.push(e):void b.batchedUpdates(s,e)}function l(e,t){b.isBatchingUpdates?void 0:m(!1),y.enqueue(e,t),C=!0}var c=e(6),p=e(24),d=e(69),f=e(74),h=e(98),v=e(23),m=e(142),g=[],y=c.getPooled(),C=!1,b=null,_={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},E={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[_,E];v(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,N.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var M={injectReconcileTransaction:function(e){e?void 0:m(!1),N.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:m(!1),"function"!=typeof e.batchedUpdates?m(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?m(!1):void 0,b=e}},N={ReactReconcileTransaction:null,batchedUpdates:a,enqueueUpdate:s,flushBatchedUpdates:D,injection:M,asap:l};t.exports=N},{142:142,23:23,24:24,6:6,69:69,74:74,98:98}],82:[function(e,t,n){"use strict";t.exports="0.14.7"},{}],83:[function(e,t,n){"use strict";var r=e(10),o=r.injection.MUST_USE_ATTRIBUTE,a={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},i={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,xlinkActuate:o,xlinkArcrole:o,xlinkHref:o,xlinkRole:o,xlinkShow:o,xlinkTitle:o,xlinkType:o,xmlBase:o,xmlLang:o,xmlSpace:o,y1:o,y2:o,y:o},DOMAttributeNamespaces:{xlinkActuate:a.xlink,xlinkArcrole:a.xlink,xlinkHref:a.xlink,xlinkRole:a.xlink,xlinkShow:a.xlink,xlinkTitle:a.xlink,xlinkType:a.xlink,xmlBase:a.xml,xmlLang:a.xml,xmlSpace:a.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};t.exports=i},{10:10}],84:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&s.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e,t){if(b||null==g||g!==c())return null;var n=r(g);if(!C||!f(C,n)){C=n;var o=l.getPooled(m.select,y,e,t);return o.type="select",o.target=g,i.accumulateTwoPhaseDispatches(o),o}return null}var a=e(15),i=e(19),u=e(128),s=e(58),l=e(90),c=e(137),p=e(118),d=e(146),f=e(149),h=a.topLevelTypes,v=u.canUseDOM&&"documentMode"in document&&document.documentMode<=11,m={select:{phasedRegistrationNames:{bubbled:d({onSelect:null}),captured:d({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},g=null,y=null,C=null,b=!1,_=!1,E=d({onSelect:null}),x={eventTypes:m,extractEvents:function(e,t,n,r,a){if(!_)return null;switch(e){case h.topFocus:(p(t)||"true"===t.contentEditable)&&(g=t,y=n,C=null);break;case h.topBlur:g=null,y=null,C=null;break;case h.topMouseDown:b=!0;break;case h.topContextMenu:case h.topMouseUp:return b=!1,o(r,a);case h.topSelectionChange:if(v)break;case h.topKeyDown:case h.topKeyUp:return o(r,a)}return null},didPutListener:function(e,t,n){t===E&&(_=!0)}};t.exports=x},{118:118,128:128,137:137,146:146,149:149,15:15,19:19,58:58,90:90}],85:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],86:[function(e,t,n){"use strict";var r=e(15),o=e(127),a=e(19),i=e(63),u=e(87),s=e(90),l=e(91),c=e(93),p=e(94),d=e(89),f=e(95),h=e(96),v=e(97),m=e(134),g=e(109),y=e(142),C=e(146),b=r.topLevelTypes,_={abort:{phasedRegistrationNames:{bubbled:C({onAbort:!0}),captured:C({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:C({onBlur:!0}),captured:C({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:C({onCanPlay:!0}),captured:C({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:C({onCanPlayThrough:!0}),captured:C({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:C({onClick:!0}),captured:C({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:C({onContextMenu:!0}),captured:C({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:C({onCopy:!0}),captured:C({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:C({onCut:!0}),captured:C({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:C({onDoubleClick:!0}),captured:C({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:C({onDrag:!0}),captured:C({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:C({onDragEnd:!0}),captured:C({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:C({onDragEnter:!0}),captured:C({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:C({onDragExit:!0}),captured:C({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:C({onDragLeave:!0}),captured:C({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:C({onDragOver:!0}),captured:C({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:C({onDragStart:!0}),captured:C({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:C({onDrop:!0}),captured:C({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:C({onDurationChange:!0}),captured:C({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:C({onEmptied:!0}),captured:C({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:C({onEncrypted:!0}),captured:C({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:C({onEnded:!0}),captured:C({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:C({onError:!0}),captured:C({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:C({onFocus:!0}),captured:C({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:C({onInput:!0}),captured:C({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:C({onKeyDown:!0}),captured:C({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:C({onKeyPress:!0}),captured:C({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:C({onKeyUp:!0}),captured:C({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:C({onLoad:!0}),captured:C({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:C({onLoadedData:!0}),captured:C({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:C({onLoadedMetadata:!0}),captured:C({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:C({onLoadStart:!0}),captured:C({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:C({onMouseDown:!0}),captured:C({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:C({onMouseMove:!0}),captured:C({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:C({onMouseOut:!0}),captured:C({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:C({onMouseOver:!0}),captured:C({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:C({onMouseUp:!0}),captured:C({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:C({onPaste:!0}),captured:C({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:C({onPause:!0}),captured:C({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:C({onPlay:!0}),captured:C({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:C({onPlaying:!0}),captured:C({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:C({onProgress:!0}),captured:C({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:C({onRateChange:!0}),captured:C({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:C({onReset:!0}),captured:C({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:C({onScroll:!0}),captured:C({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:C({onSeeked:!0}),captured:C({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:C({onSeeking:!0}),captured:C({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:C({onStalled:!0}),captured:C({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:C({onSubmit:!0}),captured:C({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:C({onSuspend:!0}),captured:C({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:C({onTimeUpdate:!0}),captured:C({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:C({onTouchCancel:!0}),captured:C({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:C({onTouchEnd:!0}),captured:C({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:C({onTouchMove:!0}),captured:C({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:C({onTouchStart:!0}),captured:C({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:C({onVolumeChange:!0}),captured:C({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:C({onWaiting:!0}),captured:C({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:C({onWheel:!0}),captured:C({onWheelCapture:!0})}}},E={topAbort:_.abort,topBlur:_.blur,topCanPlay:_.canPlay,topCanPlayThrough:_.canPlayThrough,topClick:_.click,topContextMenu:_.contextMenu,topCopy:_.copy,topCut:_.cut,topDoubleClick:_.doubleClick,topDrag:_.drag,topDragEnd:_.dragEnd,topDragEnter:_.dragEnter,topDragExit:_.dragExit,topDragLeave:_.dragLeave,topDragOver:_.dragOver,topDragStart:_.dragStart,topDrop:_.drop,topDurationChange:_.durationChange,topEmptied:_.emptied,topEncrypted:_.encrypted,topEnded:_.ended,topError:_.error,topFocus:_.focus,topInput:_.input,topKeyDown:_.keyDown,topKeyPress:_.keyPress,topKeyUp:_.keyUp,topLoad:_.load,topLoadedData:_.loadedData,topLoadedMetadata:_.loadedMetadata,topLoadStart:_.loadStart,topMouseDown:_.mouseDown,topMouseMove:_.mouseMove,topMouseOut:_.mouseOut,topMouseOver:_.mouseOver,topMouseUp:_.mouseUp,topPaste:_.paste,topPause:_.pause,topPlay:_.play,topPlaying:_.playing,topProgress:_.progress,topRateChange:_.rateChange,topReset:_.reset,topScroll:_.scroll,topSeeked:_.seeked,topSeeking:_.seeking,topStalled:_.stalled,topSubmit:_.submit,topSuspend:_.suspend,topTimeUpdate:_.timeUpdate,topTouchCancel:_.touchCancel,topTouchEnd:_.touchEnd,topTouchMove:_.touchMove,topTouchStart:_.touchStart,topVolumeChange:_.volumeChange,topWaiting:_.waiting,topWheel:_.wheel};for(var x in E)E[x].dependencies=[x];var D=C({onClick:null}),M={},N={eventTypes:_,extractEvents:function(e,t,n,r,o){var i=E[e];if(!i)return null;var m;switch(e){case b.topAbort:case b.topCanPlay:case b.topCanPlayThrough:case b.topDurationChange:case b.topEmptied:case b.topEncrypted:case b.topEnded:case b.topError:case b.topInput:case b.topLoad:case b.topLoadedData:case b.topLoadedMetadata:case b.topLoadStart:case b.topPause:case b.topPlay:case b.topPlaying:case b.topProgress:case b.topRateChange:case b.topReset:case b.topSeeked:case b.topSeeking:case b.topStalled:case b.topSubmit:case b.topSuspend:case b.topTimeUpdate:case b.topVolumeChange:case b.topWaiting:m=s;break;case b.topKeyPress:if(0===g(r))return null;case b.topKeyDown:case b.topKeyUp:m=c;break;case b.topBlur:case b.topFocus:m=l;break;case b.topClick:if(2===r.button)return null;case b.topContextMenu:case b.topDoubleClick:case b.topMouseDown:case b.topMouseMove:case b.topMouseOut:case b.topMouseOver:case b.topMouseUp:m=p;break;case b.topDrag:case b.topDragEnd:case b.topDragEnter:case b.topDragExit:case b.topDragLeave:case b.topDragOver:case b.topDragStart:case b.topDrop:m=d;break;case b.topTouchCancel:case b.topTouchEnd:case b.topTouchMove:case b.topTouchStart:m=f;break;case b.topScroll:m=h;break;case b.topWheel:m=v;break;case b.topCopy:case b.topCut:case b.topPaste:m=u}m?void 0:y(!1);var C=m.getPooled(i,n,r,o);return a.accumulateTwoPhaseDispatches(C),C},didPutListener:function(e,t,n){if(t===D){var r=i.getNode(e);M[e]||(M[e]=o.listen(r,"click",m))}},willDeleteListener:function(e,t){t===D&&(M[e].remove(),delete M[e])}};t.exports=N},{109:109,127:127,134:134,142:142,146:146,15:15,19:19,63:63,87:87,89:89,90:90,91:91,93:93,94:94,95:95,96:96,97:97}],87:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,a),t.exports=r},{90:90}],88:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={data:null};o.augmentClass(r,a),t.exports=r},{90:90}],89:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(94),a={dataTransfer:null};o.augmentClass(r,a),t.exports=r},{94:94}],90:[function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var u=o[a];u?this[a]=u(n):"target"===a?this.target=r:this[a]=n[a]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;s?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var o=e(24),a=e(23),i=e(134),u=(e(151),{type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});a(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=u,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);a(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=a({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.fourArgumentPooler)},o.addPoolingTo(r,o.fourArgumentPooler),t.exports=r},{134:134,151:151,23:23,24:24}],91:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a={relatedTarget:null};o.augmentClass(r,a),t.exports=r},{96:96}],92:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={data:null};o.augmentClass(r,a),t.exports=r},{90:90}],93:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(109),i=e(110),u=e(111),s={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?a(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?a(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),t.exports=r},{109:109,110:110,111:111,96:96}],94:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(99),i=e(111),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+a.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{111:111,96:96,99:99}],95:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(111),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};o.augmentClass(r,i),t.exports=r},{111:111,96:96}],96:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a=e(112),i={view:function(e){if(e.view)return e.view;var t=a(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,i),t.exports=r},{112:112,90:90}],97:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(94),a={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,a),t.exports=r},{94:94}],98:[function(e,t,n){"use strict";var r=e(142),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,a,i,u,s){this.isInTransaction()?r(!1):void 0;var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,a,i,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=a.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===a.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,i=t[n],u=this.wrapperInitData[n];try{o=!0,u!==a.OBSERVED_ERROR&&i.close&&i.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},a={Mixin:o,OBSERVED_ERROR:{}};t.exports=a},{142:142}],99:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],100:[function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(142);t.exports=r},{142:142}],101:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0,a=e.length,i=-4&a;i>r;){for(;r<Math.min(r+4096,i);r+=4)n+=(t+=e.charCodeAt(r))+(t+=e.charCodeAt(r+1))+(t+=e.charCodeAt(r+2))+(t+=e.charCodeAt(r+3));t%=o,n%=o}for(;a>r;r++)n+=t+=e.charCodeAt(r);return t%=o,n%=o,t|n<<16}var o=65521;t.exports=r},{}],102:[function(e,t,n){"use strict";var r=!1;t.exports=r},{}],103:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||a.hasOwnProperty(e)&&a[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(4),a=o.isUnitlessNumber;t.exports=r},{4:4}],104:[function(e,t,n){"use strict";function r(e,t,n,r,o){return o}e(23),e(151);t.exports=r},{151:151,23:23}],105:[function(e,t,n){"use strict";function r(e){return a[e]}function o(e){return(""+e).replace(i,r)}var a={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},i=/[&><"']/g;t.exports=o},{}],106:[function(e,t,n){"use strict";function r(e){return null==e?null:1===e.nodeType?e:o.has(e)?a.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render?i(!1):void 0,void i(!1))}var o=(e(34),e(60)),a=e(63),i=e(142);e(151);t.exports=r},{142:142,151:151,34:34,60:60,63:63}],107:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return a(e,r,t),t}var a=e(125);e(151);t.exports=o},{125:125,151:151}],108:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],109:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],110:[function(e,t,n){"use strict";function r(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var o=e(109),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{109:109}],111:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=a[e];return r?!!n[r]:!1}function o(e){return r}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],112:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],113:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[a]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=r},{}],114:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function a(e,t){for(var n=r(e),a=0,i=0;n;){if(3===n.nodeType){if(i=a+n.textContent.length,t>=a&&i>=t)return{node:n,offset:t-a};a=i}n=r(o(n))}}t.exports=a},{}],115:[function(e,t,n){"use strict";function r(){return!a&&o.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}var o=e(128),a=null;t.exports=r},{128:128}],116:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e){var t;if(null===e||e===!1)t=new i(o);else if("object"==typeof e){var n=e;!n||"function"!=typeof n.type&&"string"!=typeof n.type?l(!1):void 0,t="string"==typeof n.type?u.createInternalComponent(n):r(n.type)?new n.type(n):new c}else"string"==typeof e||"number"==typeof e?t=u.createInstanceForText(e):l(!1);return t.construct(e),t._mountIndex=0,t._mountImage=null,t}var a=e(33),i=e(52),u=e(66),s=e(23),l=e(142),c=(e(151),function(){});s(c.prototype,a.Mixin,{_instantiateReactComponent:o}),t.exports=o},{142:142,151:151,23:23,33:33,52:52,66:66}],117:[function(e,t,n){"use strict";function r(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,a=e(128);a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{128:128}],118:[function(e,t,n){"use strict";function r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&o[e.type]||"textarea"===t)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],119:[function(e,t,n){"use strict";function r(e){return o.isValidElement(e)?void 0:a(!1),e}var o=e(50),a=e(142);t.exports=r},{142:142,50:50}],120:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(105);t.exports=r},{105:105}],121:[function(e,t,n){"use strict";var r=e(63);t.exports=r.renderSubtreeIntoContainer},{63:63}],122:[function(e,t,n){"use strict";var r=e(128),o=/^[ \r\n\t\f]/,a=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&a.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{128:128}],123:[function(e,t,n){"use strict";var r=e(128),o=e(105),a=e(122),i=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){a(e,o(t))})),t.exports=i},{105:105,122:122,128:128}],124:[function(e,t,n){"use strict";function r(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,a=typeof t;return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}t.exports=r},{}],125:[function(e,t,n){"use strict";function r(e){return v[e]}function o(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function a(e){return(""+e).replace(m,r)}function i(e){return"$"+a(e)}function u(e,t,n,r){var a=typeof e;if(("undefined"===a||"boolean"===a)&&(e=null),null===e||"string"===a||"number"===a||l.isValidElement(e))return n(r,e,""===t?f+o(e,0):t),1;var s,c,v=0,m=""===t?f:t+h;if(Array.isArray(e))for(var g=0;g<e.length;g++)s=e[g],
c=m+o(s,g),v+=u(s,c,n,r);else{var y=p(e);if(y){var C,b=y.call(e);if(y!==e.entries)for(var _=0;!(C=b.next()).done;)s=C.value,c=m+o(s,_++),v+=u(s,c,n,r);else for(;!(C=b.next()).done;){var E=C.value;E&&(s=E[1],c=m+i(E[0])+h+o(s,0),v+=u(s,c,n,r))}}else"object"===a&&(String(e),d(!1))}return v}function s(e,t,n){return null==e?0:u(e,"",t,n)}var l=(e(34),e(50)),c=e(59),p=e(113),d=e(142),f=(e(151),c.SEPARATOR),h=":",v={"=":"=0",".":"=1",":":"=2"},m=/[=.:]/g;t.exports=s},{113:113,142:142,151:151,34:34,50:50,59:59}],126:[function(e,t,n){"use strict";var r=(e(23),e(134)),o=(e(151),r);t.exports=o},{134:134,151:151,23:23}],127:[function(e,t,n){"use strict";var r=e(134),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{134:134}],128:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],129:[function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],130:[function(e,t,n){"use strict";function r(e){return o(e.replace(a,"ms-"))}var o=e(129),a=/^-ms-/;t.exports=r},{129:129}],131:[function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,a=t;if(n=!1,r&&a){if(r===a)return!0;if(o(r))return!1;if(o(a)){e=r,t=a.parentNode,n=!0;continue e}return r.contains?r.contains(a):r.compareDocumentPosition?!!(16&r.compareDocumentPosition(a)):!1}return!1}}var o=e(144);t.exports=r},{144:144}],132:[function(e,t,n){"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():a(e):[e]}var a=e(150);t.exports=o},{150:150}],133:[function(e,t,n){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;l?void 0:s(!1);var o=r(e),a=o&&u(o);if(a){n.innerHTML=a[1]+e+a[2];for(var c=a[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),i(p).forEach(t));for(var d=i(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var a=e(128),i=e(132),u=e(138),s=e(142),l=a.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{128:128,132:132,138:138,142:142}],134:[function(e,t,n){"use strict";function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],135:[function(e,t,n){"use strict";var r={};t.exports=r},{}],136:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],137:[function(e,t,n){"use strict";function r(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],138:[function(e,t,n){"use strict";function r(e){return i?void 0:a(!1),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?i.innerHTML="<link />":i.innerHTML="<"+e+"></"+e+">",u[e]=!i.firstChild),u[e]?d[e]:null}var o=e(128),a=e(142),i=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){d[e]=p,u[e]=!0}),t.exports=r},{128:128,142:142}],139:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],140:[function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],141:[function(e,t,n){"use strict";function r(e){return o(e).replace(a,"-ms-")}var o=e(140),a=/^ms-/;t.exports=r},{140:140}],142:[function(e,t,n){"use strict";function r(e,t,n,r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,i,u],c=0;s=new Error(t.replace(/%s/g,function(){return l[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}t.exports=r},{}],143:[function(e,t,n){"use strict";function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],144:[function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=e(143);t.exports=r},{143:143}],145:[function(e,t,n){"use strict";var r=e(142),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{142:142}],146:[function(e,t,n){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],147:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var a in e)o.call(e,a)&&(r[a]=t.call(n,e[a],a,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],148:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],149:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=o.bind(t),i=0;i<n.length;i++)if(!a(n[i])||e[n[i]]!==t[n[i]])return!1;return!0}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],150:[function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),a=0;t>a;a++)r[a]=e[a];return r}var o=e(142);t.exports=r},{142:142}],151:[function(e,t,n){"use strict";var r=e(134),o=r;t.exports=o},{134:134}]},{},[1])(1)});
stjs.ns("squp.ext.view");squp.ext.view.ViewExtensionPoint=function(){};squp.ext.view.ViewExtensionPoint=stjs.extend(squp.ext.view.ViewExtensionPoint,null,[],function(constructor,prototype){constructor.ID="ext.view";prototype.show=function(container){};prototype.hide=function(){};prototype.getHeaderText=function(){};},{},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.DataItem=function(key,data,type){this.key=key;this.data=data;this.type=type;};squp.ext.dataprovider.DataItem=stjs.extend(squp.ext.dataprovider.DataItem,null,[],function(constructor,prototype){prototype.key=null;prototype.data=null;prototype.type=null;},{key:"squp.data.UniqueKey",type:{name:"Class",arguments:["T"]}},{});stjs.ns("squp.format");squp.format.SimpleParsers=function(){};squp.format.SimpleParsers=stjs.extend(squp.format.SimpleParsers,null,[],function(constructor,prototype){constructor.DATE_EXP=new RegExp("^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)$");constructor.parseISO8601=function(date){if(date==null){return null;}
return shortIso8601Parse(date);};constructor.parseDate=function(value){var match=squp.format.SimpleParsers.DATE_EXP.exec(value);if(match!=null){return new Date(parseInt(match[1]),parseInt(match[2])-1,parseInt(match[3]),parseInt(match[4]),parseInt(match[5]),parseInt(match[6]),0);}
return null;};},{DATE_EXP:"RegExp"},{});stjs.ns("squp.ext.view");squp.ext.view.ViewManager=function(){};squp.ext.view.ViewManager=stjs.extend(squp.ext.view.ViewManager,null,[],function(constructor,prototype){prototype.show=function(extension){};prototype.getCurrentView=function(){};},{},{});stjs.ns("squp.ext.widget");squp.ext.widget.WidgetFactory=function(){};squp.ext.widget.WidgetFactory=stjs.extend(squp.ext.widget.WidgetFactory,null,[],function(constructor,prototype){prototype.getType=function(){};prototype.getName=function(){};prototype.isLimitReached=function(){};prototype.init=function(){};prototype.getOptimalWidgetWidthUnits=function(){};prototype.createWidget=function(widgetData){};},{},{});stjs.ns("squp.util");squp.util.Profiler=function(){};squp.util.Profiler=stjs.extend(squp.util.Profiler,null,[],function(constructor,prototype){prototype.time=function(timerName){};prototype.timeEnd=function(timerName){};prototype.profile=function(profilerName){};prototype.profileEnd=function(profilerName){};},{},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.DataManager=function(){};squp.ext.dataprovider.DataManager=stjs.extend(squp.ext.dataprovider.DataManager,null,[],function(constructor,prototype){constructor.MODULE_ID="squp/feature.dataprovider/manager";prototype.getSubscribableTypes=function(keyTypes){};prototype.subscribe=function(keys,subscriber){};prototype.subscribeToType=function(keys,type,subscriber){};prototype.unsubscribe=function(keys,subscriber){};prototype.unsubscribeFromType=function(keys,type,subscriber){};prototype.unsubscribeAll=function(subscriber){};prototype.unsubscribeAllFromType=function(type,subscriber){};},{},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.DataProviderExtensionPoint=function(){};squp.ext.dataprovider.DataProviderExtensionPoint=stjs.extend(squp.ext.dataprovider.DataProviderExtensionPoint,null,[],function(constructor,prototype){constructor.ID="ext.dataprovider";prototype.getDataType=function(){};prototype.getSubscribableKeyTypes=function(){};prototype.getData=function(keys){};prototype.subscribe=function(keys,listener){};prototype.unsubscribeFrom=function(keys,listener){};prototype.unsubscribeAll=function(listener){};},{},{});stjs.ns("squp.util");squp.util.Logger=function(){};squp.util.Logger=stjs.extend(squp.util.Logger,null,[],function(constructor,prototype){prototype.log=function(_arguments){};prototype.warn=function(_arguments){};prototype.error=function(_arguments){};prototype.debug=function(_arguments){};prototype.trace=function(_arguments){};prototype.info=function(_arguments){};prototype.dir=function(object){};},{},{});stjs.ns("squp.ext.widget");squp.ext.widget.WidgetController=function(){};squp.ext.widget.WidgetController=stjs.extend(squp.ext.widget.WidgetController,null,[],function(constructor,prototype){prototype.onRender=function(view){};prototype.onAdded=function(data){};prototype.onResize=function(oldWidthPixels,newWidthPixels){};prototype.onCollapse=function(){};prototype.onExpand=function(){};prototype.onHide=function(){};prototype.onShow=function(){};prototype.onFooterSticky=function(columnOffsetBottom){};prototype.onFooterUnsticky=function(){};prototype.onBeforeRemove=function(){};prototype.onRemove=function(){};prototype.onDestroy=function(){};prototype.helpButtonClicked=function(){};},{},{});stjs.ns("squp");squp.ExtensionContributor=function(){};squp.ExtensionContributor=stjs.extend(squp.ExtensionContributor,null,[],function(constructor,prototype){prototype.getExtensionPointId=function(){};prototype.getId=function(){};prototype.getAlias=function(){};prototype.getInstance=function(){};},{},{});stjs.ns("squp.ext.route");squp.ext.route.RouterExtensionPoint=function(){};squp.ext.route.RouterExtensionPoint=stjs.extend(squp.ext.route.RouterExtensionPoint,null,[],function(constructor,prototype){constructor.ID="ext.route";prototype.route=function(path){};},{},{});stjs.ns("squp.util");squp.util.ErrorResponse=function(jQueryXHR,s,s2){this.jQueryXHR=jQueryXHR;this.s=s;this.s2=s2;};squp.util.ErrorResponse=stjs.extend(squp.util.ErrorResponse,null,[],function(constructor,prototype){prototype.jQueryXHR=null;prototype.s=null;prototype.s2=null;},{jQueryXHR:"JQueryXHR"},{});stjs.ns("squp.ext.widget");squp.ext.widget.WidgetView=function(){};squp.ext.widget.WidgetView=stjs.extend(squp.ext.widget.WidgetView,null,[],function(constructor,prototype){prototype.getRootElement=function(){};prototype.getBody=function(){};prototype.getHeaderExtraContent=function(){};prototype.setEditable=function(onEnterEditMode,onExitEditMode){};prototype.setTitle=function(title){};prototype.setTitleEditable=function(onTitleChanged){};prototype.getWidthPixels=function(){};},{},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.DataCacheSupport=function(){this.cache={};};squp.ext.dataprovider.DataCacheSupport=stjs.extend(squp.ext.dataprovider.DataCacheSupport,null,[],function(constructor,prototype){prototype.cache=null;prototype.putInCache=function(key,value){var cacheKey=this.toCacheKey(key);var cached=this.cache[cacheKey];if(cached!=null){cached.updateCount++;cached.lastUpdate=new Date();cached.value=this.merge(cached.value,value);}else{cached=new squp.ext.dataprovider.DataCacheSupport.CacheEntry();cached.updateCount=0;cached.lastUpdate=new Date();cached.value=this.merge(this.emptyItemInstance(),value);this.cache[cacheKey]=cached;}
this.adjust(cached);return this.merge(this.emptyItemInstance(),cached.value);};prototype.merge=function(target,source){var sourceProperties=(source);for(var key in sourceProperties){if(sourceProperties[key]!=null){(target)[key]=sourceProperties[key];}}
return target;};prototype.getAllFromCache=function(keys){var result=[];for(var i=0;i<keys.length;i++){result.push(this.getFromCache(keys[i]));}
return result;};prototype.getFromCache=function(key){var cacheKey=this.toCacheKey(key);var cached=this.cache[cacheKey];if(cached!=null){var cloned=this.emptyItemInstance();this.merge(cloned,cached.value);return cloned;}
return null;};prototype.emptyItemInstance=function(){};prototype.adjust=function(entry){};prototype.toCacheKey=function(key){};constructor.CacheEntry=function(){};constructor.CacheEntry=stjs.extend(constructor.CacheEntry,null,[],function(constructor,prototype){prototype.updateCount=0;prototype.lastUpdate=null;prototype.value=null;prototype.getLastUpdate=function(){return this.lastUpdate;};prototype.getUpdateCount=function(){return this.updateCount;};prototype.getValue=function(){return this.value;};},{lastUpdate:"Date"},{});},{cache:{name:"Map",arguments:[null,{name:"squp.ext.dataprovider.DataCacheSupport.CacheEntry",arguments:["VALUE"]}]}},{});stjs.ns("squp.util");squp.util.SubscribableDataSource=function(){};squp.util.SubscribableDataSource=stjs.extend(squp.util.SubscribableDataSource,null,[],function(constructor,prototype){prototype.getCurrentData=function(){};prototype.setCurrentData=function(newData){};prototype.addWatcher=function(callback){};prototype.removeWatcher=function(callback){};},{},{});stjs.ns("squp.ext.widget");squp.ext.widget.WidgetFactoryExtensionPoint=function(){};squp.ext.widget.WidgetFactoryExtensionPoint=stjs.extend(squp.ext.widget.WidgetFactoryExtensionPoint,null,[],function(constructor,prototype){constructor.ID="ext.widget";prototype.getType=function(){};prototype.getName=function(){};prototype.init=function(){};prototype.createWidget=function(widgetData){};prototype.getWidgetOptimalWidthUnits=function(){};},{},{});stjs.ns("squp.ext.i18n");squp.ext.i18n.ContextStatus=stjs.enumeration("REGISTERED","LOADING","LOADED","ERROR");stjs.ns("squp");squp.Platform=function(){};squp.Platform=stjs.extend(squp.Platform,null,[],function(constructor,prototype){prototype.extensions=function(){};},{},{});stjs.ns("squp.ext.featuretour");squp.ext.featuretour.FeatureTourExtensionPoint=function(){};squp.ext.featuretour.FeatureTourExtensionPoint=stjs.extend(squp.ext.featuretour.FeatureTourExtensionPoint,null,[],function(constructor,prototype){constructor.ID="ext.featuretour";prototype.marker=function(){};prototype.getFeatureTourSteps=function(){};},{},{});stjs.ns("squp.ext.nav");squp.ext.nav.NavigationItem=function(key,weight,title,label,css,url){this.key=key;this.weight=weight;this.title=title;this.label=label;this.css=css;this.url=url;};squp.ext.nav.NavigationItem=stjs.extend(squp.ext.nav.NavigationItem,null,[],function(constructor,prototype){prototype.key=null;prototype.weight=0.0;prototype.title=null;prototype.label=null;prototype.css=null;prototype.url=null;prototype.getKey=function(){return this.key;};prototype.getWeight=function(){return this.weight;};prototype.getTitle=function(){return this.title;};prototype.getLabel=function(){return this.label;};prototype.getCss=function(){return this.css;};prototype.getUrl=function(){return this.url;};},{},{});stjs.ns("squp");squp.ExtensionRegistry=function(){};squp.ExtensionRegistry=stjs.extend(squp.ExtensionRegistry,null,[],function(constructor,prototype){prototype.defineContributor=function(extensionPointId,contributorId,alias){};prototype.isContributorAliasDefined=function(extensionPointId,alias){};prototype.isContributorDefined=function(contributorId){};prototype.requireContributor=function(extensionPointId,alias,callback){};prototype.requireContributors=function(extensionPointId,callback){};prototype.requireContributorsArray=function(extensionPointId,callback){};prototype.loadContributor=function(extensionPointId,alias){};prototype.loadContributors=function(extensionPointId){};prototype.loadContributorsArray=function(extensionPointId){};},{},{});stjs.ns("squp.util");squp.util.DoubleComparison=function(){};squp.util.DoubleComparison=stjs.extend(squp.util.DoubleComparison,null,[],function(constructor,prototype){constructor.EPSILON=1.0E-6;constructor.doubleEquals=function(a,b){return squp.util.DoubleComparison.equals1(a,b,squp.util.DoubleComparison.EPSILON);};constructor.equals1=function(a,b,epsilon){return a==b?true:Math.abs(a-b)<epsilon;};},{},{});stjs.ns("squp.ext.featuretour");squp.ext.featuretour.FeatureTourStep=function(target,title,text,isAlignedRight){if(target!=null&&target.size()>0){this.target=target;}
this.title=title;this.text=text;this.isAlignedRight=isAlignedRight;};squp.ext.featuretour.FeatureTourStep=stjs.extend(squp.ext.featuretour.FeatureTourStep,null,[],function(constructor,prototype){prototype.target=null;prototype.title=null;prototype.text=null;prototype.beforeCallback=null;prototype.afterCallback=null;prototype.isAlignedRight=false;prototype.invokeBeforeCallback=function(){if(this.beforeCallback!=null){this.beforeCallback(this.target);}};prototype.invokeAfterCallback=function(){if(this.afterCallback!=null){this.afterCallback(this.target);}};prototype.setBeforeCallback=function(beforeCallback){this.beforeCallback=beforeCallback;};prototype.setAfterCallback=function(afterCallback){this.afterCallback=afterCallback;};},{target:{name:"JQueryAndPlugins",arguments:["Object"]},beforeCallback:{name:"Callback1",arguments:[{name:"JQueryAndPlugins",arguments:["Object"]}]},afterCallback:{name:"Callback1",arguments:[{name:"JQueryAndPlugins",arguments:["Object"]}]}},{});stjs.ns("squp.ext.nav");squp.ext.nav.ActionItem=function(action){this.action=action;this.properties={};};squp.ext.nav.ActionItem=stjs.extend(squp.ext.nav.ActionItem,null,[],function(constructor,prototype){prototype.action=null;prototype.properties=null;prototype.addProperty=function(key,value){this.properties[key]=value;return this;};prototype.getAction=function(){return this.action;};prototype.getProperties=function(){return this.properties;};},{action:"Callback0",properties:{name:"Map",arguments:[null,"Object"]}},{});stjs.ns("squp.format");squp.format.SimpleFormatters=function(){};squp.format.SimpleFormatters=stjs.extend(squp.format.SimpleFormatters,null,[],function(constructor,prototype){constructor.NON_BREAKING_SPACE=(String).fromCharCode(160);constructor.PERCENT_SIGN="%";constructor.STRING=function(s){if(s==null||$.trim(s.toString()).equals("")){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return $.trim(s.toString());};constructor.formatString=function(s){return squp.format.SimpleFormatters.STRING(s);};constructor.SHORT_DATE=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"dd mmm");};constructor.formatShortDate=function(date){return squp.format.SimpleFormatters.SHORT_DATE(date);};constructor.FULL_DATE=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"dd mmm yyyy HH:MM");};constructor.formatFullDate=function(date){return squp.format.SimpleFormatters.FULL_DATE(date);};constructor.DATE=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"dd mmm yyyy");};constructor.DATE_WITH_SLASH=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"dd/mm/yyyy");};constructor.formatDateWithSlashes=function(d){return squp.format.SimpleFormatters.DATE_WITH_SLASH(d);};constructor.formatDate=function(d){return squp.format.SimpleFormatters.DATE(d);};constructor.SHORT_ISO8601_DATE=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"yyyy-mm-dd");};constructor.formatShortISO8601Date=function(date){return squp.format.SimpleFormatters.SHORT_ISO8601_DATE(date);};constructor.TIME=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"HH:MM:ss");};constructor.formatTime=function(date){return squp.format.SimpleFormatters.TIME(date);};constructor.TIME_SHORT=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return dateFormat(date,"HH:MM");};constructor.formatTimeShort=function(date){return squp.format.SimpleFormatters.TIME_SHORT(date);};constructor.NUMBER_WITH_INFINITY=function(number,format){if(Double.POSITIVE_INFINITY==number||Double.NEGATIVE_INFINITY==number){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return numberFormat(number,format);};constructor.formatNumberWithInfinity=function(number,format){return squp.format.SimpleFormatters.NUMBER_WITH_INFINITY(number,format);};constructor.NUMBER_WITH_INFINITY_AND_PERCENT=function(number,format){var result=squp.format.SimpleFormatters.formatNumberWithInfinity(number,format);if(squp.format.SimpleFormatters.NON_BREAKING_SPACE!=result){result+=squp.format.SimpleFormatters.PERCENT_SIGN;}
return result;};constructor.formatNumberWithInfinityAndPercent=function(number,format){return squp.format.SimpleFormatters.NUMBER_WITH_INFINITY_AND_PERCENT(number,format);};constructor.NUMBER_WITH_2_DECIMALS=function(number){if(isNaN(number)||number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.00");};constructor.formatNumberWith2Decimals=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_2_DECIMALS(number);};constructor.NUMBER_WITH_2_DECIMALS_NULL_DASH=function(number){if(isNaN(number)||number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.00");};constructor.formatNumberWith2DecimalsNullDash=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_2_DECIMALS_NULL_DASH(number);};constructor.NUMBER_WITH_2_TO_4_DECIMALS=function(number){if(number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.00##");};constructor.NUMBER_WITH_DIRECTLY_4_DECIMALS=function(number){if(number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.0000");};constructor.formatNumberWith2To4Decimals=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_2_TO_4_DECIMALS(number);};constructor.formatNumberWithDirectly4Decimals=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_DIRECTLY_4_DECIMALS(number);};constructor.NUMBER_WITH_MIN_2_DECIMALS=function(number){if(number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.00###");};constructor.formatNumberWithMin2Decimals=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_MIN_2_DECIMALS(number);};constructor.NUMBER=function(number){if(number==null||isNaN(number)){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.##");};constructor.NUMBER4=function(number){if(number==null||isNaN(number)){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.####");};constructor.formatNumber=function(number){return squp.format.SimpleFormatters.NUMBER(number);};constructor.formatNumberWith4Dec=function(number){return squp.format.SimpleFormatters.NUMBER4(number);};constructor.NUMBER_WITH_PERCENT=function(o){var value=squp.format.SimpleFormatters.NUMBER(o);if(squp.format.SimpleFormatters.NON_BREAKING_SPACE==value){return value;}
return value+squp.format.SimpleFormatters.PERCENT_SIGN;};constructor.formatNumberWithPercent=function(number){return squp.format.SimpleFormatters.NUMBER_WITH_PERCENT(number);};constructor.NUMBER_DASH_NULL=function(number){if(number==null){return"--";}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.##");};constructor.formatNumberDashNull=function(number){return squp.format.SimpleFormatters.NUMBER_DASH_NULL(number);};constructor.INTEGER=function(number){if(number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000");};constructor.SEMI_INTEGER=function(number){if(number==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
if(Math.abs(Math.round(number)-number)>9.0E-5){return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000.####");}
return squp.format.SimpleFormatters.formatNumberWithInfinity(number,"0'000");};constructor.formatInteger=function(number){return squp.format.SimpleFormatters.INTEGER(number);};constructor.NUMBER_WITH_2_DECIMALS_AND_PERCENT=function(value){if(isNaN(value)||value==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinityAndPercent(value,"0'000.00");};constructor.formatNumberWith2DecimalsAndPercent=function(value){return squp.format.SimpleFormatters.NUMBER_WITH_2_DECIMALS_AND_PERCENT(value);};constructor.formatNumberWithSign2DecimalsAndPercent=function(value){return((value>0)?"+":"")+squp.format.SimpleFormatters.NUMBER_WITH_2_DECIMALS_AND_PERCENT(value);};constructor.VARIATION_AS_PERCENT=function(value){if(isNaN(value)||value==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.formatNumberWithInfinityAndPercent(value*100,"0'000.00");};constructor.formatVariationAsPercent=function(value){return squp.format.SimpleFormatters.VARIATION_AS_PERCENT(value);};constructor.VALIDITY_DATE=function(date){if(date==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
var withYear=squp.format.SimpleFormatters.formatValidityDateTime(date,false);if(withYear=="DAY"){return withYear;}
var parts=(withYear).split(" ");return parts[0]+" "+parts[1];};constructor.formatValidityDate=function(date){return squp.format.SimpleFormatters.VALIDITY_DATE(date);};constructor.VALIDITY_DATE_TIME=function(dateAndTime,withTime){if(dateAndTime==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
var today=dateFormat(new Date(),"dd mmm yyyy");var date;var time;if("string".equals((typeof dateAndTime))){var parts=(dateAndTime.toString()).split(" ");if(parts[0]==""){date=today;time=parts[1];}else{date=parts[0];time=parts[1];}}else{var formattedDateAndTime=dateFormat(dateAndTime,"dd mmm yyyy HH:MM:ss");var parts=(formattedDateAndTime).split(" ");date=parts[0]+" "+parts[1]+" "+parts[2];time=parts[3];}
if(date.equals(today)){return withTime?time:"DAY";}
return date;};constructor.formatValidityDateTime=function(dateAndTime,withTime){return squp.format.SimpleFormatters.VALIDITY_DATE_TIME(dateAndTime,withTime);};constructor.IBAN_FORMATTER=function(iban,clientId){if(clientId==null){return iban;}
var start=iban.substring(0,iban.indexOf(clientId));var end=iban.substring(iban.indexOf(clientId)+clientId.length);return start+"<span class='clientId'>"+clientId+"</span>"+end;};constructor.formatIban=function(iban,clientId){if(iban==null||$.trim(iban).equals("")){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
return squp.format.SimpleFormatters.IBAN_FORMATTER(iban,clientId);};constructor.MCAP_FORMATTER=function(mCap){if(mCap==null){return squp.format.SimpleFormatters.NON_BREAKING_SPACE;}
var million=1000000;var billion=1000000000;if((mCap>=million)&&(mCap<billion)){return Math.floor((mCap/million)*100)/100+"M";}else if(mCap>=billion){return Math.floor((mCap/billion)*100)/100+"B";}
return numberFormat(Math.floor(mCap),"0'000");};constructor.formatMcap=function(mCap){return squp.format.SimpleFormatters.MCAP_FORMATTER(mCap);};},{STRING:{name:"Function1",arguments:["Object",null]},SHORT_DATE:{name:"Function1",arguments:["Object",null]},FULL_DATE:{name:"Function1",arguments:["Object",null]},DATE:{name:"Function1",arguments:["Object",null]},DATE_WITH_SLASH:{name:"Function1",arguments:["Object",null]},SHORT_ISO8601_DATE:{name:"Function1",arguments:["Object",null]},TIME:{name:"Function1",arguments:["Object",null]},TIME_SHORT:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_INFINITY:{name:"Function2",arguments:["Object",null,null]},NUMBER_WITH_INFINITY_AND_PERCENT:{name:"Function2",arguments:["Object",null,null]},NUMBER_WITH_2_DECIMALS:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_2_DECIMALS_NULL_DASH:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_2_TO_4_DECIMALS:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_DIRECTLY_4_DECIMALS:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_MIN_2_DECIMALS:{name:"Function1",arguments:["Object",null]},NUMBER:{name:"Function1",arguments:["Object",null]},NUMBER4:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_PERCENT:{name:"Function1",arguments:["Object",null]},NUMBER_DASH_NULL:{name:"Function1",arguments:["Object",null]},INTEGER:{name:"Function1",arguments:["Object",null]},SEMI_INTEGER:{name:"Function1",arguments:["Object",null]},NUMBER_WITH_2_DECIMALS_AND_PERCENT:{name:"Function1",arguments:["Object",null]},VARIATION_AS_PERCENT:{name:"Function1",arguments:["Object",null]},VALIDITY_DATE:{name:"Function1",arguments:["Object",null]},VALIDITY_DATE_TIME:{name:"Function2",arguments:["Object",null,null]},IBAN_FORMATTER:{name:"Function2",arguments:[null,null,null]},MCAP_FORMATTER:{name:"Function1",arguments:[null,null]}},{});stjs.ns("squp");squp.ExtensionLoadError=function(contributor,reason){this.contributor=contributor;this.reason=reason;};squp.ExtensionLoadError=stjs.extend(squp.ExtensionLoadError,null,[],function(constructor,prototype){prototype.contributor=null;prototype.reason=null;prototype.toString=function(){return"Failed to load module \""+this.contributor.getId()+"\" as alias \""+this.contributor.getAlias()+"\" for extension point \""+this.contributor.getExtensionPointId()+"\". Cause: "+this.reason;};},{contributor:{name:"squp.ExtensionContributor",arguments:["Object"]}},{});stjs.ns("squp.ext.route");squp.ext.route.PathElement=function(value){this.value=value;this.parameters=this.extractParameters(value);this.matcher=this.extractMatcher(value);};squp.ext.route.PathElement=stjs.extend(squp.ext.route.PathElement,null,[],function(constructor,prototype){constructor.PARAMETER_DECLARATION=new RegExp(":([^\\/]+)");constructor.PARAMETER_USAGE="([^\\/]*)";prototype.value=null;prototype.parameters=null;prototype.matcher=null;prototype.tryMatch=function(instance){var match=this.matcher.exec(instance.value);if(match==null){return null;}
match.shift();var params={};for(var i=0;i<this.parameters.length;i++){var key=this.parameters[i];var value=this.castValue(match[i]);params[key]=value;}
return params;};prototype.getParameters=function(){return this.parameters;};prototype.extractParameters=function(value){var result=[];var declarationMatch=squp.ext.route.PathElement.PARAMETER_DECLARATION.exec(value);if(declarationMatch!=null){for(var i=1;i<declarationMatch.length;i++){result.push(declarationMatch[i]);}}
return result;};prototype.extractMatcher=function(path){var expression=(path).replace(squp.ext.route.PathElement.PARAMETER_DECLARATION,squp.ext.route.PathElement.PARAMETER_USAGE);return new RegExp("^"+expression+"$");};prototype.castValue=function(value){if(value.equals("false")){return false;}else if(value.equals("true")){return true;}else if(value.equals("null")){return null;}
var num=parseFloat(value);if(!isNaN(num)&&isFinite(value)){return num;}
if(value.startsWith("\"")&&value.endsWith("\"")){return value.substring(1,value.length-1);}
return value;};},{PARAMETER_DECLARATION:"RegExp",parameters:{name:"Array",arguments:[null]},matcher:"RegExp"},{});stjs.ns("squp.util");squp.util.LoggerFactory=function(){};squp.util.LoggerFactory=stjs.extend(squp.util.LoggerFactory,null,[],function(constructor,prototype){constructor.loggerConstructor=null;constructor.getLogger=function(loggerName){return new squp.util.LoggerFactory.LoggerProxy(loggerName);};constructor.getLoggerConstructor=function(){if(squp.util.LoggerFactory.loggerConstructor!=null){return squp.util.LoggerFactory.loggerConstructor;}
return squp.util.LoggerFactory.buildLogger;};constructor.setLoggerConstructor=function(constructor){squp.util.LoggerFactory.loggerConstructor=constructor;};constructor.buildLogger=function(loggerName){return new squp.util.LoggerFactory.ConsoleLogger(loggerName);};constructor.LoggerProxy=function(name){this.name=name;};constructor.LoggerProxy=stjs.extend(constructor.LoggerProxy,null,[squp.util.Logger],function(constructor,prototype){prototype.name=null;prototype.delegate=null;prototype.getDelegate=function(){if(this.delegate==null){this.delegate=squp.util.LoggerFactory.getLoggerConstructor()(this.name);}
return this.delegate;};prototype.debug=function(_arguments){((this.getDelegate())["debug"]).apply(this.getDelegate(),arguments);};prototype.error=function(_arguments){((this.getDelegate())["error"]).apply(this.getDelegate(),arguments);};prototype.info=function(_arguments){((this.getDelegate())["info"]).apply(this.getDelegate(),arguments);};prototype.log=function(_arguments){((this.getDelegate())["log"]).apply(this.getDelegate(),arguments);};prototype.trace=function(_arguments){((this.getDelegate())["trace"]).apply(this.getDelegate(),arguments);};prototype.warn=function(_arguments){((this.getDelegate())["warn"]).apply(this.getDelegate(),arguments);};prototype.dir=function(object){this.getDelegate().dir(object);};},{delegate:"squp.util.Logger"},{});constructor.ConsoleLogger=function(name){if(name==null){this.prefix=null;}else{this.prefix="["+name+"]";}};constructor.ConsoleLogger=stjs.extend(constructor.ConsoleLogger,null,[squp.util.Logger],function(constructor,prototype){prototype.prefix=null;prototype.log=function(_arguments){this.getConsoleLogger("log")(this.decorate(arguments,false));};prototype.warn=function(_arguments){this.getConsoleLogger("warn")(this.decorate(arguments,true));};prototype.error=function(_arguments){this.getConsoleLogger("error")(this.decorate(arguments,true));};prototype.debug=function(_arguments){this.getConsoleLogger("debug")(this.decorate(arguments,false));};prototype.trace=function(_arguments){this.getConsoleLogger("trace")(this.decorate(arguments,false));};prototype.info=function(_arguments){this.getConsoleLogger("info")(this.decorate(arguments,false));};prototype.dir=function(object){if(this.isDefined(window,"console")&&this.isDefined(console,"dir")){console.dir(object);}};prototype.getConsoleLogger=function(method){if(this.isDefined(window,"console")){var actualMethod;if(this.isDefined(console,method)){actualMethod=method;}else{actualMethod="log";}
return function(s){return((console)[actualMethod]).apply(console,s);};}else{return function(s){};}};prototype.isDefined=function(object,property){return(typeof(object)[property])!="undefined";};prototype.hasStackTrace=function(object){if((object)["stack"]!=null){return printStackTrace({e:object,guess:true});}
return null;};prototype.decorate=function(objects,forceStackTrace){var elements=[];if(this.prefix!=null){elements.push(this.prefix);}
var foundStackTrace=false;for(var i=0;i<objects.length;i++){elements.push(objects[i]);var stack=this.hasStackTrace(objects[i]);if(stack!=null){foundStackTrace=true;elements.push(stack.join("\n"));}}
if(!foundStackTrace&&forceStackTrace){elements.push(this.getForcedStackTrace().join("\n"));}
return elements;};prototype.getForcedStackTrace=function(){var stackTrace=printStackTrace(null);var decorateIndex=0;while(decorateIndex<stackTrace.length){if(stackTrace[decorateIndex].indexOf(".decorate")>=0){break;}
decorateIndex++;}
return stackTrace.slice(decorateIndex+3);};},{},{});},{loggerConstructor:{name:"Function1",arguments:[null,"squp.util.Logger"]}},{});stjs.ns("squp.util");squp.util.RequestBuilder=function(url,type){this.ajaxParams={};this.ajaxParams.url=url;this.ajaxParams.type=type;this.ajaxParams.cache=false;this.mapper=function(jQueryXHR,o){return o;};};squp.util.RequestBuilder=stjs.extend(squp.util.RequestBuilder,null,[],function(constructor,prototype){prototype.ajaxParams=null;prototype.mapper=null;constructor.retriever=null;prototype.withDataType=function(dataType){this.ajaxParams.dataType=dataType;return this;};prototype.withContentType=function(contentType){this.ajaxParams.contentType=contentType;return this;};prototype.withCache=function(value){this.ajaxParams.cache=value;return this;};prototype.withParams=function(params){this.ajaxParams.data=params;return this;};prototype.withJson=function(json){this.ajaxParams.data=JSON.stringify(json);return this;};prototype.withResponseMapper=function(mapper){this.mapper=mapper;return this;};prototype.withBeforeSendBehaviour=function(beforeSendBehaviour){this.ajaxParams.beforeSend=beforeSendBehaviour;return this;};constructor.setRetriever=function(retriever){squp.util.RequestBuilder.retriever=retriever;};prototype.call=function(){if(squp.util.RequestBuilder.retriever!=null){return squp.util.RequestBuilder.retriever(this.ajaxParams,this.mapper);}
return this.defaultCaller(this.ajaxParams,this.mapper);};prototype.defaultCaller=function(params,mapper){return new RSVP.Promise(function(resolve,reject){params.success=function(value,s,jQueryXHR){resolve(mapper(jQueryXHR,value));};params.error=function(jQueryXHR,s,s2){return reject(new squp.util.ErrorResponse(jQueryXHR,s,s2));};$.ajax(params);});};},{ajaxParams:"AjaxParams",mapper:{name:"Function2",arguments:["JQueryXHR","Object","V"]},retriever:{name:"Function2",arguments:["AjaxParams",{name:"Function2",arguments:["JQueryXHR","Object","Object"]},{name:"RSVP.Promise",arguments:["Object","squp.util.ErrorResponse"]}]}},{});stjs.ns("squp.ext.i18n");squp.ext.i18n.Localization=function(){};squp.ext.i18n.Localization=stjs.extend(squp.ext.i18n.Localization,null,[squp.util.SubscribableDataSource],function(constructor,prototype){prototype.setLocale=function(locale){};prototype.getLocale=function(){};prototype.registerContext=function(plugin,context){};prototype.registerContexts=function(plugin,contexts){};prototype.isContextRegistered=function(context){};prototype.translate=function(key,substitutions){};prototype.formatCurrency=function(currency,value){};prototype.formatDate=function(date){};prototype.parseDate=function(date){};prototype.parseNumber=function(toParse){};prototype.formatRelativeTime=function(time,unit){};prototype.addContextWatcher=function(context,callback){};prototype.removeContextWatcher=function(context,callback){};},{},{});stjs.ns("squp.ext.route");squp.ext.route.Path=function(path){this.path=path;this.elements=[];if(!path.equals("")){var elementValues=(path).split("/");elementValues.forEach(stjs.bind(this,function(v){return this.elements.push(new squp.ext.route.PathElement(v));}));}};squp.ext.route.Path=stjs.extend(squp.ext.route.Path,null,[],function(constructor,prototype){prototype.elements=null;prototype.path=null;prototype.length=function(){return this.elements.length;};prototype.getParameters=function(){var params=[];this.elements.forEach(function(e){return e.getParameters().forEach(function(ee){return params.push(ee);});});return params;};prototype.getElement=function(i){return this.elements[i];};prototype.tryMatch=function(instance){if(this.length()!=instance.length()){return null;}
var allParams={};for(var i=0;i<this.elements.length;i++){var params=this.elements[i].tryMatch(instance.elements[i]);if(params==null){return null;}else{for(var key in params){allParams[key]=params[key];}}}
return allParams;};prototype.toString=function(){return this.path;};},{elements:{name:"Array",arguments:["squp.ext.route.PathElement"]}},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.SubscriptionSupport=function(){this.subscriptions={};};squp.ext.dataprovider.SubscriptionSupport=stjs.extend(squp.ext.dataprovider.SubscriptionSupport,null,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("SubscriptionSupport");prototype.subscriptions=null;prototype.subscribeAll=function(keys,listener){var firstSubscriptions=[];for(var i=0;i<keys.length;i++){var isFirstSubscriber=this.subscribe(keys[i],listener);if(isFirstSubscriber){firstSubscriptions.push(keys[i]);}}
return firstSubscriptions;};prototype.subscribe=function(key,listener){var mapKey=this.toMapKey(key);var entry=this.subscriptions[mapKey];if(entry==null){entry=new squp.ext.dataprovider.SubscriptionSupport.SubscriptionEntry(key,listener);this.subscriptions[mapKey]=entry;}else if(!entry.containsListener(listener)){entry.addListener(listener);}else{return false;}
return entry.listenerCount()==1;};prototype.unsubscribe=function(key,listener){var mapKey=this.toMapKey(key);var entry=this.subscriptions[mapKey];if(entry==null){return false;}
var listenersRemaining=entry.removeListener(listener);if(listenersRemaining==0){delete this.subscriptions[mapKey];return true;}
return false;};prototype.unsubscribeFrom=function(keys,listener){var orphans=[];for(var i=0;i<keys.length;i++){var isOrphan=this.unsubscribe(keys[i],listener);if(isOrphan){orphans.push(keys[i]);}}
return orphans;};prototype.unsubscribeAll=function(listener){var orphans=[];for(var key in this.subscriptions){var entry=this.subscriptions[key];var listenersRemaining=entry.removeListener(listener);if(listenersRemaining==0){delete this.subscriptions[key];orphans.push(entry.key);}}
return orphans;};prototype.getKeys=function(){var realKeys=[];for(var key in this.subscriptions){realKeys.push(this.subscriptions[key].key);}
return realKeys;};prototype.executeDeferred=function(cb){setTimeout(cb,0);};prototype.deferredApplyToListeners=function(key,callback){this.executeDeferred(stjs.bind(this,function(){return this.applyToListeners(key,callback);}));};prototype.applyToListeners=function(key,callback){var mapKey=this.toMapKey(key);var entry=this.subscriptions[mapKey];if(entry==null){return;}
entry.forEachListener(function(k,l){try{callback(k,l);}catch(te){squp.ext.dataprovider.SubscriptionSupport.LOG.error("A listener for key \""+k+"\" failed",te);}});};prototype.toMapKey=function(key){};constructor.SubscriptionEntry=function(key,listener){this.key=key;this.listeners=[listener];};constructor.SubscriptionEntry=stjs.extend(constructor.SubscriptionEntry,null,[],function(constructor,prototype){prototype.key=null;prototype.listeners=null;prototype.containsListener=function(listener){return this.indexOfListener(listener)>=0;};prototype.addListener=function(listener){this.listeners.push(listener);};prototype.indexOfListener=function(listener){return this.listeners.indexOf(listener);};prototype.removeListener=function(listener){var index=this.indexOfListener(listener);if(index>=0){this.listeners.splice(index,1);}
return this.listeners.length;};prototype.listenerCount=function(){return this.listeners.length;};prototype.forEachListener=function(callback){for(var i=0;i<this.listeners.length;i++){callback(this.key,this.listeners[i]);}};},{listeners:{name:"Array",arguments:["L"]}},{});},{LOG:"squp.util.Logger",subscriptions:{name:"Map",arguments:[null,{name:"squp.ext.dataprovider.SubscriptionSupport.SubscriptionEntry",arguments:["KEY","LISTENER"]}]}},{});stjs.ns("squp.ext.route");squp.ext.route.SimpleRouter=function(){this.routes=[];};squp.ext.route.SimpleRouter=stjs.extend(squp.ext.route.SimpleRouter,null,[squp.ext.route.RouterExtensionPoint],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("SimpleRouter");prototype.routes=null;prototype.route=function(path){this.routes.forEach(stjs.bind(this,function(r){return this.tryApplyRoute(r,path);}));};prototype.addRoute=function(route){this.routes.push(route);};prototype.removeRoute=function(route){for(var i=0;i<this.routes.length;i++){var r=this.routes[i];if(route==r){this.routes.splice(i,1);return true;}}
return false;};prototype.tryApplyRoute=function(route,path){var routeParam=route.tryMatch(path);if(routeParam!=null){try{route.callback(routeParam,path);}catch(e){squp.ext.route.SimpleRouter.LOG.error("Failed to execute callback for route "+route.pathTemplate+" with path "+path,e);}
return true;}
return false;};},{LOG:"squp.util.Logger",routes:{name:"Array",arguments:[{name:"squp.ext.route.Route",arguments:["Object"]}]}},{});stjs.ns("squp.ext.route");squp.ext.route.Route=function(pathTemplate,parameterType,callback){this.pathTemplate=new squp.ext.route.Path(pathTemplate);this.callback=callback;this.parameterType=parameterType;this.verifyParameterType(parameterType);this.verifyParameterFields(parameterType,this.pathTemplate.getParameters());};squp.ext.route.Route=stjs.extend(squp.ext.route.Route,null,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("Route");prototype.pathTemplate=null;prototype.parameterType=null;prototype.callback=null;prototype.verifyParameterType=function(paramType){if(paramType==null){return;}
if((paramType)["length"]!=0){throw new RuntimeException();}};prototype.verifyParameterFields=function(parameterType,parameterFields){if(parameterType==null){return;}
for(var i=0;i<parameterFields.length;i++){var field=parameterFields[i];var exists=field in parameterType.prototype;if(!exists){squp.ext.route.Route.LOG.warn("Property "+field+" does not exist in the parameter type's prototype.");}}};prototype.tryMatch=function(otherPath){var paramValues=this.pathTemplate.tryMatch(otherPath);if(paramValues==null){return null;}
return this.buildParameterObject(paramValues);};prototype.buildParameterObject=function(paramValues){var parameter=paramValues;if(this.parameterType!=null){parameter=new this.parameterType();var props=(parameter);for(var key in paramValues){props[key]=paramValues[key];}}
return parameter;};},{LOG:"squp.util.Logger",pathTemplate:"squp.ext.route.Path",parameterType:{name:"Class",arguments:["T"]},callback:{name:"Callback2",arguments:["Object","squp.ext.route.Path"]}},{});stjs.ns("squp.ext.dataprovider");squp.ext.dataprovider.DataItemSubscriptionSupport=function(){squp.ext.dataprovider.SubscriptionSupport.call(this);};squp.ext.dataprovider.DataItemSubscriptionSupport=stjs.extend(squp.ext.dataprovider.DataItemSubscriptionSupport,squp.ext.dataprovider.SubscriptionSupport,[],function(constructor,prototype){prototype.deferredFireItemUpdated=function(key,value){this.executeDeferred(stjs.bind(this,function(){return this.fireItemUpdated(key,value);}));};prototype.fireItemUpdated=function(key,value){var cls=(value).constructor;var item=new squp.ext.dataprovider.DataItem(key,value,cls);this.applyToListeners(key,function(k,l){return l(item);});};prototype.deferredFireItemsUpdated=function(keyGetter,values){this.executeDeferred(stjs.bind(this,function(){return this.fireItemsUpdated(keyGetter,values);}));};prototype.fireItemsUpdated=function(keyGetter,values){for(var i=0;i<values.length;i++){var value=values[i];if(value!=null){this.fireItemUpdated(keyGetter(value),value);}}};prototype.toMapKey=function(key){if(key==null){return"";}
return key.keyString();};},{LOG:"squp.util.Logger",subscriptions:{name:"Map",arguments:[null,{name:"squp.ext.dataprovider.SubscriptionSupport.SubscriptionEntry",arguments:["KEY","LISTENER"]}]}},{});
stjs.ns("squp.feature.global.loader");squp.feature.global.loader.GlobalLoaderNotifier=function(plugin,isRequired){this.plugin=plugin;this.isRequired=isRequired;this.isLoaded=false;};squp.feature.global.loader.GlobalLoaderNotifier=stjs.extend(squp.feature.global.loader.GlobalLoaderNotifier,null,[],function(constructor,prototype){constructor.EXT_NAME="ext.global.loader.notifier";prototype.plugin=null;prototype.isRequired=false;prototype.isLoaded=false;},{},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslatableParameter=function(msgKey){this.msgKey=msgKey;};squp.feature.i18n.component.TranslatableParameter=stjs.extend(squp.feature.i18n.component.TranslatableParameter,null,[],function(constructor,prototype){prototype.msgKey=null;prototype.getMsgKey=function(){return this.msgKey;};},{},{});stjs.ns("squp.feature.notifications");squp.feature.notifications.Notification=function(){};squp.feature.notifications.Notification=stjs.extend(squp.feature.notifications.Notification,null,[],function(constructor,prototype){prototype.timeout=null;prototype.level=null;prototype.content=null;prototype.actionLabel=null;prototype.actionCallback=null;},{content:"Object",actionCallback:{name:"Callback1",arguments:["Event"]}},{});stjs.ns("squp.feature.notifications");squp.feature.notifications.NotificationContainerState=function(){};squp.feature.notifications.NotificationContainerState=stjs.extend(squp.feature.notifications.NotificationContainerState,null,[],function(constructor,prototype){prototype.notifications=null;},{notifications:{name:"Array",arguments:["squp.feature.notifications.Notification"]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.LocaleWrapperProps=function(){};squp.feature.i18n.component.LocaleWrapperProps=stjs.extend(squp.feature.i18n.component.LocaleWrapperProps,null,[],function(constructor,prototype){prototype.prop=null;},{children:{name:"Array",arguments:[{name:"ReactElement",arguments:["Object"]}]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslatePropProps=function(){};squp.feature.i18n.component.TranslatePropProps=stjs.extend(squp.feature.i18n.component.TranslatePropProps,null,[],function(constructor,prototype){prototype.prop=null;},{values:{name:"Map",arguments:[null,"Object"]},children:{name:"Array",arguments:[{name:"ReactElement",arguments:["Object"]}]}},{});stjs.ns("squp");squp.PluginManager=function(){this.plugins={};};squp.PluginManager=stjs.extend(squp.PluginManager,null,[],function(constructor,prototype){prototype.plugins=null;constructor.create=function(){return new squp.PluginManager();};prototype.addPlugin=function(name,path){if(path==null){path="/"+name;}
this.plugins[name]=path;var addPaths={};addPaths[name]=path;requirejs.config({paths:addPaths});return this;};prototype.requires=function(){var requires=[];for(var i in this.plugins){requires.push("platformPlugin!"+i+"/define");}
return requires;};},{plugins:{name:"Map",arguments:[null,null]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslateObjectPropProps=function(){};squp.feature.i18n.component.TranslateObjectPropProps=stjs.extend(squp.feature.i18n.component.TranslateObjectPropProps,null,[],function(constructor,prototype){prototype.prop=null;prototype.propValue=null;prototype.traverse=null;},{propValue:"Object",traverse:{name:"Function2",arguments:["Object",{name:"Function2",arguments:[null,{name:"Map",arguments:[null,"Object"]},null]},"Object"]},children:{name:"Array",arguments:[{name:"ReactElement",arguments:["Object"]}]}},{});stjs.ns("squp.ext.featuretour");squp.ext.featuretour.FeatureTourRegistry=function(platformApi){this.platformApi=platformApi;};squp.ext.featuretour.FeatureTourRegistry=stjs.extend(squp.ext.featuretour.FeatureTourRegistry,null,[],function(constructor,prototype){prototype.platformApi=null;prototype.getFeatureTours=function(){var contributors;contributors=this.platformApi.extensions().loadContributors(squp.ext.featuretour.FeatureTourExtensionPoint.ID);var result=[];for(var i=0;i<contributors.length;i++){result.push(contributors[i].then(function(contrib){return contrib.getInstance();}));}
return result;};},{platformApi:"squp.Platform"},{});stjs.ns("squp.feature.view");squp.feature.view.SimpleViewManager=function(platform){this.platform=platform;};squp.feature.view.SimpleViewManager=stjs.extend(squp.feature.view.SimpleViewManager,null,[squp.ext.view.ViewManager],function(constructor,prototype){prototype.currentView=null;prototype.platform=null;prototype.viewContainer=null;prototype.init=function(viewContainer){this.viewContainer=viewContainer;};prototype.show=function(extension){if(this.currentView!=null){this.currentView.hide();}
extension.show(this.viewContainer);this.currentView=extension;};prototype.getCurrentView=function(){return this.currentView;};},{currentView:"squp.ext.view.ViewExtensionPoint",platform:"squp.Platform",viewContainer:{name:"JQueryAndPlugins",arguments:["Object"]}},{});stjs.ns("squp.feature.view");squp.feature.view.RoutableViewManager=function(platform,viewManager){this.viewManager=viewManager;this.platform=platform;};squp.feature.view.RoutableViewManager=stjs.extend(squp.feature.view.RoutableViewManager,null,[squp.ext.route.RouterExtensionPoint,squp.ext.view.ViewManager],function(constructor,prototype){prototype.defaultViewAlias=null;prototype.viewManager=null;prototype.platform=null;prototype.init=function(viewContainer,headerContainer,defaultViewAlias){this.viewManager.init(viewContainer);this.defaultViewAlias=defaultViewAlias;var that=this;this.platform.extensions().loadContributorsArray(squp.ext.view.ViewExtensionPoint.ID).then(function(contributors){if(contributors.length>1){that.buildViewMenu(headerContainer,contributors);}});};prototype.route=function(path){var targetViewAlias=this.defaultViewAlias;if(path.length()>0&&this.platform.extensions().isContributorAliasDefined(squp.ext.view.ViewExtensionPoint.ID,path.getElement(0).value)){targetViewAlias=path.getElement(0).value;}
this.tryShowViewByAlias(targetViewAlias);};prototype.buildViewMenu=function(headerContainer,contributors){for(var i in contributors){if(!(contributors).hasOwnProperty(i))
continue;var c=contributors[i];if(c.getInstance().getHeaderText()!=null){}}};prototype.tryShowViewByAlias=function(viewName){this.platform.extensions().loadContributor(squp.ext.view.ViewExtensionPoint.ID,viewName).then(stjs.bind(this,function(c){return this.show(c.getInstance());}),function(err){});};prototype.show=function(extension){this.viewManager.show(extension);};prototype.getCurrentView=function(){return this.viewManager.getCurrentView();};},{viewManager:"squp.feature.view.SimpleViewManager",platform:"squp.Platform"},{});var ReactView=function(){};ReactView=stjs.extend(ReactView,null,[squp.ext.view.ViewExtensionPoint],function(constructor,prototype){prototype.view=null;prototype.show=function(container){if(this.view==null){this.view=document.createElement("div");this.view.className="View";container.get(0).appendChild(this.view);}
React.render(this.render(),this.view);this.view.className="View is-visible";};prototype.hide=function(){this.view.className="View";if(this.view!=null){React.unmountComponentAtNode(this.view);}};prototype.render=function(){};},{view:"Element"},{});stjs.ns("squp.feature.widget");squp.feature.widget.WidgetFactoryRegistry=function(squp){this.squp=squp;};squp.feature.widget.WidgetFactoryRegistry=stjs.extend(squp.feature.widget.WidgetFactoryRegistry,null,[],function(constructor,prototype){prototype.squp=null;prototype.loadWidgetFactories=function(){var contributors;contributors=this.squp.extensions().loadContributors(squp.ext.widget.WidgetFactoryExtensionPoint.ID);var result=[];for(var i=0;i<contributors.length;i++){result.push(contributors[i].then(function(contrib){return contrib.getInstance();}));}
return result;};},{squp:"squp.Platform"},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslateMixin=function(props){React.Component.call(this,props);this.state={context:this.getContext((props).id)};this.boundTranslationUpdate=stjs.bind(this,"onTranslationUpdate");};squp.feature.i18n.component.TranslateMixin=stjs.extend(squp.feature.i18n.component.TranslateMixin,React.Component,[],function(constructor,prototype){prototype.MANAGER="squp/feature.i18n/l10n";prototype.boundTranslationUpdate=null;prototype.getContext=function(key){if(undefined==key){return null;}
var parts=(key).split("/");if(parts.length>1){return parts[0];}
return null;};prototype.onTranslationUpdate=function(result){if(result==squp.ext.i18n.ContextStatus.LOADED){this.setState({});}};prototype.componentWillMount=function(){if(this.state.translator==null){require([this.MANAGER],stjs.bind(this,function(manager){this.setState({translator:manager});manager.addContextWatcher(this.state.context,this.boundTranslationUpdate);}));}};prototype.componentWillUnmount=function(){if(this.state.translator!=null){this.state.translator.removeContextWatcher(this.state.context,this.boundTranslationUpdate);}};prototype.componentWillReceiveProps=function(p){if(this.state.translator!=null&&(this.props).hasOwnProperty("id")&&(p).hasOwnProperty("id")&&(this.props).id!=(p).id){var newContext=this.getContext((this.props).id);if(newContext!=this.state.context){this.state.translator.removeContextWatcher(this.state.context,this.boundTranslationUpdate);this.state.translator.addContextWatcher(newContext,this.boundTranslationUpdate);this.setState({context:newContext});}}};prototype.translate=function(id,values){var content="";if(this.state.translator!=null){content=this.state.translator.translate(id,this.translateSubstitutionValues(values));}
return content;};prototype.translateSubstitutionValues=function(values){var translatedMap={};for(var key in values){var value=values[key];if(stjs.isInstanceOf(value.constructor,squp.feature.i18n.component.TranslatableParameter)){value=this.state.translator.translate((value).getMsgKey(),{});}
translatedMap[key]=value;}
return translatedMap;};},{boundTranslationUpdate:{name:"Callback1",arguments:[{name:"Enum",arguments:["squp.ext.i18n.ContextStatus"]}]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{});stjs.ns("squp.feature.i18n");squp.feature.i18n.MessageContextsHolder=function(){this.pluginToMessageContextsMap={};this.contextsMap={};};squp.feature.i18n.MessageContextsHolder=stjs.extend(squp.feature.i18n.MessageContextsHolder,null,[],function(constructor,prototype){constructor.LOGGER=squp.util.LoggerFactory.getLogger("MessageContextsHolder");prototype.pluginToMessageContextsMap=null;prototype.contextsMap=null;prototype.registerNewMessageContext=function(newMessageContextState){var plugin=newMessageContextState.plugins[0];if(this.pluginToMessageContextsMap[plugin]==undefined){this.pluginToMessageContextsMap[plugin]=[newMessageContextState];}else{this.pluginToMessageContextsMap[plugin].push(newMessageContextState);}
var existingContext=this.contextsMap[newMessageContextState.context];if(existingContext==undefined){this.contextsMap[newMessageContextState.context]=newMessageContextState;}else{for(var ind in existingContext.plugins){if(!(existingContext.plugins).hasOwnProperty(ind))
continue;if(existingContext.plugins[ind].equals(newMessageContextState.plugins[0])){existingContext.setCurrentData(newMessageContextState.getCurrentData());return;}}
existingContext.plugins.push(newMessageContextState.plugins[0]);squp.feature.i18n.MessageContextsHolder.LOGGER.error("There are multiple plugins ["+existingContext.plugins+"] have registered message context with the same name ["+newMessageContextState.context+"], duplicated keys will be overridden.");}};prototype.isContextRegisteredByPlugin=function(plugin,context){var registeredContexts=this.pluginToMessageContextsMap[plugin];if(registeredContexts==undefined){return false;}
for(var ind in registeredContexts){if(!(registeredContexts).hasOwnProperty(ind))
continue;if(registeredContexts[ind].context.equals(context)){return true;}}
return false;};prototype.isContextRegistered=function(context){return this.contextsMap[context]!=undefined&&this.contextsMap[context].getCurrentData()!=null;};prototype.getPluginToContextsMap=function(){return this.pluginToMessageContextsMap;};prototype.getMessageContextState=function(contextName){return this.contextsMap[contextName];};},{LOGGER:"squp.util.Logger",pluginToMessageContextsMap:{name:"Map",arguments:[null,{name:"Array",arguments:["squp.feature.i18n.MessageContextState"]}]},contextsMap:{name:"Map",arguments:[null,"squp.feature.i18n.MessageContextState"]}},{});stjs.ns("squp.feature.dataprovider");squp.feature.dataprovider.DataProviderExtensionPointSupport=function(subscription,cache){this.subscriptions=subscription;this.cache=cache;};squp.feature.dataprovider.DataProviderExtensionPointSupport=stjs.extend(squp.feature.dataprovider.DataProviderExtensionPointSupport,null,[squp.ext.dataprovider.DataProviderExtensionPoint],function(constructor,prototype){prototype.subscriptions=null;prototype.cache=null;prototype.getKey=function(value){};prototype.loadEntry=function(key){};prototype.getData=function(keys){return this.cache.getAllFromCache(this.castKeys(keys));};prototype.subscribe=function(keys,listener){var castedKeys=this.castKeys(keys);this.subscriptions.subscribeAll(castedKeys,listener);var alreadyCached=this.cache.getAllFromCache(castedKeys);this.subscriptions.deferredFireItemsUpdated(stjs.bind(this,"getKey"),alreadyCached);this.loadEntries(castedKeys).then(stjs.bind(this,function(settled){for(var i in settled){if(!(settled).hasOwnProperty(i))
continue;var item=settled[i];if(item.state=="fulfilled"){this.cache.putInCache(this.getKey(item.value),item.value);}}
var cachedItems=this.cache.getAllFromCache(castedKeys);for(var j in cachedItems){if(!(cachedItems).hasOwnProperty(j))
continue;if(cachedItems[j]!=null){this.subscriptions.fireItemUpdated(this.getKey(cachedItems[j]),cachedItems[j]);}}}));};prototype.unsubscribeFrom=function(keys,listener){this.subscriptions.unsubscribeFrom(this.castKeys(keys),listener);};prototype.unsubscribeAll=function(listener){this.subscriptions.unsubscribeAll(listener);};prototype.castKeys=function(keys){return keys;};prototype.loadEntries=function(keys){var promises=[];for(var k in keys){if(!(keys).hasOwnProperty(k))
continue;var key=keys[k];promises.push(this.loadEntry(key));}
return RSVP.allSettled(promises);};},{subscriptions:{name:"squp.ext.dataprovider.DataItemSubscriptionSupport",arguments:["KEY","VALUE"]},cache:{name:"squp.ext.dataprovider.DataCacheSupport",arguments:["KEY","VALUE"]}},{});stjs.ns("squp.feature.dataprovider");squp.feature.dataprovider.DataManagerImpl=function(platform){this.platform=platform;this.loadedProviders=null;this.loadDeferred=null;};squp.feature.dataprovider.DataManagerImpl=stjs.extend(squp.feature.dataprovider.DataManagerImpl,null,[squp.ext.dataprovider.DataManager],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("DataManagerImpl");prototype.platform=null;prototype.loadedProviders=null;prototype.loadDeferred=null;prototype.getSubscribableTypes=function(keyTypes){return this.loadProviders().then(stjs.bind(this,function(providers){var types=[];for(var i=0;i<providers.length;i++){if(this.providerMatchesKeyTypes(providers[i],keyTypes)){types.push(providers[i].getDataType());}}
return types;}));};prototype.providerMatchesKeyTypes=function(provider,keyTypes){var subscribableKeyTypes=provider.getSubscribableKeyTypes();for(var i=0;i<keyTypes.length;i++){if(subscribableKeyTypes.indexOf(keyTypes[i])>=0){return true;}}
return false;};prototype.subscribe=function(keys,subscriber){this.forEachProvider(stjs.bind(this,function(p){return p.subscribe(this.filterKeysByType(keys,p.getSubscribableKeyTypes()),subscriber);}));};prototype.filterKeysByType=function(keys,keyTypes){var matches=[];for(var i=0;i<keys.length;i++){var key=keys[i];var clazz=(key).constructor;if(keyTypes.indexOf(clazz)>=0){matches.push(key);}}
return matches;};prototype.subscribeToType=function(keys,type,subscriber){this.loadProvider(type).then(function(p){return p.subscribe(keys,subscriber);},function(ignored){return squp.feature.dataprovider.DataManagerImpl.LOG.error("No known provider for type: "+type);});};prototype.unsubscribe=function(keys,subscriber){this.forEachProvider(function(p){return p.unsubscribeFrom(keys,subscriber);});};prototype.unsubscribeFromType=function(keys,type,subscriber){this.loadProvider(type).then(function(p){return p.unsubscribeFrom(keys,subscriber);},function(ignored){return squp.feature.dataprovider.DataManagerImpl.LOG.error("No known provider for type: "+type);});};prototype.unsubscribeAll=function(subscriber){this.forEachProvider(function(p){return p.unsubscribeAll(subscriber);});};prototype.unsubscribeAllFromType=function(type,subscriber){this.loadProvider(type).then(function(p){return p.unsubscribeAll(subscriber);},function(ignored){return squp.feature.dataprovider.DataManagerImpl.LOG.error("No known provider for type: "+type);});};prototype.forEachProvider=function(cb){this.loadProviders().then(function(providers){for(var i=0;i<providers.length;i++){cb(providers[i]);}});};prototype.loadProvider=function(type){return this.loadProviders().then(function(providers){for(var i=0;i<providers.length;i++){var provider=providers[i];if(provider.getDataType().equals(type)){var result=provider;return result;}}
return null;}).then(function(provider){return new RSVP.Promise(function(resolve,fail){if(provider==null){fail(null);}
resolve(provider);});});};prototype.loadProviders=function(){var deferred=RSVP.defer();if(this.loadDeferred==null){this.loadDeferred=[];this.loadDeferred.push(deferred);RSVP.allSettled(this.platform.extensions().loadContributors(squp.ext.dataprovider.DataProviderExtensionPoint.ID)).then(stjs.bind(this,"saveLoadedProviders")).then(stjs.bind(this,"resolveLoadDeferred"));}else if(this.loadDeferred.length>0){this.loadDeferred.push(deferred);}else{deferred.resolve(this.loadedProviders);}
return deferred.promise;};prototype.saveLoadedProviders=function(settleResults){var providers=[];for(var i=0;i<settleResults.length;i++){var settle=settleResults[i];if(settle.state.equals("fulfilled")){providers.push(settle.value.getInstance());}else{squp.feature.dataprovider.DataManagerImpl.LOG.error("Could not initialize DataProvider",settle.reason);}}
this.loadedProviders=providers;return providers;};prototype.resolveLoadDeferred=function(providers){for(var i=0;i<this.loadDeferred.length;i++){this.loadDeferred[i].resolve(providers);}
this.loadDeferred=[];};},{LOG:"squp.util.Logger",platform:"squp.Platform",loadedProviders:{name:"Array",arguments:[{name:"squp.ext.dataprovider.DataProviderExtensionPoint",arguments:["Object"]}]},loadDeferred:{name:"Array",arguments:[{name:"Deferred",arguments:[{name:"Array",arguments:[{name:"squp.ext.dataprovider.DataProviderExtensionPoint",arguments:["Object"]}]},"Void"]}]}},{});var SubscribableDataSourceImpl=function(){this.subscribers=[];};SubscribableDataSourceImpl=stjs.extend(SubscribableDataSourceImpl,null,[squp.util.SubscribableDataSource],function(constructor,prototype){prototype.subscribers=null;prototype.currentData=null;prototype.getCurrentData=function(){return this.currentData;};prototype.setCurrentData=function(newData){this.currentData=newData;};prototype.addWatcher=function(callback){var index=this.subscribers.indexOf(callback);if(index>=0){return;}
this.subscribers.push(callback);if(this.currentData!=null){callback(this.currentData);}};prototype.removeWatcher=function(callback){var index=this.subscribers.indexOf(callback);if(index>=0){this.subscribers.splice(index,1);}};prototype.notifyWatchers=function(){for(var subscriber in this.subscribers){if(!(this.subscribers).hasOwnProperty(subscriber))
continue;this.subscribers[subscriber](this.currentData);}};},{subscribers:{name:"Array",arguments:[{name:"Callback1",arguments:["T"]}]}},{});stjs.ns("squp");squp.ExtensionRegistryImpl=function(){this.contributors={};};squp.ExtensionRegistryImpl=stjs.extend(squp.ExtensionRegistryImpl,null,[squp.ExtensionRegistry],function(constructor,prototype){prototype.contributors=null;prototype.defineContributor=function(extensionPointId,contributorId,alias){var contributorsForExtension=this.contributors[extensionPointId];if(contributorsForExtension==null){contributorsForExtension={};this.contributors[extensionPointId]=contributorsForExtension;}
contributorsForExtension[alias]=new squp.ExtensionRegistryImpl.ExtensionContributorImpl(extensionPointId,contributorId,alias);};prototype.isContributorAliasDefined=function(extensionPointId,alias){var contributorsForExtension=this.contributors[extensionPointId];return contributorsForExtension!=null&&contributorsForExtension[alias]!=null;};prototype.isContributorDefined=function(contributorId){for(var extId in this.contributors){for(var alias in this.contributors[extId]){if(this.contributors[extId][alias].getId().equals(contributorId)){return true;}}}
return false;};prototype.loadContributor=function(extensionPointId,alias){var that=this;return new RSVP.Promise(function(resolve,reject){var contributor=that.getContributor(extensionPointId,alias);if(contributor==null){reject(new squp.ExtensionLoadError(new squp.ExtensionRegistryImpl.ExtensionContributorImpl(extensionPointId,null,alias),"No known contributor for extension "+extensionPointId+" with alias "+alias));}else if(contributor.isLoaded()){resolve(contributor);}else{contributor.addCallback(resolve,reject);require([contributor.getId()],function(instance){return contributor.load(instance);},function(error){that.unregisterFailedContributor(extensionPointId,alias);contributor.failLoad(error.requireType);});}});};prototype.requireContributor=function(extensionPointId,alias,callback){var contributor=this.getContributor(extensionPointId,alias);if(contributor==null){return false;}
this.loadContributor(extensionPointId,alias).then(callback);return true;};prototype.loadContributors=function(extensionPointId){var result=[];var contributorsForExtension=this.contributors[extensionPointId];if(contributorsForExtension!=null){for(var alias in contributorsForExtension){var info=contributorsForExtension[alias];result.push(this.loadContributor(extensionPointId,info.getAlias()));}}
return result;};prototype.requireContributors=function(extensionPointId,callback){var promises=this.loadContributors(extensionPointId);for(var i in promises){if(!(promises).hasOwnProperty(i))
continue;promises[i].then(callback);}};prototype.loadContributorsArray=function(extensionPointId){var that=this;return new RSVP.Promise(function(resolve,reject){var promises=that.loadContributors(extensionPointId);var collector=new squp.ExtensionRegistryImpl.Collector(that.getCountributorCount(extensionPointId),resolve);for(var i in promises){if(!(promises).hasOwnProperty(i))
continue;promises[i].then(stjs.bind(collector,"collect"),stjs.bind(collector,"collectError"));}});};prototype.requireContributorsArray=function(extensionPointId,callback){this.loadContributorsArray(extensionPointId).then(callback);};prototype.unregisterFailedContributor=function(extensionPointId,alias){var contributorsForExtension=this.contributors[extensionPointId];if(contributorsForExtension!=null){delete contributorsForExtension[alias];}};prototype.getContributor=function(extensionPointId,alias){var contribs=this.contributors[extensionPointId];if(contribs==null){return null;}
var result=contribs[alias];return result;};prototype.getCountributorCount=function(extensionPointId){var contribs=this.contributors[extensionPointId];var i=0;for(var key in contribs){i++;}
return i;};constructor.Collector=function(count,onCollectCompleted){this.elements=[];this.remaining=count;this.onCountdownFinished=onCollectCompleted;if(count==0){this.onCountdownFinished(this.elements);}};constructor.Collector=stjs.extend(constructor.Collector,null,[],function(constructor,prototype){prototype.onCountdownFinished=null;prototype.elements=null;prototype.remaining=0;prototype.collect=function(element){this.elements.push(element);this.countDown();};prototype.collectError=function(error){if(console!=null){console.warn(error.toString());}
this.countDown();};prototype.countDown=function(){this.remaining--;if(this.remaining==0){this.onCountdownFinished(this.elements);}};},{onCountdownFinished:{name:"Callback1",arguments:[{name:"Array",arguments:["T"]}]},elements:{name:"Array",arguments:["T"]}},{});constructor.ExtensionContributorImpl=function(extensionPointId,id,alias){this.extensionPointId=extensionPointId;this.id=id;this.alias=alias;this.asyncSuccessCallbacks=[];this.asyncFailureCallbacks=[];this.loaded=false;};constructor.ExtensionContributorImpl=stjs.extend(constructor.ExtensionContributorImpl,null,[squp.ExtensionContributor],function(constructor,prototype){prototype.extensionPointId=null;prototype.id=null;prototype.alias=null;prototype.instance=null;prototype.loaded=false;prototype.asyncSuccessCallbacks=null;prototype.asyncFailureCallbacks=null;prototype.getExtensionPointId=function(){return this.extensionPointId;};prototype.getId=function(){return this.id;};prototype.getAlias=function(){return this.alias;};prototype.getInstance=function(){return this.instance;};prototype.isLoaded=function(){return this.loaded;};prototype.addCallback=function(onSuccess,onFailure){this.asyncFailureCallbacks.push(onFailure);this.asyncSuccessCallbacks.push(onSuccess);};prototype.load=function(instance){this.loaded=true;this.instance=instance;for(var i in this.asyncSuccessCallbacks){if(!(this.asyncSuccessCallbacks).hasOwnProperty(i))
continue;this.asyncSuccessCallbacks[i](this);}
this.clearCallbacks();};prototype.failLoad=function(reason){this.loaded=true;this.instance=null;var error=new squp.ExtensionLoadError(this,reason);for(var i in this.asyncFailureCallbacks){if(!(this.asyncFailureCallbacks).hasOwnProperty(i))
continue;this.asyncFailureCallbacks[i](error);}
this.clearCallbacks();};prototype.clearCallbacks=function(){this.asyncSuccessCallbacks=[];this.asyncFailureCallbacks=[];};prototype.toString=function(){return"ExtensionContributor{"+"extensionPointId='"+this.extensionPointId+'\''+", id='"+this.id+'\''+", alias='"+this.alias+'\''+", instance="+this.instance+", loaded="+this.loaded+'}';};},{asyncSuccessCallbacks:{name:"Array",arguments:[{name:"Callback1",arguments:[{name:"squp.ExtensionContributor",arguments:["T"]}]}]},asyncFailureCallbacks:{name:"Array",arguments:[{name:"Callback1",arguments:["squp.ExtensionLoadError"]}]}},{});},{contributors:{name:"Map",arguments:[null,{name:"Map",arguments:[null,{name:"squp.ExtensionRegistryImpl.ExtensionContributorImpl",arguments:["Object"]}]}]}},{});stjs.ns("squp.feature.route");squp.feature.route.GlobalRouter=function(platform){this.platform=platform;var listener=stjs.bind(this,function(evt){return this.route();});if((typeof(window)["addEventListener"])=="undefined"){window.attachEvent('onhashchange',listener);}else{window.addEventListener("hashchange",listener);}};squp.feature.route.GlobalRouter=stjs.extend(squp.feature.route.GlobalRouter,null,[],function(constructor,prototype){prototype.fragment=null;prototype.platform=null;prototype.route=function(){var newFragment=this.getFragment();if(newFragment!=this.fragment){this.fragment=newFragment;this.onFragmentUpdated();}};prototype.onFragmentUpdated=function(){var fragmentPath=new squp.ext.route.Path(this.fragment);this.platform.extensions().loadContributorsArray("ext.route").then(function(contribs){return contribs.forEach(function(c){return c.getInstance().route(fragmentPath);});});};prototype.getFragment=function(){var hash=window.location.hash;if(hash.equals("")){return"";}
hash=hash.substring(1);return this.trimSlashes(hash);};prototype.trimSlashes=function(path){var result=path;if(result.length>0&&result.charAt(0)=='/'){result=result.substring(1);}
if(result.length>0&&result.charAt(result.length-1)=='/'){result=result.substring(0,result.length-1);}
return result;};},{platform:"squp.Platform"},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslateObjectProp=function(props){squp.feature.i18n.component.TranslateMixin.call(this,props);};squp.feature.i18n.component.TranslateObjectProp=stjs.extend(squp.feature.i18n.component.TranslateObjectProp,squp.feature.i18n.component.TranslateMixin,[],function(constructor,prototype){constructor.propTypes={"children":React.PropTypes.element.isRequired,"prop":React.PropTypes.string.isRequired,"propValue":React.PropTypes.any,"traverse":React.PropTypes.func};prototype.translateFunction=null;prototype.componentWillMount=function(){squp.feature.i18n.component.TranslateMixin.prototype.componentWillMount.call(this);this.translateFunction=stjs.bind(this,"translate");};prototype.getUpdatedProperty=function(){var propsMap={};var translatedPropertyObject=this.props.traverse(this.props.propValue,this.translateFunction);propsMap[this.props.prop]=translatedPropertyObject;return(propsMap);};prototype.render=function(){return React.cloneElement(React.Children.only(this.props.children),this.getUpdatedProperty());};},{propTypes:{name:"Map",arguments:[null,"TypeChecker"]},translateFunction:{name:"Function2",arguments:[null,{name:"Map",arguments:[null,"Object"]},null]},boundTranslationUpdate:{name:"Callback1",arguments:[{name:"Enum",arguments:["squp.ext.i18n.ContextStatus"]}]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslateProp=function(props){squp.feature.i18n.component.TranslateMixin.call(this,props);};squp.feature.i18n.component.TranslateProp=stjs.extend(squp.feature.i18n.component.TranslateProp,squp.feature.i18n.component.TranslateMixin,[],function(constructor,prototype){constructor.propTypes={"children":React.PropTypes.element.isRequired,"id":React.PropTypes.string.isRequired,"prop":React.PropTypes.string.isRequired,"values":React.PropTypes.object};constructor.LOGGER=squp.util.LoggerFactory.getLogger("TranslateProp");prototype.render=function(){var newProperties=null;if(this.props.id!=null){newProperties=this.getNewProps();}else{squp.feature.i18n.component.TranslateProp.LOGGER.warn("Nothing to translate as properties id or propValue and traverse not specified");}
return React.cloneElement(React.Children.only(this.props.children),newProperties);};prototype.getNewProps=function(){var content=this.translate(this.props.id,this.props.values);var propsMap={};propsMap[this.props.prop]=content;return(propsMap);};},{propTypes:{name:"Map",arguments:[null,"TypeChecker"]},LOGGER:"squp.util.Logger",boundTranslationUpdate:{name:"Callback1",arguments:[{name:"Enum",arguments:["squp.ext.i18n.ContextStatus"]}]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.LocaleWrapper=function(props){squp.feature.i18n.component.TranslateMixin.call(this,props);};squp.feature.i18n.component.LocaleWrapper=stjs.extend(squp.feature.i18n.component.LocaleWrapper,squp.feature.i18n.component.TranslateMixin,[],function(constructor,prototype){constructor.DEFAULT_LOCALE_PROP_NAME="locale";constructor.defaultProps={prop:squp.feature.i18n.component.LocaleWrapper.DEFAULT_LOCALE_PROP_NAME};prototype.getUpdatedProperty=function(){var propsMap={};propsMap[this.props.prop]=this.state.translator.getLocale();return(propsMap);};prototype.render=function(){if(this.state.translator==null){return null;}
return React.cloneElement(React.Children.only(this.props.children),this.getUpdatedProperty());};},{defaultProps:"squp.feature.i18n.component.LocaleWrapperProps",boundTranslationUpdate:{name:"Callback1",arguments:[{name:"Enum",arguments:["squp.ext.i18n.ContextStatus"]}]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.Translate=function(props){squp.feature.i18n.component.TranslateMixin.call(this,props);};squp.feature.i18n.component.Translate=stjs.extend(squp.feature.i18n.component.Translate,squp.feature.i18n.component.TranslateMixin,[],function(constructor,prototype){constructor.propTypes={"id":React.PropTypes.string.isRequired,"values":React.PropTypes.object};prototype.render=function(){var content=this.translate(this.props.id,this.props.values);if(this.props.withHTML!=undefined&&this.props.withHTML==true){return React.DOM.span({"dangerouslySetInnerHTML":{"__html":content}});}
return React.DOM.span(null,content);};prototype.shouldComponentUpdate=function(translatePropProps,translateState,context){return true;};},{propTypes:{name:"Map",arguments:[null,"TypeChecker"]},boundTranslationUpdate:{name:"Callback1",arguments:[{name:"Enum",arguments:["squp.ext.i18n.ContextStatus"]}]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{});stjs.ns("squp.feature.i18n");squp.feature.i18n.MessageContextState=function(){SubscribableDataSourceImpl.call(this);this.setCurrentData(squp.ext.i18n.ContextStatus.REGISTERED);};squp.feature.i18n.MessageContextState=stjs.extend(squp.feature.i18n.MessageContextState,SubscribableDataSourceImpl,[],function(constructor,prototype){prototype.plugins=null;prototype.context=null;prototype.notifyMessageContextWatchers=function(){this.notifyWatchers();};},{plugins:{name:"Array",arguments:[null]},subscribers:{name:"Array",arguments:[{name:"Callback1",arguments:["T"]}]}},{});stjs.ns("squp.feature.global.loader");squp.feature.global.loader.GlobalLoaderObserver=function(api,hideCallback,interval){SubscribableDataSourceImpl.call(this);this.api=api;this.requiredNotifiers=[];this.notRequiredNotifiers=[];this.hideLoaderCallback=hideCallback;this.interval=interval==undefined?squp.feature.global.loader.GlobalLoaderObserver.DEFAULT_INTERVAL_MILLIS:interval;};squp.feature.global.loader.GlobalLoaderObserver=stjs.extend(squp.feature.global.loader.GlobalLoaderObserver,SubscribableDataSourceImpl,[],function(constructor,prototype){constructor.DEFAULT_INTERVAL_MILLIS=500;prototype.api=null;prototype.requiredNotifiers=null;prototype.notRequiredNotifiers=null;prototype.hideLoaderCallback=null;prototype.intervalHandler=null;prototype.interval=0;prototype.observe=function(){var self=this;this.api.extensions().loadContributorsArray(squp.feature.global.loader.GlobalLoaderNotifier.EXT_NAME).then(stjs.bind(this,function(notifiers){for(var ind in notifiers){if(!(notifiers).hasOwnProperty(ind))
continue;var notifier=notifiers[ind].getInstance();if(notifier.isRequired){self.requiredNotifiers.push(notifier);}else{self.notRequiredNotifiers.push(notifier);}}
this.intervalHandler=setInterval(stjs.bind(self,"checkIfPluginsLoaded"),self.interval);}));};prototype.checkIfPluginsLoaded=function(){for(var ind in this.requiredNotifiers){if(!(this.requiredNotifiers).hasOwnProperty(ind))
continue;if(!this.requiredNotifiers[ind].isLoaded){return;}}
var hideLoader=this.notRequiredNotifiers.length==0;for(var ind in this.notRequiredNotifiers){if(!(this.notRequiredNotifiers).hasOwnProperty(ind))
continue;if(this.notRequiredNotifiers[ind].isLoaded){hideLoader=true;break;}}
if(hideLoader){this.hideLoaderCallback();clearInterval(this.intervalHandler);}};},{api:"squp.Platform",requiredNotifiers:{name:"Array",arguments:["squp.feature.global.loader.GlobalLoaderNotifier"]},notRequiredNotifiers:{name:"Array",arguments:["squp.feature.global.loader.GlobalLoaderNotifier"]},hideLoaderCallback:"Callback0",intervalHandler:"TimeoutHandler",subscribers:{name:"Array",arguments:[{name:"Callback1",arguments:["T"]}]}},{});stjs.ns("squp.feature.notifications");squp.feature.notifications.NotificationDataStore=function(){SubscribableDataSourceImpl.call(this);this.setCurrentData([]);};squp.feature.notifications.NotificationDataStore=stjs.extend(squp.feature.notifications.NotificationDataStore,SubscribableDataSourceImpl,[],function(constructor,prototype){constructor.INSTANCE=null;constructor.getInstance=function(){if(squp.feature.notifications.NotificationDataStore.INSTANCE==null){squp.feature.notifications.NotificationDataStore.INSTANCE=new squp.feature.notifications.NotificationDataStore();}
return squp.feature.notifications.NotificationDataStore.INSTANCE;};prototype.startTimer=function(notification){setTimeout(stjs.bind(this,function(){this.dismiss(notification);}),notification.timeout);};prototype.notify=function(notification){this.getCurrentData().push(notification);if(notification.timeout!=undefined&&this.subscribers.length>0){this.startTimer(notification);}
this.notifyWatchers();};prototype.dismiss=function(notification){var index=this.getCurrentData().indexOf(notification);if(index>=0){this.getCurrentData().splice(index,1);}
this.notifyWatchers();};prototype.addWatcher=function(callback){SubscribableDataSourceImpl.prototype.addWatcher.call(this,callback);if(this.subscribers.length==1){for(var i in this.getCurrentData()){if(!(this.getCurrentData()).hasOwnProperty(i))
continue;var notification=this.getCurrentData()[i];if(notification.timeout!=undefined){this.startTimer(notification);}}}};},{INSTANCE:"squp.feature.notifications.NotificationDataStore",subscribers:{name:"Array",arguments:[{name:"Callback1",arguments:["T"]}]}},{});stjs.ns("squp");squp.PlatformImpl=function(){this.extensionRegistry=new squp.ExtensionRegistryImpl();};squp.PlatformImpl=stjs.extend(squp.PlatformImpl,null,[squp.Platform],function(constructor,prototype){prototype.extensionRegistry=null;prototype.extensions=function(){return this.extensionRegistry;};},{extensionRegistry:"squp.ExtensionRegistry"},{});stjs.ns("squp.feature.i18n.component");squp.feature.i18n.component.TranslateUtil=function(){};squp.feature.i18n.component.TranslateUtil=stjs.extend(squp.feature.i18n.component.TranslateUtil,null,[],function(constructor,prototype){constructor.translate=function(myId,myValues,html){if(html==undefined){html=false;}
var finalHtml=html;return React.createElement(squp.feature.i18n.component.Translate,{id:myId,values:myValues,withHTML:finalHtml});};constructor.translateProp=function(property,myId,child,myValues){return React.createElement(squp.feature.i18n.component.TranslateProp,{id:myId,values:myValues,prop:property},child);};},{},{});stjs.ns("squp.feature.i18n");squp.feature.i18n.LocalizationImpl=function(){SubscribableDataSourceImpl.call(this);this.globalize=Globalize;this.contextsHolder=new squp.feature.i18n.MessageContextsHolder();this.setCurrentData(squp.ext.i18n.ContextStatus.LOADED);};squp.feature.i18n.LocalizationImpl=stjs.extend(squp.feature.i18n.LocalizationImpl,SubscribableDataSourceImpl,[squp.ext.i18n.Localization],function(constructor,prototype){constructor.LOGGER=squp.util.LoggerFactory.getLogger("LocalizationImpl");prototype.globalize=null;prototype.contextsHolder=null;prototype.registerContext=function(plugin,context){this.registerContexts(plugin,[context]);};prototype.registerContexts=function(plugin,contexts){var contextsToLoad=[];for(var ind in contexts){if(!(contexts).hasOwnProperty(ind))
continue;if(!this.contextsHolder.isContextRegisteredByPlugin(plugin,contexts[ind])){var initialMessageContextState=this.createInitialMessageContext(plugin,contexts[ind]);contextsToLoad.push(initialMessageContextState);this.contextsHolder.registerNewMessageContext(initialMessageContextState);}}
this.downloadFile(this.getLocale(),plugin,contextsToLoad);};prototype.createInitialMessageContext=function(pluginName,contextName){var initialState=new squp.feature.i18n.MessageContextState();initialState.plugins=[pluginName];initialState.context=contextName;return initialState;};prototype.isContextRegistered=function(context){return this.contextsHolder.isContextRegistered(context);};prototype.setLocale=function(locale){this.globalize=new Globalize(locale);var pluginToContextsMap=this.contextsHolder.getPluginToContextsMap();for(var plugin in pluginToContextsMap){this.updateContextStatuses(pluginToContextsMap[plugin],squp.ext.i18n.ContextStatus.REGISTERED);this.downloadFile(this.getLocale(),plugin,pluginToContextsMap[plugin]);}};prototype.downloadFile=function(locale,plugin,messageContexts){if(messageContexts.length==0){return;}
this.updateContextStatuses(messageContexts,squp.ext.i18n.ContextStatus.LOADING);var contexts=[];for(var ind in messageContexts){if(!(messageContexts).hasOwnProperty(ind))
continue;contexts.push(messageContexts[ind].context);}
new squp.util.RequestBuilder("/"+plugin+"/platform/i18n/"+locale+"/"+contexts.join(","),"GET").call().then(stjs.bind(this,function(content){this.updateContextStatuses(messageContexts,squp.ext.i18n.ContextStatus.LOADED);Globalize.loadMessages(content);this.globalize=new Globalize(locale);this.notifySpecificWatchers(messageContexts);}),stjs.bind(this,function(error){squp.feature.i18n.LocalizationImpl.LOGGER.error("Error during loading contexts: "+contexts+" , error "+error);this.updateContextStatuses(messageContexts,squp.ext.i18n.ContextStatus.ERROR);}));};prototype.notifySpecificWatchers=function(loadedContexts){for(var ind in loadedContexts){if(!(loadedContexts).hasOwnProperty(ind))
continue;loadedContexts[ind].notifyMessageContextWatchers();}
this.notifyWatchers();};prototype.addContextWatcher=function(context,callback){if(undefined==context||context==null){this.addWatcher(callback);}else{this.contextsHolder.getMessageContextState(context).addWatcher(callback);}};prototype.removeContextWatcher=function(context,callback){if(undefined==context||context==null){this.removeWatcher(callback);}else{this.contextsHolder.getMessageContextState(context).removeWatcher(callback);}};prototype.updateContextStatuses=function(contextsList,status){for(var ind in contextsList){if(!(contextsList).hasOwnProperty(ind))
continue;contextsList[ind].setCurrentData(status);}};prototype.getLocale=function(){return this.globalize.cldr.locale;};prototype.translate=function(key,substitutions){var context=key.split("/")[0];if(!this.isContextRegistered(context)){squp.feature.i18n.LocalizationImpl.LOGGER.error("Context is not registered for key: ",key);return"[ Missing translation for key "+key+" ]";}
if(this.contextsHolder.getMessageContextState(context)!=null&&this.contextsHolder.getMessageContextState(context).getCurrentData()==squp.ext.i18n.ContextStatus.LOADING){return"";}
var translatedMessage;try{translatedMessage=this.globalize.messageFormatter(key)(substitutions);}catch(ex){squp.feature.i18n.LocalizationImpl.LOGGER.error("Unable to translate the key: "+key+", error: "+ex);translatedMessage="[ Missing translation for key "+key+" ]";}
return translatedMessage;};prototype.formatCurrency=function(currency,value,options){return this.globalize.currencyFormatter(currency,options)(value);};prototype.formatDate=function(date,options){return this.globalize.dateFormatter(options)(date);};prototype.parseDate=function(date,options){return this.globalize.dateParser(options)(date);};prototype.formatNumber=function(number,options){return this.globalize.numberFormatter(options)(number);};prototype.parseNumber=function(toParse,options){return this.globalize.numberParser(options)(toParse);};prototype.formatRelativeTime=function(time,unit,options){return this.globalize.relativeTimeFormatter(unit,options)(time);};},{LOGGER:"squp.util.Logger",globalize:"Globalize",contextsHolder:"squp.feature.i18n.MessageContextsHolder",subscribers:{name:"Array",arguments:[{name:"Callback1",arguments:["T"]}]}},{});stjs.ns("squp.feature.notifications");squp.feature.notifications.NotificationContainer=function(){};squp.feature.notifications.NotificationContainer=stjs.extend(squp.feature.notifications.NotificationContainer,null,[],function(constructor,prototype){prototype.getData=function(strings){this.setState({notifications:strings});};prototype.getInitialState=function(){return{notifications:[]};};prototype.componentWillMount=function(){squp.feature.notifications.NotificationDataStore.getInstance().addWatcher(stjs.bind(this,"getData"));};prototype.componentWillUnmount=function(){squp.feature.notifications.NotificationDataStore.getInstance().removeWatcher(stjs.bind(this,"getData"));};prototype.render=function(){return React.DOM.div({"className":"NotificationContainer"},this.renderNotifications());};prototype.dismissCallback=function(notification){return function(event){squp.feature.notifications.NotificationDataStore.getInstance().dismiss(notification);};};prototype.renderNotifications=function(){var notifications=[];for(var i in this.state.notifications){if(!(this.state.notifications).hasOwnProperty(i))
continue;var notification=this.state.notifications[i];notifications.push(React.createElement(components.core.Alert,{level:notification.level,actionLabel:notification.actionLabel,actionCallback:notification.actionCallback,closeCallback:this.dismissCallback(notification)},React.DOM.div({"className":"Alert__icon"},React.DOM.i({"className":"Icon-alert-"+notification.level})),React.DOM.div({"className":"Alert__body"},notification.content)));}
return notifications;};},{mixins:{name:"Array",arguments:[{name:"Class",arguments:["Object"]}]},statics:{name:"Map",arguments:[null,"Function0"]},propTypes:{name:"Map",arguments:[null,"TypeChecker"]},context:"Object",contextTypes:{name:"Map",arguments:[null,null]},childContextTypes:{name:"Map",arguments:[null,null]},refs:{name:"Map",arguments:[null,"Element"]}},{_:{"IsReactClass":{}}});
stjs.ns("components.table");components.table.TableExtensionChain=function(){};components.table.TableExtensionChain=stjs.extend(components.table.TableExtensionChain,null,[],function(constructor,prototype){prototype.init=function(dataModel,columnModel,options,attributes,extensions){};prototype.destroy=function(){};prototype.handleTableModelEvent=function(event){};prototype.handleTableColumnModelEvent=function(event){};prototype.handleTableCellClicked=function(event){};prototype.handleTableHeaderClicked=function(event){};prototype.handleBodySectionSizeChanged=function(event){};prototype.handleHeadSectionSizeChanged=function(event){};prototype.handleInvalidate=function(event){};prototype.handleInvalidateSizes=function(event){};prototype.renderTable=function(){};prototype.formatTable=function(table){};prototype.renderHeadSection=function(){};prototype.formatHeadSection=function(head){};prototype.renderHeadRow=function(){};prototype.formatHeadRow=function(row){};prototype.renderHeadCell=function(columnIndex){};prototype.formatHeadCell=function(columnIndex,cell){};prototype.renderBodySection=function(){};prototype.formatBodySection=function(body){};prototype.renderBodyRow=function(rowIndex){};prototype.formatBodyRow=function(rowIndex,row){};prototype.renderBodyCell=function(rowIndex,columnIndex){};prototype.formatBodyCell=function(rowIndex,columnIndex,cell){};},{},{});stjs.ns("components.table");components.table.TableExtension=function(){};components.table.TableExtension=stjs.extend(components.table.TableExtension,null,[],function(constructor,prototype){prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){};prototype.destroy=function(chain){};prototype.handleTableModelEvent=function(event,chain){};prototype.handleTableColumnModelEvent=function(event,chain){};prototype.handleTableCellClicked=function(event,chain){};prototype.handleTableHeaderClicked=function(event,chain){};prototype.handleBodySectionSizeChanged=function(event,chain){};prototype.handleHeadSectionSizeChanged=function(event,chain){};prototype.handleInvalidate=function(event,chain){};prototype.handleInvalidateSizes=function(event,chain){};prototype.renderTable=function(chain){};prototype.formatTable=function(table,chain){};prototype.renderHeadSection=function(chain){};prototype.formatHeadSection=function(head,chain){};prototype.renderHeadRow=function(chain){};prototype.formatHeadRow=function(row,chain){};prototype.renderHeadCell=function(columnIndex,chain){};prototype.formatHeadCell=function(columnIndex,cell,chain){};prototype.renderBodySection=function(chain){};prototype.formatBodySection=function(body,chain){};prototype.renderBodyRow=function(rowIndex,chain){};prototype.formatBodyRow=function(rowIndex,row,chain){};prototype.renderBodyCell=function(rowIndex,columnIndex,chain){};prototype.formatBodyCell=function(rowIndex,columnIndex,cell,chain){};},{},{});stjs.ns("components.table");components.table.SectionDispatcher=function(extensions){this.extensions=extensions.anchoredAtNext();};components.table.SectionDispatcher=stjs.extend(components.table.SectionDispatcher,null,[],function(constructor,prototype){prototype.extensions=null;prototype.dispatchRenderSection=function(){};prototype.appendSectionToTable=function(table,section){};prototype.dispatchFormatSection=function(section){};prototype.dispatchSizeChanged=function(evt){};prototype.dispatchRenderRow=function(rowIndex){};prototype.dispatchFormatRow=function(rowIndex,row){};prototype.dispatchFormatCell=function(rowIndex,colIndex,cell){};prototype.dispatchRenderCell=function(rowIndex,colIndex){};prototype.backwardChain=function(){return this.extensions.backwardChain();};constructor.Head=function(extensions){components.table.SectionDispatcher.call(this,extensions);};constructor.Head=stjs.extend(constructor.Head,components.table.SectionDispatcher,[],function(constructor,prototype){prototype.dispatchRenderSection=function(){return this.backwardChain().renderHeadSection();};prototype.appendSectionToTable=function(table,section){table.appendHeadSection(section);};prototype.dispatchFormatSection=function(section){this.backwardChain().formatHeadSection(section);};prototype.dispatchSizeChanged=function(evt){this.backwardChain().handleHeadSectionSizeChanged(evt);};prototype.dispatchRenderRow=function(rowIndex){return this.backwardChain().renderHeadRow();};prototype.dispatchFormatRow=function(rowIndex,row){this.backwardChain().formatHeadRow(row);};prototype.dispatchFormatCell=function(rowIndex,colIndex,cell){this.backwardChain().formatHeadCell(colIndex,cell);};prototype.dispatchRenderCell=function(rowIndex,colIndex){return this.backwardChain().renderHeadCell(colIndex);};},{extensions:"components.table.TableExtensionList"},{});constructor.Body=function(extensions){components.table.SectionDispatcher.call(this,extensions);};constructor.Body=stjs.extend(constructor.Body,components.table.SectionDispatcher,[],function(constructor,prototype){prototype.dispatchRenderSection=function(){return this.backwardChain().renderBodySection();};prototype.appendSectionToTable=function(table,section){table.appendBodySection(section);};prototype.dispatchFormatSection=function(section){this.backwardChain().formatBodySection(section);};prototype.dispatchSizeChanged=function(evt){this.backwardChain().handleBodySectionSizeChanged(evt);};prototype.dispatchRenderRow=function(rowIndex){return this.backwardChain().renderBodyRow(rowIndex);};prototype.dispatchFormatRow=function(rowIndex,row){this.backwardChain().formatBodyRow(rowIndex,row);};prototype.dispatchFormatCell=function(rowIndex,colIndex,cell){this.backwardChain().formatBodyCell(rowIndex,colIndex,cell);};prototype.dispatchRenderCell=function(rowIndex,colIndex){return this.backwardChain().renderBodyCell(rowIndex,colIndex);};},{extensions:"components.table.TableExtensionList"},{});},{extensions:"components.table.TableExtensionList"},{});stjs.ns("components.table");components.table.InvalidateEvent=function(section,steps){this.steps=steps;this.section=section;};components.table.InvalidateEvent=stjs.extend(components.table.InvalidateEvent,null,[],function(constructor,prototype){prototype.section=null;prototype.steps=null;prototype.visit=function(visitor){this.steps.forEach(stjs.bind(this,function(step,i,a){return step.accept(visitor,this.section);}));};constructor.onBody=function(){return new components.table.InvalidateEvent.Builder(components.table.InvalidateEvent.Section.BODY);};constructor.onHead=function(){return new components.table.InvalidateEvent.Builder(components.table.InvalidateEvent.Section.HEAD);};prototype.getSection=function(){return this.section;};constructor.StepType=stjs.enumeration("ROWS","CELLS","SECTION");constructor.Section=stjs.enumeration("BODY","HEAD");constructor.Step=function(type){this.type=type;};constructor.Step=stjs.extend(constructor.Step,null,[],function(constructor,prototype){prototype.type=null;prototype.getType=function(){return this.type;};prototype.accept=function(visitor,section){};},{type:{name:"Enum",arguments:["components.table.InvalidateEvent.StepType"]}},{});constructor.RowsStep=function(firstRow,rowCount){components.table.InvalidateEvent.Step.call(this,components.table.InvalidateEvent.StepType.ROWS);this.rowCount=rowCount;this.firstRow=firstRow;};constructor.RowsStep=stjs.extend(constructor.RowsStep,components.table.InvalidateEvent.Step,[],function(constructor,prototype){prototype.firstRow=0;prototype.rowCount=0;prototype.getRowCount=function(){return this.rowCount;};prototype.getFirstRow=function(){return this.firstRow;};prototype.accept=function(visitor,section){visitor.visitRows(this,section);};},{type:{name:"Enum",arguments:["components.table.InvalidateEvent.StepType"]}},{});constructor.CellsStep=function(columns,firstRow,rowCount){components.table.InvalidateEvent.Step.call(this,components.table.InvalidateEvent.StepType.CELLS);this.columns=columns;this.firstRow=firstRow;this.rowCount=rowCount;};constructor.CellsStep=stjs.extend(constructor.CellsStep,components.table.InvalidateEvent.Step,[],function(constructor,prototype){prototype.firstRow=0;prototype.rowCount=0;prototype.columns=null;prototype.getColumnIdentifiers=function(){return this.columns;};prototype.getFirstRow=function(){return this.firstRow;};prototype.getRowCount=function(){return this.rowCount;};prototype.accept=function(visitor,section){visitor.visitCells(this,section);};},{columns:{name:"Array",arguments:[null]},type:{name:"Enum",arguments:["components.table.InvalidateEvent.StepType"]}},{});constructor.SectionStep=function(){components.table.InvalidateEvent.Step.call(this,components.table.InvalidateEvent.StepType.SECTION);};constructor.SectionStep=stjs.extend(constructor.SectionStep,components.table.InvalidateEvent.Step,[],function(constructor,prototype){prototype.accept=function(visitor,section){visitor.visitSection(this,section);};},{type:{name:"Enum",arguments:["components.table.InvalidateEvent.StepType"]}},{});constructor.StepVisitor=function(){};constructor.StepVisitor=stjs.extend(constructor.StepVisitor,null,[],function(constructor,prototype){prototype.visitRows=function(step,section){};prototype.visitSection=function(step,section){};prototype.visitCells=function(step,section){};},{},{});constructor.Builder=function(section){this.steps=[];this.section=section;};constructor.Builder=stjs.extend(constructor.Builder,null,[],function(constructor,prototype){prototype.section=null;prototype.steps=null;prototype.withRows=function(firstRow,rowCount){this.steps.push(new components.table.InvalidateEvent.RowsStep(firstRow,rowCount));return this;};prototype.withSection=function(){this.steps.push(new components.table.InvalidateEvent.SectionStep());return this;};prototype.withCells=function(properties,firstRow,rowCount){this.steps.push(new components.table.InvalidateEvent.CellsStep(properties,firstRow,rowCount));return this;};prototype.get=function(){return new components.table.InvalidateEvent(this.section,this.steps);};},{section:{name:"Enum",arguments:["components.table.InvalidateEvent.Section"]},steps:{name:"Array",arguments:["components.table.InvalidateEvent.Step"]}},{});},{section:{name:"Enum",arguments:["components.table.InvalidateEvent.Section"]},steps:{name:"Array",arguments:["components.table.InvalidateEvent.Step"]}},{});stjs.ns("components.table");components.table.TableRenderingOptions=function(){};components.table.TableRenderingOptions=stjs.extend(components.table.TableRenderingOptions,null,[],function(constructor,prototype){prototype.id=null;prototype.cssClass=null;prototype.extensions=null;prototype.debugRepainting=null;},{extensions:{name:"Array",arguments:["Object"]}},{});stjs.ns("components.table");components.table.ModelEvent=function(model,steps){this.model=model;this.steps=steps;};components.table.ModelEvent=stjs.extend(components.table.ModelEvent,null,[],function(constructor,prototype){prototype.model=null;prototype.steps=null;prototype.toString=function(){var constructor=this.model.getClass();var modelClass=(constructor)["name"];return"ModelEvent< "+modelClass+">["+this.steps.toString()+"]";};prototype.visit=function(visitor){this.steps.forEach(stjs.bind(this,function(step,i,a){return step.accept(visitor,this.model);}));};constructor.on=function(model){var casted=model;return new components.table.ModelEvent.Builder(casted);};constructor.StepType=stjs.enumeration("INSERT","DELETE","UPDATE","MOVE");constructor.Step=function(type){this.type=type;};constructor.Step=stjs.extend(constructor.Step,null,[],function(constructor,prototype){prototype.type=null;prototype.getType=function(){return this.type;};prototype.accept=function(visitor,model){};},{type:{name:"Enum",arguments:["components.table.ModelEvent.StepType"]}},{});constructor.InsertStep=function(insertIndex,elementCount){components.table.ModelEvent.Step.call(this,components.table.ModelEvent.StepType.INSERT);this.insertIndex=insertIndex;this.elementCount=elementCount;};constructor.InsertStep=stjs.extend(constructor.InsertStep,components.table.ModelEvent.Step,[],function(constructor,prototype){prototype.elementCount=0;prototype.insertIndex=0;prototype.getInsertIndex=function(){return this.insertIndex;};prototype.getElementCount=function(){return this.elementCount;};prototype.accept=function(visitor,model){visitor.visitInsert(this,model);};prototype.toString=function(){return"insert(getElementCount:"+this.elementCount+", getInsertIndex:"+this.insertIndex+")";};},{type:{name:"Enum",arguments:["components.table.ModelEvent.StepType"]}},{});constructor.DeleteStep=function(deleteIndex,deletedElements){components.table.ModelEvent.Step.call(this,components.table.ModelEvent.StepType.DELETE);this.deleteIndex=deleteIndex;this.deletedElements=deletedElements;};constructor.DeleteStep=stjs.extend(constructor.DeleteStep,components.table.ModelEvent.Step,[],function(constructor,prototype){prototype.deleteIndex=0;prototype.deletedElements=null;prototype.getDeleteIndex=function(){return this.deleteIndex;};prototype.getElementCount=function(){return this.deletedElements.length;};prototype.getElements=function(){return this.deletedElements;};prototype.accept=function(visitor,model){visitor.visitDelete(this,model);};prototype.toString=function(){return"delete(getDeleteIndex:"+this.deleteIndex+", getElementCount:"+this.getElementCount()+")";};},{deletedElements:{name:"Array",arguments:["Object"]},type:{name:"Enum",arguments:["components.table.ModelEvent.StepType"]}},{});constructor.UpdateStep=function(propertyIds,updateIndex,elementCount){components.table.ModelEvent.Step.call(this,components.table.ModelEvent.StepType.UPDATE);this.propertyIds=propertyIds;this.updateIndex=updateIndex;this.elementCount=elementCount;};constructor.UpdateStep=stjs.extend(constructor.UpdateStep,components.table.ModelEvent.Step,[],function(constructor,prototype){prototype.updateIndex=0;prototype.elementCount=0;prototype.propertyIds=null;prototype.getPropertyIds=function(){return this.propertyIds;};prototype.getUpdateIndex=function(){return this.updateIndex;};prototype.getElementCount=function(){return this.elementCount;};prototype.affectsAllProperties=function(){return this.propertyIds.length==0;};prototype.affectsProperty=function(propertyId){return this.affectsAllProperties()||this.propertyIds.indexOf(propertyId)>=0;};prototype.accept=function(visitor,model){visitor.visitUpdate(this,model);};prototype.toString=function(){return"update(getUpdateIndex:"+this.updateIndex+", getElementCount:"+this.elementCount+", getPropertyIds:"+this.propertyIds+")";};},{propertyIds:{name:"Array",arguments:[null]},type:{name:"Enum",arguments:["components.table.ModelEvent.StepType"]}},{});constructor.MoveStep=function(destinationIndex,sourceIndex,elementCount){components.table.ModelEvent.Step.call(this,components.table.ModelEvent.StepType.MOVE);this.destinationIndex=destinationIndex;this.sourceIndex=sourceIndex;this.elementCount=elementCount;};constructor.MoveStep=stjs.extend(constructor.MoveStep,components.table.ModelEvent.Step,[],function(constructor,prototype){prototype.sourceIndex=0;prototype.elementCount=0;prototype.destinationIndex=0;prototype.getDestinationIndex=function(){return this.destinationIndex;};prototype.getSourceIndex=function(){return this.sourceIndex;};prototype.getElementCount=function(){return this.elementCount;};prototype.accept=function(visitor,model){visitor.visitMove(this,model);};prototype.toString=function(){return"move(getSourceIndex:"+this.sourceIndex+", getElementCount:"+this.elementCount+", getDestinationIndex:"+this.destinationIndex+")";};},{type:{name:"Enum",arguments:["components.table.ModelEvent.StepType"]}},{});constructor.Visitor=function(){};constructor.Visitor=stjs.extend(constructor.Visitor,null,[],function(constructor,prototype){prototype.visitInsert=function(step,model){};prototype.visitDelete=function(step,model){};prototype.visitMove=function(step,model){};prototype.visitUpdate=function(step,model){};},{},{});constructor.VisitorAdapter=function(){};constructor.VisitorAdapter=stjs.extend(constructor.VisitorAdapter,null,[components.table.ModelEvent.Visitor],function(constructor,prototype){prototype.visitInsert=function(step,model){};prototype.visitDelete=function(step,model){};prototype.visitMove=function(step,model){};prototype.visitUpdate=function(step,model){};},{},{});constructor.Builder=function(model){this.steps=[];this.model=model;};constructor.Builder=stjs.extend(constructor.Builder,null,[],function(constructor,prototype){prototype.model=null;prototype.steps=null;prototype.withStepsFrom=function(other){other.steps.forEach(stjs.bind(this,function(step){return this.pushStep(step);}));return this;};prototype.withElementsInserted=function(insertIndex,elementCount){this.pushStep(new components.table.ModelEvent.InsertStep(insertIndex,elementCount));return this;};prototype.withElementsMoved=function(destinationIndex,sourceIndex,elementCount){this.pushStep(new components.table.ModelEvent.MoveStep(destinationIndex,sourceIndex,elementCount));return this;};prototype.withElementsDeleted=function(deleteIndex,deletedElements){this.pushStep(new components.table.ModelEvent.DeleteStep(deleteIndex,deletedElements));return this;};prototype.withElementsUpdated=function(updateIndex,elementCount){this.pushStep(new components.table.ModelEvent.UpdateStep([],updateIndex,elementCount));return this;};prototype.withElementPropertiesUpdated=function(propertyIds,updateIndex,elementCount){this.pushStep(new components.table.ModelEvent.UpdateStep(propertyIds,updateIndex,elementCount));return this;};prototype.withStep=function(step){this.pushStep(step);return this;};prototype.get=function(){return new components.table.ModelEvent(this.model,this.steps);};prototype.pushStep=function(step){if(step==null){throw new RuntimeException("ModelEvent step is null");}
this.steps.push(step);};},{steps:{name:"Array",arguments:[{name:"components.table.ModelEvent.Step",arguments:["MODEL"]}]}},{});},{steps:{name:"Array",arguments:[{name:"components.table.ModelEvent.Step",arguments:["MODEL"]}]}},{});stjs.ns("components.table");components.table.Dom=function(){};components.table.Dom=stjs.extend(components.table.Dom,null,[],function(constructor,prototype){constructor.nbsp=(String).fromCharCode(160);constructor.elem=function(tagName){return window.document.createElement(tagName);};constructor.text=function(text){return window.document.createTextNode(text);};constructor.addClass=function(elem,className){if(className==null||className.trim()==""){return;}
if((elem)["classList"]==null){$(elem).addClass(className);}else{var classListArray=(className.trim()).split(" ");for(var i=0;i<classListArray.length;i++){var s=classListArray[i].trim();if(s!=""){elem.classList.add(s);}}}};constructor.removeClass=function(elem,className){var cls=elem.getAttribute("class");if(cls==null){return;}
var classes=(cls).split(" ");var idx=classes.indexOf(className);if(idx>=0){classes.splice(idx,1);}
elem.setAttribute("class",classes.join(" "));};constructor.width=function(elem,width){((elem)["style"])["width"]=width;};},{},{});stjs.ns("components.table");components.table.TableHeaderClickedEvent=function(columnIndex,column,event){this.column=column;this.columnIndex=columnIndex;this.event=event;};components.table.TableHeaderClickedEvent=stjs.extend(components.table.TableHeaderClickedEvent,null,[],function(constructor,prototype){prototype.columnIndex=0;prototype.column=null;prototype.event=null;prototype.getColumn=function(){return this.column;};prototype.getColumnIndex=function(){return this.columnIndex;};prototype.getEvent=function(){return this.event;};prototype.withIndex=function(columnIndex){if(this.columnIndex!=columnIndex){return new components.table.TableHeaderClickedEvent(columnIndex,this.column,this.event);}
return this;};},{column:"components.table.TableColumn",event:"Event"},{});stjs.ns("components.table");components.table.TableCellClickedEvent=function(rowIndex,columnIndex,column,cellValue,event){this.cellValue=cellValue;this.rowIndex=rowIndex;this.columnIndex=columnIndex;this.column=column;this.event=event;};components.table.TableCellClickedEvent=stjs.extend(components.table.TableCellClickedEvent,null,[],function(constructor,prototype){prototype.rowIndex=0;prototype.columnIndex=0;prototype.column=null;prototype.cellValue=null;prototype.event=null;prototype.getCellValue=function(){return this.cellValue;};prototype.getColumn=function(){return this.column;};prototype.getColumnIndex=function(){return this.columnIndex;};prototype.getEvent=function(){return this.event;};prototype.getRowIndex=function(){return this.rowIndex;};prototype.withIndices=function(rowIndex,columnIndex){if(this.rowIndex!=rowIndex||this.columnIndex!=columnIndex){return new components.table.TableCellClickedEvent(rowIndex,columnIndex,this.column,this.cellValue,this.event);}
return this;};},{column:"components.table.TableColumn",cellValue:"Object",event:"Event"},{});stjs.ns("components.table");components.table.VirtualModel=function(){};components.table.VirtualModel=stjs.extend(components.table.VirtualModel,null,[],function(constructor,prototype){prototype.getRealModel=function(){};prototype.getClientModel=function(){};prototype.applyEvent=function(underlyingEvent,listener){};prototype.elements=function(){};prototype.realRef=function(realIndex){};prototype.virtualRef=function(virtualIndex){};prototype.clientRef=function(clientIndex){};prototype.refFor=function(element){};},{},{});stjs.ns("components.table");components.table.InvalidateSizesEvent=function(onBody,onHead){this.onBody=onBody;this.onHead=onHead;};components.table.InvalidateSizesEvent=stjs.extend(components.table.InvalidateSizesEvent,null,[],function(constructor,prototype){prototype.onBody=false;prototype.onHead=false;prototype.isOnBody=function(){return this.onBody;};prototype.isOnHead=function(){return this.onHead;};},{},{});stjs.ns("components.table");components.table.Model=function(){};components.table.Model=stjs.extend(components.table.Model,null,[],function(constructor,prototype){prototype.addListener=function(listener){};prototype.removeListener=function(listener){};},{},{});stjs.ns("components.table");components.table.ParallelList=function(){};components.table.ParallelList=stjs.extend(components.table.ParallelList,null,[],function(constructor,prototype){prototype.append=function(value){};prototype.appendAll=function(values){};prototype.left=function(){};prototype.right=function(){};prototype.replace=function(oldValue,newValue){};constructor.Side=function(){};constructor.Side=stjs.extend(constructor.Side,null,[],function(constructor,prototype){prototype.size=function(){};prototype.indexOf=function(value){};prototype.get=function(index){};prototype.insert=function(newValue,index){};prototype.insertAfter=function(newValue,reference){};prototype.insertAllAfter=function(insertedRows,reference){};prototype.insertBefore=function(reference,newValue){};prototype.insertAllBefore=function(insertedRows,reference){};prototype.insertAll=function(newValues,index){};prototype.remove=function(value){};prototype.removeRange=function(fromIndex,deleteCount){};prototype.opposite=function(){};prototype.oppositeIndex=function(index){};prototype.move=function(fromIndex,toIndex){};prototype.moveAfter=function(move,reference){};prototype.moveRange=function(fromIndex,toIndex,count){};prototype.find=function(test){};prototype.findIndex=function(test){};prototype.findLast=function(test){};prototype.findLastIndex=function(test){};prototype.filter=function(test){};prototype.contains=function(row){};},{},{});},{},{});stjs.ns("components.table");components.table.CellFormatter=function(){};components.table.CellFormatter=stjs.extend(components.table.CellFormatter,null,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){};prototype.setNext=function(formatter){};prototype.getNext=function(){};},{},{});stjs.ns("components.table");components.table.TableColumnEvent=function(column,property,isExtraProperty,oldValue,newValue){this.column=column;this.property=property;this.extensionProperty=isExtraProperty;this.oldValue=oldValue;this.newValue=newValue;};components.table.TableColumnEvent=stjs.extend(components.table.TableColumnEvent,null,[],function(constructor,prototype){prototype.column=null;prototype.property=null;prototype.extensionProperty=false;prototype.oldValue=null;prototype.newValue=null;prototype.getColumn=function(){return this.column;};prototype.getProperty=function(){return this.property;};prototype.getNewValue=function(){return this.newValue;};prototype.getOldValue=function(){return this.oldValue;};prototype.isExtensionProperty=function(){return this.extensionProperty;};prototype.toString=function(){return"TableColumnEvent{"+"column="+this.column+", property='"+this.property+'\''+", extensionProperty="+this.extensionProperty+", oldValue="+this.oldValue+", newValue="+this.newValue+'}';};},{column:"components.table.TableColumn",oldValue:"Object",newValue:"Object"},{});stjs.ns("components.table");components.table.SectionClickedEvent=function(rowIndex,colIndex,event){this.colIndex=colIndex;this.rowIndex=rowIndex;this.event=event;};components.table.SectionClickedEvent=stjs.extend(components.table.SectionClickedEvent,null,[],function(constructor,prototype){prototype.rowIndex=0;prototype.colIndex=0;prototype.event=null;prototype.getColumnIndex=function(){return this.colIndex;};prototype.getEvent=function(){return this.event;};prototype.getRowIndex=function(){return this.rowIndex;};},{event:"Event"},{});stjs.ns("components.table");components.table.RenderedElement=function(){};components.table.RenderedElement=stjs.extend(components.table.RenderedElement,null,[],function(constructor,prototype){prototype.getElement=function(){};prototype.isVirtual=function(){};prototype.getWidthPixels=function(){};prototype.getHeightPixels=function(){};prototype.clearFormatting=function(){};prototype.getParent=function(){};prototype.setParent=function(parent){};},{},{});stjs.ns("components.table");components.table.BidiUniqueList=function(keyGenerator){this.array=[];this.map={};this.keyGenerator=keyGenerator;};components.table.BidiUniqueList=stjs.extend(components.table.BidiUniqueList,null,[],function(constructor,prototype){constructor.DEBUG_INDEX_VALIDATION=false;prototype.array=null;prototype.map=null;prototype.keyGenerator=null;prototype.get=function(index){this.verifyIndexInReadRange(index);return this.array[index];};prototype.getByKey=function(key){var index=this.indexOfKey(key);if(index>=0){return this.get(index);}
return null;};prototype.indexOf=function(value){var key=this.keyFor(value);return this.indexOfKey(key);};prototype.indexOfKey=function(key){this.verifyKeyNotNull(key);var index=this.map[key];if(index==null){return-1;}
return index;};prototype.contains=function(value){return this.indexOf(value)>=0;};prototype.size=function(){return this.array.length;};prototype.append=function(value){this.insert(value,this.size());};prototype.appendAll=function(values){this.insertAll(values,this.size());};prototype.set=function(newValue,index){this.verifyValueNotNull(newValue);this.verifyIndexInReadRange(index);var newKey=this.keyFor(newValue);this.verifyNotExists(newKey,newValue);var oldValue=this.get(index);var oldKey=this.keyFor(oldValue);this.array[index]=newValue;delete this.map[oldKey];this.map[newKey]=index;this.verifyIndex();};prototype.verifySliceRange=function(from,toExcluded){this.verifyIndexInReadRange(from);this.verifyIndexInInsertRange(toExcluded);if(toExcluded<from){throw new RuntimeException("(from = "+from+") > ("+toExcluded+" = toExcluded)");}};prototype.slice=function(from,endExcluded){if(endExcluded==null){endExcluded=this.size();}
this.verifySliceRange(from,endExcluded);return this.array.slice(0,endExcluded);};prototype.insert=function(newValue,index){this.verifyValueNotNull(newValue);this.verifyIndexInInsertRange(index);var newKey=this.keyFor(newValue);this.verifyNotExists(newKey,newValue);this.array.splice(index,0,newValue);this.map[newKey]=index;this.renumberMap(index+1,this.size(),+1);this.verifyIndex();};prototype.insertAll=function(values,index){this.verifyIndexInInsertRange(index);if(values.length==0){return;}
values.forEach(stjs.bind(this,function(val,i,arr){return this.verifyValueAtIndexNotNull(val,i);}));var keys=values.map(stjs.bind(this,function(val,i,arr){return this.keyFor(val);}));values.forEach(stjs.bind(this,function(val,i,arr){return this.verifyNotExists(keys[i],val);}));var args=[index,0].concat(values);((Array).prototype["splice"]).apply(this.array,args);keys.forEach(stjs.bind(this,function(key,i,arr){return this.map[key]=stjs.trunc((index+i));}));this.renumberMap(index+values.length,this.size(),values.length);this.verifyIndex();};prototype.insertAfter=function(newValue,reference){var referenceIndex=reference==null?-1:this.indexOf(reference);if(referenceIndex<0){referenceIndex=0;}
this.insert(newValue,referenceIndex+1);return referenceIndex+1;};prototype.insertAllAfter=function(newValues,reference){var referenceIndex=reference==null?-1:this.indexOf(reference);if(referenceIndex<0){referenceIndex=0;}
this.insertAll(newValues,referenceIndex+1);return referenceIndex+1;};prototype.insertBefore=function(newValue,reference){var referenceIndex=reference==null?-1:this.indexOf(reference);if(referenceIndex<0){referenceIndex=this.size();}
this.insert(newValue,referenceIndex);return referenceIndex;};prototype.insertAllBefore=function(newValues,reference){var referenceIndex=reference==null?-1:this.indexOf(reference);if(referenceIndex<0){referenceIndex=this.size();}
this.insertAll(newValues,referenceIndex);return referenceIndex;};prototype.removeIndex=function(index){return this.removeRange(index,1)[0];};prototype.removeAll=function(){return this.removeRange(0,this.size());};prototype.removeRange=function(index,count){this.verifyIndexInReadRange(index);this.verifyCountInRange(count);if(index+count>this.size()){throw new RuntimeException("Removed range runs past the end of the list. "+"(index + count = "+index+" + "+count+" = "+(index+count)+") "+"> (size = "+this.size()+")");}
if(count==0){return[];}
var removedValues=this.array.splice(index,count);removedValues.map(stjs.bind(this,function(val,i,arr){return this.keyFor(val);})).forEach(stjs.bind(this,function(val){return delete this.map[val];}));this.renumberMap(index,this.size(),-count);this.verifyIndex();return removedValues;};prototype.removeValue=function(value){this.verifyValueNotNull(value);var index=this.indexOf(value);if(index>=0){this.removeIndex(index);}
return index;};prototype.removeKey=function(key){this.verifyKeyNotNull(key);var index=this.indexOfKey(key);if(index<=0){return null;}
return this.removeIndex(index);};prototype.moveAfter=function(toMove,reference){var referenceIndex=reference==null?-1:this.indexOf(reference);var toMoveIndex=this.indexOf(toMove);this.verifyIndexInReadRange(toMoveIndex);if(toMoveIndex>=referenceIndex){referenceIndex+=1;}
this.move(toMoveIndex,referenceIndex);return referenceIndex;};prototype.move=function(fromIndex,toIndex){return this.moveRange(fromIndex,toIndex,1)[0];};prototype.moveRange=function(fromIndex,toIndex,count){this.verifyIndexInReadRange(fromIndex);this.verifyIndexInReadRange(toIndex);this.verifyCountInRange(count);if(fromIndex+count>this.size()){throw new RuntimeException("Selected range runs past the end of the list. "+"(to + count = "+fromIndex+" + "+count+" = "+(fromIndex+count)+") "+"> (size = "+this.size()+")");}else if(toIndex+count>this.size()){throw new RuntimeException("Destination range runs past the end of the list. "+"(to + count = "+toIndex+" + "+count+" = "+(toIndex+count)+") "+"> (size = "+this.size()+")");}
if(fromIndex==toIndex){return[];}
var distance=toIndex-fromIndex;if(distance<0){this.moveRange(toIndex,toIndex+count,-distance);return this.array.slice(toIndex,toIndex+count);}
var moved=this.array.splice(fromIndex,count);var args=[toIndex,0].concat(moved);((Array).prototype["splice"]).apply(this.array,args);this.renumberMap(toIndex,toIndex+count,distance);this.renumberMap(fromIndex,toIndex,-count);this.verifyIndex();return moved;};prototype.sort=function(sortFunction){this.array.sort(sortFunction);this.array.forEach(stjs.bind(this,function(value,i,arr){var key=this.keyFor(value);this.map[key]=stjs.trunc(stjs.trunc(i));}));this.verifyIndex();};prototype.forEach=function(callback){this.array.forEach(stjs.bind(this,function(item,i,arr){callback(item,i,this);}));};prototype.find=function(test){var index=this.findIndex(test);if(index>=0){return this.get(index);}
return null;};prototype.findReverse=function(test){var index=this.findIndexReverse(test);if(index>=0){return this.get(index);}
return null;};prototype.filter=function(test){return this.array.filter(function(elem,i,arr){return test(elem,i.intValue());});};prototype.findIndex=function(test){for(var i=0;i<this.size();i++){var val=this.get(i);if(test(val,i)){return i;}}
return-1;};prototype.findIndexReverse=function(test){for(var i=this.size()-1;i>=0;i--){var val=this.get(i);if(test(val,i)){return i;}}
return-1;};prototype.renumberMap=function(from,to,increment){for(var i=from;i<to;i++){var val=this.get(i);var key=this.keyFor(val);var index=this.map[key];this.map[key]=index+increment;}};prototype.keyFor=function(value){var key=this.keyGenerator(value);if(key==null){throw new RuntimeException("Key generated for value "+value+" is null");}
return key;};prototype.verifyNotExists=function(key,value){var existingIndex=this.map[key];if(existingIndex!=null){throw new RuntimeException("Value "+value+" already exists at index "+existingIndex);}};prototype.verifyIndexInReadRange=function(index){if(index<0){throw new RuntimeException("List index out of bounds: "+index+" < 0");}else if(index>=this.size()){throw new RuntimeException("List index out of bounds: "+index+" >= "+this.size());}};prototype.verifyIndexInInsertRange=function(index){if(index<0){throw new RuntimeException("List index out of bounds: "+index+" < 0");}else if(index>this.size()){throw new RuntimeException("List index out of bounds: "+index+" > "+this.size());}};prototype.verifyCountInRange=function(count){if(count<0){throw new RuntimeException("Count out of range: "+count+" < 0");}else if(count>this.size()){throw new RuntimeException("Count out of range: "+count+" > "+this.size());}};prototype.verifyValueNotNull=function(value){if(value==null){throw new RuntimeException("Null value");}};prototype.verifyKeyNotNull=function(key){if(key==null){throw new RuntimeException("Null key");}};prototype.verifyValueAtIndexNotNull=function(value,index){if(value==null){throw new RuntimeException("Null value at index "+index);}};prototype.verifyIndex=function(){if(components.table.BidiUniqueList.DEBUG_INDEX_VALIDATION){for(var i=0;i<this.array.length;i++){var val=this.array[i];var key=this.keyFor(val);if(this.map[key]!=i){throw new RuntimeException("Index is now wrong");}}}};},{array:{name:"Array",arguments:["T"]},map:{name:"Map",arguments:[null,null]},keyGenerator:{name:"Function1",arguments:["Object",null]}},{});stjs.ns("components.table");components.table.Ref=function(){};components.table.Ref=stjs.extend(components.table.Ref,null,[],function(constructor,prototype){prototype.toVirtual=function(){};prototype.toReal=function(){};prototype.toClient=function(){};prototype.hasNext=function(){};prototype.next=function(){};prototype.hasPrevious=function(){};prototype.previous=function(){};prototype.plus=function(offset){};prototype.minus=function(offset){};prototype.getMaxIndex=function(){};prototype.get=function(){};prototype.exists=function(){};prototype.index=function(){};},{},{});stjs.ns("components.table");components.table.ComponentResizedEvent=function(targetComponent,targetElement,oldWidth,oldHeight,newWidth,newHeight){this.targetComponent=targetComponent;this.targetElement=targetElement;this.oldWidth=oldWidth;this.oldHeight=oldHeight;this.newWidth=newWidth;this.newHeight=newHeight;};components.table.ComponentResizedEvent=stjs.extend(components.table.ComponentResizedEvent,null,[],function(constructor,prototype){prototype.targetComponent=null;prototype.targetElement=null;prototype.oldWidth=0;prototype.oldHeight=0;prototype.newWidth=0;prototype.newHeight=0;},{targetComponent:"Object",targetElement:"Element"},{});stjs.ns("components.table");components.table.BufferedRowManager=function(){};components.table.BufferedRowManager=stjs.extend(components.table.BufferedRowManager,null,[],null,{},{});stjs.ns("components.table");components.table.SwitchableTableColumnModel=function(){};components.table.SwitchableTableColumnModel=stjs.extend(components.table.SwitchableTableColumnModel,null,[],null,{},{});stjs.ns("components.table");components.table.VirtualModelObject=function(){};components.table.VirtualModelObject=stjs.extend(components.table.VirtualModelObject,null,[],function(constructor,prototype){prototype.getId=function(){};},{},{});stjs.ns("components.table");components.table.ApplyEventListener=function(){};components.table.ApplyEventListener=stjs.extend(components.table.ApplyEventListener,null,[],function(constructor,prototype){prototype.beforeApplyInsert=function(step,model){};prototype.afterApplyInsert=function(step,model){};prototype.beforeApplyDelete=function(step,model){};prototype.afterApplyDelete=function(step,model){};prototype.beforeApplyMove=function(step,model){};prototype.afterApplyMove=function(step,model){};prototype.beforeApplyUpdate=function(step,model){};prototype.afterApplyUpdate=function(step,model){};constructor.Adapter=function(){};constructor.Adapter=stjs.extend(constructor.Adapter,null,[components.table.ApplyEventListener],function(constructor,prototype){prototype.beforeApplyInsert=function(step,model){};prototype.afterApplyInsert=function(step,model){};prototype.beforeApplyDelete=function(step,model){};prototype.afterApplyDelete=function(step,model){};prototype.beforeApplyMove=function(step,model){};prototype.afterApplyMove=function(step,model){};prototype.beforeApplyUpdate=function(step,model){};prototype.afterApplyUpdate=function(step,model){};},{},{});},{},{});stjs.ns("components.table");components.table.DefaultTableExtensionChain=function(extensions,initialIndex){this.extensions=extensions;this.nextIndex=initialIndex;};components.table.DefaultTableExtensionChain=stjs.extend(components.table.DefaultTableExtensionChain,null,[components.table.TableExtensionChain],function(constructor,prototype){prototype.extensions=null;prototype.nextIndex=0;prototype.init=function(dataModel,columnModel,options,attributes,extensions){this.withNext(stjs.bind(this,function(ext){return ext.init(dataModel,columnModel,options,attributes,extensions.anchoredAtNext(),this);}));};prototype.destroy=function(){this.withNext(stjs.bind(this,function(ext){return ext.destroy(this);}));};prototype.handleTableModelEvent=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleTableModelEvent(event,this);}));};prototype.handleTableColumnModelEvent=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleTableColumnModelEvent(event,this);}));};prototype.handleTableCellClicked=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleTableCellClicked(event,this);}));};prototype.handleTableHeaderClicked=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleTableHeaderClicked(event,this);}));};prototype.handleBodySectionSizeChanged=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleBodySectionSizeChanged(event,this);}));};prototype.handleHeadSectionSizeChanged=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleHeadSectionSizeChanged(event,this);}));};prototype.handleInvalidate=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleInvalidate(event,this);}));};prototype.handleInvalidateSizes=function(event){this.withNext(stjs.bind(this,function(ext){return ext.handleInvalidateSizes(event,this);}));};prototype.renderTable=function(){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderTable(this);}));};prototype.formatTable=function(table){this.withNext(stjs.bind(this,function(ext){return ext.formatTable(table,this);}));};prototype.renderHeadSection=function(){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderHeadSection(this);}));};prototype.formatHeadSection=function(head){this.withNext(stjs.bind(this,function(ext){return ext.formatHeadSection(head,this);}));};prototype.renderHeadRow=function(){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderHeadRow(this);}));};prototype.formatHeadRow=function(row){this.withNext(stjs.bind(this,function(ext){return ext.formatHeadRow(row,this);}));};prototype.renderHeadCell=function(columnIndex){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderHeadCell(columnIndex,this);}));};prototype.formatHeadCell=function(columnIndex,cell){this.withNext(stjs.bind(this,function(ext){return ext.formatHeadCell(columnIndex,cell,this);}));};prototype.renderBodySection=function(){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderBodySection(this);}));};prototype.formatBodySection=function(body){this.withNext(stjs.bind(this,function(ext){return ext.formatBodySection(body,this);}));};prototype.renderBodyRow=function(rowIndex){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderBodyRow(rowIndex,this);}));};prototype.formatBodyRow=function(rowIndex,row){this.withNext(stjs.bind(this,function(ext){return ext.formatBodyRow(rowIndex,row,this);}));};prototype.renderBodyCell=function(rowIndex,columnIndex){return this.withNextReturn(stjs.bind(this,function(ext){return ext.renderBodyCell(rowIndex,columnIndex,this);}));};prototype.formatBodyCell=function(rowIndex,columnIndex,cell){this.withNext(stjs.bind(this,function(ext){return ext.formatBodyCell(rowIndex,columnIndex,cell,this);}));};prototype.withNext=function(callback){this.withNextReturn(function(ext){callback(ext);return null;});};prototype.withNextReturn=function(func){var next=this.next();if(next==null){return null;}
return func(next);};prototype.next=function(){if(this.nextIndex>=this.extensions.length){return null;}
var next=this.extensions[this.nextIndex];this.nextIndex++;return next;};},{extensions:{name:"Array",arguments:["Object"]}},{});stjs.ns("components.table");components.table.AbstractTableExtension=function(){};components.table.AbstractTableExtension=stjs.extend(components.table.AbstractTableExtension,null,[components.table.TableExtension],function(constructor,prototype){prototype.tableModel=null;prototype.columnModel=null;prototype.options=null;prototype.extensions=null;prototype.attributes=null;prototype.getColumnModel=function(){return this.columnModel;};prototype.getTableModel=function(){return this.tableModel;};prototype.getOptions=function(){return this.options;};prototype.forwardChain=function(){return this.extensions.forwardChain();};prototype.backwardChain=function(){return this.extensions.backwardChain();};prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){this.tableModel=dataModel;this.columnModel=columnModel;this.options=options;this.extensions=extensions;this.attributes=attributes;chain.init(dataModel,columnModel,options,attributes,extensions);};prototype.destroy=function(chain){chain.destroy();this.tableModel=null;this.columnModel=null;this.options=null;};prototype.handleTableModelEvent=function(event,chain){chain.handleTableModelEvent(event);};prototype.handleTableColumnModelEvent=function(event,chain){chain.handleTableColumnModelEvent(event);};prototype.handleTableCellClicked=function(event,chain){chain.handleTableCellClicked(event);};prototype.handleTableHeaderClicked=function(event,chain){chain.handleTableHeaderClicked(event);};prototype.handleBodySectionSizeChanged=function(event,chain){chain.handleBodySectionSizeChanged(event);};prototype.handleHeadSectionSizeChanged=function(event,chain){chain.handleHeadSectionSizeChanged(event);};prototype.handleInvalidate=function(event,chain){chain.handleInvalidate(event);};prototype.handleInvalidateSizes=function(event,chain){chain.handleInvalidateSizes(event);};prototype.renderTable=function(chain){return chain.renderTable();};prototype.formatTable=function(table,chain){chain.formatTable(table);};prototype.renderHeadSection=function(chain){return chain.renderHeadSection();};prototype.formatHeadSection=function(head,chain){chain.formatHeadSection(head);};prototype.renderHeadRow=function(chain){return chain.renderHeadRow();};prototype.formatHeadRow=function(row,chain){chain.formatHeadRow(row);};prototype.renderHeadCell=function(columnIndex,chain){return chain.renderHeadCell(columnIndex);};prototype.formatHeadCell=function(columnIndex,cell,chain){chain.formatHeadCell(columnIndex,cell);};prototype.renderBodySection=function(chain){return chain.renderBodySection();};prototype.formatBodySection=function(body,chain){chain.formatBodySection(body);};prototype.renderBodyRow=function(rowIndex,chain){return chain.renderBodyRow(rowIndex);};prototype.formatBodyRow=function(rowIndex,row,chain){chain.formatBodyRow(rowIndex,row);};prototype.renderBodyCell=function(rowIndex,columnIndex,chain){return chain.renderBodyCell(rowIndex,columnIndex);};prototype.formatBodyCell=function(rowIndex,columnIndex,cell,chain){chain.formatBodyCell(rowIndex,columnIndex,cell);};prototype.getAttributes=function(){return this.attributes;};},{tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes"},{});stjs.ns("components.table");components.table.DirectModel=function(){};components.table.DirectModel=stjs.extend(components.table.DirectModel,null,[components.table.VirtualModel],function(constructor,prototype){prototype.getElementCount=function(){};prototype.getModelObject=function(index){};},{},{});stjs.ns("components.table");components.table.TableColumnModel=function(){};components.table.TableColumnModel=stjs.extend(components.table.TableColumnModel,null,[components.table.Model],function(constructor,prototype){prototype.getColumn=function(columnIndex){};prototype.getColumnByIdentifier=function(modelIdentifier){};prototype.getColumnIndex=function(modelIdentifier){};prototype.getColumnCount=function(){};prototype.getColumnIndices=function(modelIdentifiers){};},{},{});stjs.ns("components.table");components.table.TableModel=function(){};components.table.TableModel=stjs.extend(components.table.TableModel,null,[components.table.Model],function(constructor,prototype){prototype.getRowCount=function(){};prototype.getRowData=function(rowIndex){};prototype.getValueAt=function(rowIndex,columnIdentifier){};},{},{});stjs.ns("components.table");components.table.DirectParallelList=function(model){this.side=new components.table.DirectParallelList.Side(model);};components.table.DirectParallelList=stjs.extend(components.table.DirectParallelList,null,[components.table.ParallelList],function(constructor,prototype){prototype.side=null;prototype.left=function(){return this.side;};prototype.right=function(){return this.side;};prototype.append=function(value){throw new RuntimeException("Unsupported operation");};prototype.appendAll=function(values){throw new RuntimeException("Unsupported operation");};prototype.replace=function(oldValue,newValue){throw new RuntimeException("Unsupported operation");};constructor.Side=function(model){this.model=model;};constructor.Side=stjs.extend(constructor.Side,null,[components.table.ParallelList.Side],function(constructor,prototype){prototype.model=null;prototype.size=function(){return this.model.getElementCount();};prototype.indexOf=function(value){return this.findIndex(function(v,i){return v==value;});};prototype.get=function(index){if(index<0){throw new RuntimeException("List index out of bounds: "+index+" < 0");}else if(index>=this.size()){throw new RuntimeException("List index out of bounds: "+index+" >= "+this.size());}
return this.model.getModelObject(index);};prototype.opposite=function(){return this;};prototype.oppositeIndex=function(index){return index;};prototype.find=function(test){var index=this.findIndex(test);if(index<0){return null;}
return this.get(index);};prototype.findIndex=function(test){for(var i=0;i<this.size();i++){if(test(this.get(i),i)){return i;}}
return-1;};prototype.findLast=function(test){var index=this.findLastIndex(test);if(index<0){return null;}
return this.get(index);};prototype.findLastIndex=function(test){for(var i=this.size()-1;i>=0;i--){if(test(this.get(i),i)){return i;}}
return-1;};prototype.filter=function(test){var result=[];for(var i=0;i<this.size();i++){var elem=this.get(i);if(test(elem,i)){result.push(elem);}}
return result;};prototype.contains=function(row){return this.indexOf(row)>=0;};prototype.insert=function(newValue,index){throw new RuntimeException("Unsupported operation");};prototype.insertAfter=function(newValue,reference){throw new RuntimeException("Unsupported operation");};prototype.insertAllAfter=function(insertedRows,reference){throw new RuntimeException("Unsupported operation");};prototype.insertBefore=function(reference,newValue){throw new RuntimeException("Unsupported operation");};prototype.insertAllBefore=function(insertedRows,reference){throw new RuntimeException("Unsupported operation");};prototype.insertAll=function(newValues,index){throw new RuntimeException("Unsupported operation");};prototype.remove=function(value){throw new RuntimeException("Unsupported operation");};prototype.removeRange=function(fromIndex,deleteCount){throw new RuntimeException("Unsupported operation");};prototype.move=function(fromIndex,toIndex){throw new RuntimeException("Unsupported operation");};prototype.moveAfter=function(move,reference){throw new RuntimeException("Unsupported operation");};prototype.moveRange=function(fromIndex,toIndex,count){throw new RuntimeException("Unsupported operation");};},{model:{name:"components.table.DirectModel",arguments:["Object","T"]}},{});},{side:{name:"components.table.DirectParallelList.Side",arguments:["T"]}},{});stjs.ns("components.table");components.table.TableAttributes=function(){this.attributes={};this.listeners={};};components.table.TableAttributes=stjs.extend(components.table.TableAttributes,null,[],function(constructor,prototype){constructor.Attributes=stjs.enumeration("VIEWPORT_WIDTH","VIEWPORT_HEIGHT");constructor.LOGGER=squp.util.LoggerFactory.getLogger("TableAttributes");prototype.attributes=null;prototype.listeners=null;prototype.put=function(attributeName,value){var oldValue=this.attributes[attributeName];this.attributes[attributeName]=value;this.invokeListeners(attributeName,value,oldValue);return oldValue;};prototype.get=function(attributeName){return this.attributes[attributeName];};prototype.addListener=function(attributeName,listener){var attrListeners=this.listeners[attributeName];if(attrListeners==null){attrListeners=[];this.listeners[attributeName]=attrListeners;}
if(attrListeners.indexOf(listener)<0){attrListeners.push(listener);return true;}
return false;};prototype.removeListener=function(attributeName,listener){var attrListeners=this.listeners[attributeName];if(attrListeners==null){return false;}
var index=attrListeners.indexOf(listener);if(index>=0){attrListeners.splice(index,1);return true;}
return false;};prototype.invokeListeners=function(attributeName,newValue,oldValue){var attrListeners=this.listeners[attributeName];if(attrListeners!=null){attrListeners.forEach(stjs.bind(this,function(l){return this.invokeListenerSafely(l,attributeName,newValue,oldValue);}));}};prototype.invokeListenerSafely=function(listener,attributeName,newValue,oldValue){try{listener(attributeName,newValue,oldValue);}catch(e){var evt=attributeName+"("+oldValue+" -> "+newValue+")";components.table.TableAttributes.LOGGER.error("An error occurred while dispatching a TableAttributeUpdated event",evt,listener,e);}};},{LOGGER:"squp.util.Logger",attributes:{name:"Map",arguments:[null,"Object"]},listeners:{name:"Map",arguments:[null,{name:"Array",arguments:[{name:"Callback3",arguments:["Object","Object","Object"]}]}]}},{});stjs.ns("components.table");components.table.AbstractModel=function(){this.listeners=[];};components.table.AbstractModel=stjs.extend(components.table.AbstractModel,null,[components.table.Model],function(constructor,prototype){constructor.LOGGER=squp.util.LoggerFactory.getLogger("AbstractModel");prototype.listeners=null;prototype.newEvent=function(){return components.table.ModelEvent.on(this);};prototype.addListener=function(listener){if(this.listeners.indexOf(listener)<0){this.listeners.push(listener);return true;}
return false;};prototype.removeListener=function(listener){var index=this.listeners.indexOf(listener);if(index>=0){this.listeners.splice(index,1);return true;}
return false;};prototype.fireEvent=function(event){this.listeners.forEach(function(listener,i,arr){try{listener(event);}catch(e){components.table.AbstractModel.LOGGER.error("An error occurred while dispatching an event",event,listener,e);}});};},{LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.Scheduler=function(delayMs){this.delayMs=delayMs;this.tasks=[];};components.table.Scheduler=stjs.extend(components.table.Scheduler,null,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("Scheduler");constructor.NEXT_TASK_ID=0;prototype.timeout=null;prototype.delayMs=0;prototype.tasks=null;prototype.scheduleTask=function(task){if(task==null){throw new RuntimeException("Cannot schedule null or undefined task");}
var taskId=components.table.Scheduler.getNextTaskId();this.tasks[taskId]=task;if(this.timeout==null){this.timeout=setTimeout(stjs.bind(this,"runTasks"),this.delayMs);}
return taskId;};prototype.cancelTask=function(taskId){if(this.tasks[taskId]==null){throw new RuntimeException("Cannot cancel task "+taskId+". It doesn't exist");}
this.tasks.splice(taskId,1);if(this.tasks.length==0&&this.timeout!=null){clearTimeout(this.timeout);this.timeout=null;}
return true;};prototype.runTasks=function(){this.timeout=null;var lengthBefore;do{lengthBefore=this.tasks.length;this.tasks.forEach(stjs.bind(this,function(task,i,arr){this.runTask(task);delete this.tasks[i];}));}while(lengthBefore!=this.tasks.length);this.tasks=[];};prototype.runTask=function(task){try{task();}catch(e){components.table.Scheduler.LOG.error("An error occurred while running a scheduled task",task,e);}};constructor.getNextTaskId=function(){var id=components.table.Scheduler.NEXT_TASK_ID;components.table.Scheduler.NEXT_TASK_ID++;return id;};},{LOG:"squp.util.Logger",timeout:"TimeoutHandler",tasks:{name:"Array",arguments:["Callback0"]}},{});stjs.ns("components.table");components.table.AbstractCellFormatter=function(next){this.next=next;};components.table.AbstractCellFormatter=stjs.extend(components.table.AbstractCellFormatter,null,[components.table.CellFormatter],function(constructor,prototype){prototype.next=null;prototype.setNext=function(next){this.next=next;};prototype.getNext=function(){return this.next;};prototype.formatCell=function(cell,value,col){if(this.next!=null){this.next.formatCell(cell,value,col);}};},{next:"components.table.CellFormatter"},{});stjs.ns("components.table");components.table.RenderedSection=function(){};components.table.RenderedSection=stjs.extend(components.table.RenderedSection,null,[components.table.RenderedElement],function(constructor,prototype){prototype.appendRow=function(row){};prototype.insertRow=function(insertIndex,row){};prototype.getRow=function(rowIndex){};prototype.removeRow=function(rowIndex){};prototype.moveRow=function(sourceRow,destinationRow){};prototype.getRows=function(){};prototype.replaceRow=function(rowIndex,newRow){};prototype.getRowIndexAncestorOf=function(descendant){};prototype.empty=function(){};prototype.addClickListener=function(listener){};prototype.removeClickListener=function(listener){};prototype.getParent=function(){};},{},{});stjs.ns("components.table");components.table.RenderedTable=function(){};components.table.RenderedTable=stjs.extend(components.table.RenderedTable,null,[components.table.RenderedElement],function(constructor,prototype){prototype.appendHeadSection=function(head){};prototype.appendBodySection=function(body){};prototype.getHeadSection=function(){};prototype.getBodySection=function(){};},{},{});stjs.ns("components.table");components.table.RenderedCell=function(){};components.table.RenderedCell=stjs.extend(components.table.RenderedCell,null,[components.table.RenderedElement],function(constructor,prototype){prototype.isMergedCell=function(){};prototype.getColspan=function(){};prototype.setColspan=function(colspan){};prototype.getParent=function(){};},{},{});stjs.ns("components.table");components.table.RenderedRow=function(){};components.table.RenderedRow=stjs.extend(components.table.RenderedRow,null,[components.table.RenderedElement],function(constructor,prototype){prototype.appendCell=function(cell){};prototype.clearFormatting=function(){};prototype.getCells=function(){};prototype.getCell=function(colIndex){};prototype.indexOf=function(cell){};prototype.getCellIndexAncestorOf=function(descendant){};prototype.getParent=function(){};},{},{});stjs.ns("components.table");components.table.DefaultRenderedElement=function(element){this.element=element;this.children=[];this.parent=null;};components.table.DefaultRenderedElement=stjs.extend(components.table.DefaultRenderedElement,null,[components.table.RenderedElement],function(constructor,prototype){prototype.element=null;prototype.children=null;prototype.parent=null;prototype.getElement=function(){return this.element;};prototype.isVirtual=function(){return false;};prototype.getChildrenContainerElement=function(){return this.getElement();};prototype.appendChild=function(elem){elem.setParent(this);if(!elem.isVirtual()){this.getChildrenContainerElement().appendChild(elem.getElement());}
this.children.push(elem);};prototype.insertChild=function(insertIndex,elem){elem.setParent(this);if(insertIndex==this.children.length){this.appendChild(elem);return;}
if(!elem.isVirtual()){var reference=this.getInsertBeforeReferenceNode(insertIndex);this.getChildrenContainerElement().insertBefore(elem.getElement(),reference);}
this.children.splice(insertIndex,0,elem);};prototype.removeChild=function(index){var elem=this.children[index];elem.setParent(null);if(!elem.isVirtual()){$(elem.getElement()).remove();}
this.children.splice(index,1);};prototype.moveChild=function(fromIndex,toIndex){var fromElem=this.getChild(fromIndex);if(!fromElem.isVirtual()){var domReferenceIndex=toIndex;if(fromIndex<toIndex){domReferenceIndex++;}
var reference=this.getInsertBeforeReferenceNode(domReferenceIndex);this.getChildrenContainerElement().insertBefore(fromElem.getElement(),reference);}
var element=this.children[fromIndex];this.children.splice(fromIndex,1);this.children.splice(toIndex,0,element);};prototype.replaceChild=function(index,newChild){var oldChild=this.getChild(index);oldChild.setParent(null);newChild.setParent(this);if(newChild.isVirtual()){if(!oldChild.isVirtual()){$(oldChild.getElement()).remove();}}else{if(oldChild.isVirtual()){var reference=this.getInsertBeforeReferenceNode(index);this.getChildrenContainerElement().insertBefore(newChild.getElement(),reference);}else{$(oldChild.getElement()).replaceWith(newChild.getElement());}}
this.children[index]=newChild;};prototype.getChild=function(index){return this.children[index];};prototype.getInsertBeforeReferenceNode=function(logicalIndex){if(logicalIndex>=this.children.length){return null;}
var logicalElem=this.getChild(logicalIndex);if(!logicalElem.isVirtual()){return logicalElem.getElement();}
return this.getInsertBeforeReferenceNode(logicalIndex+1);};prototype.getChildren=function(){return this.children;};prototype.empty=function(){$(this.getChildrenContainerElement()).empty();this.children.forEach(function(c){return c.setParent(null);});this.children.length=0;};prototype.getChildIndexAncestorOf=function(descendant){if(this.isVirtual()){return-1;}
var container=this.getChildrenContainerElement();var childElement=descendant;while(childElement!=null&&childElement.parentNode!=container){childElement=childElement.parentNode;}
if(childElement==null){return-1;}
for(var i=0;i<this.children.length;i++){var child=this.getChild(i);if(child.getElement()==childElement){return i;}}
return-1;};prototype.getHeightPixels=function(){return $(this.getElement()).height();};prototype.getWidthPixels=function(){return $(this.getElement()).width();};prototype.clearFormatting=function(){this.getElement().setAttribute("class","");$(this.getElement()).empty();};prototype.getParent=function(){return this.parent;};prototype.setParent=function(parent){this.parent=parent;};},{element:"Element",children:{name:"Array",arguments:["components.table.RenderedElement"]},parent:"components.table.RenderedElement"},{});stjs.ns("components.table");components.table.MappedParallelList=function(identityProvider){this.items={};this.identityProvider=identityProvider;this.leftSide=new components.table.MappedParallelList.Side(this);this.rightSide=new components.table.MappedParallelList.Side(this);};components.table.MappedParallelList=stjs.extend(components.table.MappedParallelList,null,[components.table.ParallelList],function(constructor,prototype){prototype.items=null;prototype.identityProvider=null;prototype.leftSide=null;prototype.rightSide=null;prototype.append=function(value){var key=this.putValue(value);this.leftSide.appendKey(key);this.rightSide.appendKey(key);};prototype.appendAll=function(values){var keys=values.map(stjs.bind(this,function(val,i,arr){return this.putValue(val);}));this.leftSide.appendAllKeys(keys);this.rightSide.appendAllKeys(keys);};prototype.left=function(){return this.leftSide;};prototype.right=function(){return this.rightSide;};prototype.replace=function(oldValue,newValue){var oldKey=this.keyFor(oldValue);var newKey=this.keyFor(newValue);if(oldKey!=newKey){this.leftSide.replaceKey(oldKey,newKey);this.rightSide.replaceKey(oldKey,newKey);delete this.items[oldKey];}
this.items[newKey]=newValue;};prototype.keyFor=function(value){return this.identityProvider(value);};prototype.putValue=function(value){var key=this.keyFor(value);this.items[key]=value;return key;};prototype.putAllValues=function(values){return values.map(stjs.bind(this,function(val,i,arr){return this.putValue(val);}));};prototype.getByKey=function(key){return this.items[key];};prototype.removeByKey=function(key){var removed=this.items[key];delete this.items[key];return removed;};prototype.oppositeSideOf=function(side){if(side==this.leftSide){return this.rightSide;}
return this.leftSide;};constructor.Side=function(parent){this.list=new components.table.BidiUniqueList(function(k){return k;});this.parent=parent;};constructor.Side=stjs.extend(constructor.Side,null,[components.table.ParallelList.Side],function(constructor,prototype){prototype.parent=null;prototype.list=null;prototype.appendKey=function(key){this.list.append(key);};prototype.appendAllKeys=function(keys){this.list.appendAll(keys);};prototype.size=function(){return this.list.size();};prototype.indexOf=function(value){var key=this.parent.keyFor(value);return this.list.indexOf(key);};prototype.get=function(index){var key=this.list.get(index);return this.parent.getByKey(key);};prototype.insert=function(newValue,index){var key=this.parent.putValue(newValue);this.list.insert(key,index);};prototype.insertAfter=function(newValue,reference){var key=this.parent.putValue(newValue);var referenceKey=this.parent.keyFor(reference);return this.list.insertAfter(key,referenceKey);};prototype.insertAllAfter=function(insertedRows,reference){var keys=this.parent.putAllValues(insertedRows);var referenceKey=this.parent.keyFor(reference);return this.list.insertAllAfter(keys,referenceKey);};prototype.insertBefore=function(reference,newValue){var key=this.parent.putValue(newValue);var referenceKey=this.parent.keyFor(reference);return this.list.insertBefore(key,referenceKey);};prototype.insertAllBefore=function(insertedRows,reference){var keys=this.parent.putAllValues(insertedRows);var referenceKey=this.parent.keyFor(reference);return this.list.insertAllBefore(keys,referenceKey);};prototype.insertAll=function(newValues,index){var keys=newValues.map(stjs.bind(this,function(value,i,arr){return this.parent.putValue(value);}));this.list.insertAll(keys,index);return keys;};prototype.remove=function(value){var key=this.parent.keyFor(value);var index=this.list.removeValue(key);if(index>=0&&!this.opposite().containsKey(key)){this.parent.removeByKey(key);}
return index;};prototype.removeRange=function(fromIndex,deleteCount){if(deleteCount==0){return[];}
var deletedKeys=this.list.removeRange(fromIndex,deleteCount);var deletedItems=deletedKeys.map(stjs.bind(this,function(key,i,arr){return this.parent.getByKey(key);}));deletedKeys.filter(stjs.bind(this,function(key,i,arr){return!this.opposite().containsKey(key);})).forEach(stjs.bind(this.parent,"removeByKey"));return deletedItems;};prototype.containsKey=function(key){return this.list.contains(key);};prototype.replaceKey=function(oldKey,newKey){var index=this.list.indexOf(oldKey);this.list.set(newKey,index);};prototype.opposite=function(){return this.parent.oppositeSideOf(this);};prototype.oppositeIndex=function(index){var key=this.list.get(index);return this.opposite().list.indexOf(key);};prototype.move=function(fromIndex,toIndex){this.list.move(fromIndex,toIndex);};prototype.moveAfter=function(move,reference){var key=this.parent.keyFor(move);var referenceKey=reference==null?null:this.parent.keyFor(reference);return this.list.moveAfter(key,referenceKey);};prototype.moveRange=function(fromIndex,toIndex,count){var movedKeys=this.list.moveRange(fromIndex,toIndex,count);return movedKeys.map(stjs.bind(this,function(key,i,arr){return this.parent.getByKey(key);}));};prototype.find=function(test){var index=this.findIndex(test);if(index<0){return null;}
return this.get(index);};prototype.findIndex=function(test){return this.list.findIndex(stjs.bind(this,function(key,i){return test(this.parent.getByKey(key),i);}));};prototype.findLast=function(test){var index=this.findLastIndex(test);if(index<0){return null;}
return this.get(index);};prototype.findLastIndex=function(test){return this.list.findIndexReverse(stjs.bind(this,function(key,i){return test(this.parent.getByKey(key),i);}));};prototype.filter=function(test){var result=[];this.list.forEach(stjs.bind(this,function(key,i,arr){var elem=this.parent.getByKey(key);if(test(elem,stjs.trunc(stjs.trunc(i)))){result.push(elem);}}));return result;};prototype.contains=function(row){var key=this.parent.keyFor(row);return this.list.contains(key);};},{parent:{name:"components.table.MappedParallelList",arguments:["T"]},list:{name:"components.table.BidiUniqueList",arguments:[null]}},{});},{items:{name:"Map",arguments:[null,"T"]},identityProvider:{name:"Function1",arguments:["Object",null]},leftSide:{name:"components.table.MappedParallelList.Side",arguments:["T"]},rightSide:{name:"components.table.MappedParallelList.Side",arguments:["T"]}},{});stjs.ns("components.table");components.table.AbstractRef=function(index){this.elementIndex=index;};components.table.AbstractRef=stjs.extend(components.table.AbstractRef,null,[components.table.Ref],function(constructor,prototype){prototype.elementIndex=0;prototype.toVirtual=function(){return this;};prototype.toReal=function(){return this;};prototype.toClient=function(){return this;};prototype.exists=function(){return this.elementIndex>=0;};prototype.index=function(){return this.elementIndex;};prototype.next=function(){return this.plus(1);};prototype.previous=function(){return this.minus(1);};prototype.minus=function(offset){return this.plus(-offset);};prototype.plus=function(offset){if(this.isInRange(this.elementIndex+offset)){return this.copyWithIndex(this.elementIndex+offset);}
return this.copyWithIndex(-1);};prototype.hasNext=function(){return this.isInRange(this.elementIndex+1);};prototype.hasPrevious=function(){return this.isInRange(this.elementIndex-1);};prototype.isInRange=function(index){return index>=0&&index<=this.getMaxIndex();};prototype.copyWithIndex=function(newIndex){};},{},{});stjs.ns("components.table");components.table.SizeChangeMonitor=function(section,onSizeChanged){this.onSizeChanged=onSizeChanged;this.section=section;this.lastNotifiedWidth=section.getWidthPixels();this.lastNotifiedHeight=section.getHeightPixels();};components.table.SizeChangeMonitor=stjs.extend(components.table.SizeChangeMonitor,null,[],function(constructor,prototype){prototype.section=null;prototype.onSizeChanged=null;prototype.lastNotifiedWidth=-1;prototype.lastNotifiedHeight=-1;prototype.timeoutHandle=null;prototype.scheduleSizeRecalculation=function(){if(this.timeoutHandle==null){this.timeoutHandle=setTimeout(stjs.bind(this,function(){this.timeoutHandle=null;this.recalculateSize();}),0);}};prototype.recalculateSize=function(){var newWidth=this.section.getWidthPixels();var newHeight=this.section.getHeightPixels();if(newWidth!=this.lastNotifiedWidth||newHeight!=this.lastNotifiedHeight){this.onSizeChanged(new components.table.ComponentResizedEvent(this.section,this.section.getElement(),this.lastNotifiedWidth,this.lastNotifiedHeight,newWidth,newHeight));this.lastNotifiedWidth=newWidth;this.lastNotifiedHeight=newHeight;}};},{section:"components.table.RenderedElement",onSizeChanged:{name:"Callback1",arguments:["Object"]},timeoutHandle:"TimeoutHandler"},{});stjs.ns("components.table");components.table.VirtualColumn=function(){};components.table.VirtualColumn=stjs.extend(components.table.VirtualColumn,null,[components.table.VirtualModelObject],function(constructor,prototype){prototype.getColumn=function(){};},{},{});stjs.ns("components.table");components.table.VirtualRow=function(){};components.table.VirtualRow=stjs.extend(components.table.VirtualRow,null,[components.table.VirtualModelObject],function(constructor,prototype){prototype.getValue=function(columnId){};prototype.getRowData=function(){};},{},{});stjs.ns("components.table");components.table.TableExtensionList=function(extensions,anchorIndex){if(extensions!=null){this.extensions=[].concat(extensions);}else{this.extensions=[];}
this.extensions.forEach(stjs.bind(this,function(ext,i,arr){return this.verifyExtensionValid(ext,i);}));this.anchorIndex=anchorIndex;this.reversedIsDirty=true;};components.table.TableExtensionList=stjs.extend(components.table.TableExtensionList,null,[],function(constructor,prototype){prototype.anchorIndex=0;prototype.extensions=null;prototype.reversedExtensions=null;prototype.reversedIsDirty=false;prototype.verifyExtensionValid=function(ext,index){if(ext==null){throw new RuntimeException("The extension at index "+index+" is null");}};prototype.unshift=function(extension){this.verifyExtensionValid(extension,0);this.reversedIsDirty=true;return this.extensions.unshift(extension);};prototype.push=function(extension){this.verifyExtensionValid(extension,this.extensions.length);this.reversedIsDirty=true;return this.extensions.push(extension);};prototype.forwardChain=function(){return new components.table.DefaultTableExtensionChain(this.extensions,this.anchorIndex+1);};prototype.backwardChain=function(){if(this.reversedIsDirty){this.reversedExtensions=this.extensions.slice(0).reverse();this.reversedIsDirty=false;}
return new components.table.DefaultTableExtensionChain(this.reversedExtensions,this.extensions.length-this.anchorIndex);};prototype.anchoredAtNext=function(){return this.anchoredAt(this.anchorIndex+1);};prototype.anchoredAtEnd=function(){return this.anchoredAt(this.extensions.length);};prototype.anchoredAt=function(startIndex){var list=new components.table.TableExtensionList(this.extensions,startIndex);list.reversedExtensions=this.reversedExtensions;list.reversedIsDirty=this.reversedIsDirty;return list;};},{extensions:{name:"Array",arguments:["components.table.TableExtension"]},reversedExtensions:{name:"Array",arguments:["components.table.TableExtension"]}},{});stjs.ns("components.table");components.table.VirtualTableColumnModel=function(){};components.table.VirtualTableColumnModel=stjs.extend(components.table.VirtualTableColumnModel,null,[components.table.TableColumnModel,components.table.VirtualModel],null,{},{});stjs.ns("components.table");components.table.VirtualTableModel=function(){};components.table.VirtualTableModel=stjs.extend(components.table.VirtualTableModel,null,[components.table.TableModel,components.table.VirtualModel],null,{},{});stjs.ns("components.table");components.table.AbstractTableModel=function(){components.table.AbstractModel.call(this);};components.table.AbstractTableModel=stjs.extend(components.table.AbstractTableModel,components.table.AbstractModel,[components.table.TableModel],null,{LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.AbstractTableColumnModel=function(){components.table.AbstractModel.call(this);this.columnPropertyChangeListener=stjs.bind(this,"onColumnPropertyChanged");};components.table.AbstractTableColumnModel=stjs.extend(components.table.AbstractTableColumnModel,components.table.AbstractModel,[components.table.TableColumnModel],function(constructor,prototype){prototype.columnPropertyChangeListener=null;prototype.onColumnPropertyChanged=function(evt){var col=evt.getColumn();var index=this.getColumnIndex(col.getModelIdentifier());if(index<0){throw new RuntimeException("Could not find column "+col.getModelIdentifier()+" for event "+evt);}
this.fireEvent(this.newEvent().withElementPropertiesUpdated([evt.getProperty()],index,1).get());};prototype.startListeningToColumn=function(column){column.addListener(this.columnPropertyChangeListener);};prototype.stopListeningToColumn=function(column){column.removeListener(this.columnPropertyChangeListener);};},{columnPropertyChangeListener:{name:"Callback1",arguments:["components.table.TableColumnEvent"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.DefaultCellFormatter=function(next){components.table.AbstractCellFormatter.call(this,next);};components.table.DefaultCellFormatter=stjs.extend(components.table.DefaultCellFormatter,components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){if(cell==null){components.table.AbstractCellFormatter.prototype.formatCell.call(this,null,value,col);return;}
if(cell.childNodes.length==0){if(value!=null){cell.appendChild(components.table.Dom.text(value.toString()));}else{cell.appendChild(components.table.Dom.text(components.table.Dom.nbsp));}}
components.table.Dom.addClass(cell,col.getCssClass());components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);};},{next:"components.table.CellFormatter"},{});stjs.ns("components.table");components.table.DefaultHeaderCellFormatter=function(next){components.table.AbstractCellFormatter.call(this,next);};components.table.DefaultHeaderCellFormatter=stjs.extend(components.table.DefaultHeaderCellFormatter,components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){if(cell==null){components.table.AbstractCellFormatter.prototype.formatCell.call(this,null,value,col);return;}
if(col.getHeaderColspan()>1){cell.setAttribute("colspan",""+col.getHeaderColspan());}
components.table.Dom.addClass(cell,col.getHeaderCssClass());if(col.getHeaderTitle().length>0){cell.setAttribute("title",col.getHeaderTitle());}
cell.appendChild(components.table.Dom.text(col.getName()));components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);};},{next:"components.table.CellFormatter"},{});stjs.ns("components.table");components.table.MergedCell=function(){};components.table.MergedCell=stjs.extend(components.table.MergedCell,null,[components.table.RenderedCell],function(constructor,prototype){prototype.parent=null;prototype.clearFormatting=function(){};prototype.isMergedCell=function(){return true;};prototype.getColspan=function(){return 0;};prototype.setColspan=function(colspan){};prototype.getElement=function(){return null;};prototype.isVirtual=function(){return true;};prototype.getWidthPixels=function(){return-1;};prototype.getHeightPixels=function(){return-1;};prototype.getParent=function(){return this.parent;};prototype.setParent=function(parent){if(stjs.isInstanceOf(parent.constructor,components.table.RenderedRow)){this.parent=parent;}else{throw new RuntimeException("The parent of this merged cell may only be a RenderedRow.");}};},{parent:"components.table.RenderedRow"},{});stjs.ns("components.table");components.table.DefaultRenderedSection=function(element){components.table.DefaultRenderedElement.call(this,element);this.clickListeners=[];setTimeout(stjs.bind(this,function(){var that=this;$(this.getChildrenContainerElement()).click(stjs.bind(this,function(event,THIS){return that.onClick(event);},1));}),0);};components.table.DefaultRenderedSection=stjs.extend(components.table.DefaultRenderedSection,components.table.DefaultRenderedElement,[components.table.RenderedSection],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("DefaultRenderedSection");prototype.clickListeners=null;prototype.appendRow=function(row){this.appendChild(row);};prototype.insertRow=function(insertIndex,row){this.insertChild(insertIndex,row);};prototype.getRow=function(index){return this.getChild(index);};prototype.removeRow=function(rowIndex){this.removeChild(rowIndex);};prototype.moveRow=function(sourceRow,destinationRow){this.moveChild(sourceRow,destinationRow);};prototype.getRows=function(){return this.getChildren();};prototype.replaceRow=function(rowIndex,newRow){this.replaceChild(rowIndex,newRow);};prototype.getRowIndexAncestorOf=function(descendant){return this.getChildIndexAncestorOf(descendant);};prototype.addClickListener=function(listener){if(this.clickListeners.indexOf(listener)<0){this.clickListeners.push(listener);return true;}
return false;};prototype.removeClickListener=function(listener){var index=this.clickListeners.indexOf(listener);if(index>=0){this.clickListeners.splice(index,1);return true;}
return false;};prototype.empty=function(){components.table.DefaultRenderedElement.prototype.empty.call(this);};prototype.onClick=function(event){var rowIndex=this.getRowIndexAncestorOf(event.target);if(rowIndex<0){return true;}
var colIndex=this.getRow(rowIndex).getCellIndexAncestorOf(event.target);if(colIndex<0){return true;}
this.fireSectionClicked(new components.table.SectionClickedEvent(rowIndex,colIndex,event));return true;};prototype.fireSectionClicked=function(event){this.clickListeners.forEach(function(listener){try{listener(event);}catch(e){components.table.DefaultRenderedSection.LOG.error("Failed while handling a click on a table section",e);}});};prototype.getParent=function(){return components.table.DefaultRenderedElement.prototype.getParent.call(this);};},{LOG:"squp.util.Logger",clickListeners:{name:"Array",arguments:[{name:"Callback1",arguments:["components.table.SectionClickedEvent"]}]},element:"Element",children:{name:"Array",arguments:["components.table.RenderedElement"]},parent:"components.table.RenderedElement"},{});stjs.ns("components.table");components.table.DefaultRenderedCell=function(element){components.table.DefaultRenderedElement.call(this,element);};components.table.DefaultRenderedCell=stjs.extend(components.table.DefaultRenderedCell,components.table.DefaultRenderedElement,[components.table.RenderedCell],function(constructor,prototype){prototype.isMergedCell=function(){return false;};prototype.getColspan=function(){return(this.getElement()).colSpan;};prototype.setColspan=function(colspan){(this.getElement()).colSpan=colspan;};prototype.getParent=function(){return components.table.DefaultRenderedElement.prototype.getParent.call(this);};},{element:"Element",children:{name:"Array",arguments:["components.table.RenderedElement"]},parent:"components.table.RenderedElement"},{});stjs.ns("components.table");components.table.DefaultRenderedTable=function(element){components.table.DefaultRenderedElement.call(this,element);};components.table.DefaultRenderedTable=stjs.extend(components.table.DefaultRenderedTable,components.table.DefaultRenderedElement,[components.table.RenderedTable],function(constructor,prototype){prototype.head=null;prototype.body=null;prototype.appendHeadSection=function(head){if(this.head!=null){throw new RuntimeException("Head is already present");}
this.head=head;this.appendChild(head);};prototype.appendBodySection=function(body){if(this.body!=null){throw new RuntimeException("Body is already present");}
this.body=body;this.appendChild(body);};prototype.getHeadSection=function(){return this.head;};prototype.getBodySection=function(){return this.body;};},{head:"components.table.RenderedSection",body:"components.table.RenderedSection",element:"Element",children:{name:"Array",arguments:["components.table.RenderedElement"]},parent:"components.table.RenderedElement"},{});stjs.ns("components.table");components.table.DefaultRenderedRow=function(element){components.table.DefaultRenderedElement.call(this,element);};components.table.DefaultRenderedRow=stjs.extend(components.table.DefaultRenderedRow,components.table.DefaultRenderedElement,[components.table.RenderedRow],function(constructor,prototype){prototype.appendCell=function(cell){this.appendChild(cell);};prototype.clearFormatting=function(){this.getElement().setAttribute("class","");};prototype.getCells=function(){return this.getChildren();};prototype.getCell=function(colIndex){return this.getChild(colIndex);};prototype.indexOf=function(cell){return this.getChildren().indexOf(cell);};prototype.getCellIndexAncestorOf=function(descendant){return this.getChildIndexAncestorOf(descendant);};prototype.getParent=function(){return components.table.DefaultRenderedElement.prototype.getParent.call(this);};},{element:"Element",children:{name:"Array",arguments:["components.table.RenderedElement"]},parent:"components.table.RenderedElement"},{});stjs.ns("components.table");components.table.AbstractVirtualModel=function(realModel){components.table.AbstractModel.call(this);this.realModel=realModel;this.elems=new components.table.MappedParallelList(stjs.bind("getId"));this.init();};components.table.AbstractVirtualModel=stjs.extend(components.table.AbstractVirtualModel,components.table.AbstractModel,[components.table.VirtualModel],function(constructor,prototype){prototype.lastElementId=0;prototype.realModel=null;prototype.elems=null;prototype.init=function(){var realElementCount=this.getModelElementCount(this.realModel);for(var rowIndex=0;rowIndex<realElementCount;rowIndex++){this.elements().append(this.newRealElement(this.nextElementId()));}};prototype.getModelElementCount=function(model){if(stjs.isInstanceOf(model.constructor,components.table.TableModel)){return(model).getRowCount();}else if(stjs.isInstanceOf(model.constructor,components.table.TableColumnModel)){return(model).getColumnCount();}
throw new RuntimeException("Unsupported model type");};prototype.newRealElement=function(id){};prototype.getRealModel=function(){return this.realModel;};prototype.getClientModel=function(){if(stjs.isInstanceOf(this.realModel.constructor,components.table.VirtualModel)){var parent=this.realModel;return parent.getClientModel();}
return this.realModel;};prototype.applyEvent=function(underlyingEvent,listener){var converted=this.newEvent();var thatModel=this;var that=this;underlyingEvent.visit(new(stjs.extend(function AbstractVirtualModel$1(){},null,[components.table.ModelEvent.Visitor],function(constructor,prototype){prototype.visitInsert=function(step,model){if(listener!=null){listener.beforeApplyInsert(step,thatModel);}
that.applyRealElementsInsertedEvent(converted,step);if(listener!=null){listener.afterApplyInsert(step,thatModel);}};prototype.visitDelete=function(step,model){if(listener!=null){listener.beforeApplyDelete(step,thatModel);}
that.applyRealElementsDeletedEvent(converted,step);if(listener!=null){listener.afterApplyDelete(step,thatModel);}};prototype.visitMove=function(step,model){if(listener!=null){listener.beforeApplyMove(step,thatModel);}
that.applyRealElementsMovedEvent(converted,step);if(listener!=null){listener.afterApplyMove(step,thatModel);}};prototype.visitUpdate=function(step,model){if(listener!=null){listener.beforeApplyUpdate(step,thatModel);}
that.applyRealElementPropertiesUpdatedEvent(converted,step);if(listener!=null){listener.afterApplyUpdate(step,thatModel);}};},{},{}))());return converted.get();};prototype.applyRealElementsDeletedEvent=function(builder,realStep){var deleted=this.elements().left().removeRange(realStep.getDeleteIndex(),realStep.getElementCount());deleted.forEach(stjs.bind(this,function(row){var deletedVirtualIndex=this.elements().right().remove(row);if(deletedVirtualIndex>=0){builder.withElementsDeleted(deletedVirtualIndex,[row]);}}));};prototype.applyRealElementsInsertedEvent=function(builder,realStep){var insertedRows=[];for(var i=0;i<realStep.getElementCount();i++){var row=this.newRealElement(this.nextElementId());insertedRows.push(row);}
this.elements().left().insertAll(insertedRows,realStep.getInsertIndex());var reference=this.elements().left().findLast(stjs.bind(this,function(row,i){return i<realStep.getInsertIndex()&&this.elements().right().contains(row);}));var virtualInsertIndex;if(reference==null){virtualInsertIndex=0;this.elements().right().insertAll(insertedRows,0);}else{virtualInsertIndex=this.elements().right().insertAllAfter(insertedRows,reference);}
builder.withElementsInserted(virtualInsertIndex,realStep.getElementCount());};prototype.applyRealElementsMovedEvent=function(builder,realStep){var movedRows=this.elements().left().moveRange(realStep.getSourceIndex(),realStep.getDestinationIndex(),realStep.getElementCount());var visibleMovedRows=movedRows.filter(stjs.bind(this,function(row,i,arr){return this.elements().right().contains(row);}));if(visibleMovedRows.length==0){return;}
var reference=this.elements().left().findLast(stjs.bind(this,function(row,i){return i<realStep.getDestinationIndex()&&this.elements().right().contains(row);}));for(var i=visibleMovedRows.length-1;i>=0;i--){var toMove=visibleMovedRows[i];var fromIndex=this.elements().right().indexOf(toMove);var toIndex;if(reference!=null){toIndex=this.elements().right().moveAfter(toMove,reference);}else{toIndex=0;this.elements().right().move(fromIndex,0);}
if(fromIndex!=toIndex){builder.withElementsMoved(toIndex,fromIndex,1);}}};prototype.applyRealElementPropertiesUpdatedEvent=function(builder,realStep){for(var i=0;i<realStep.getElementCount();i++){var row=this.elements().left().get(realStep.getUpdateIndex()+i);var virtualIndex=this.elements().right().indexOf(row);if(virtualIndex>=0){builder.withElementPropertiesUpdated(realStep.getPropertyIds(),virtualIndex,1);}}};prototype.deleteVirtualElement=function(virtualRowIndex){this.deleteVirtualElementRange(virtualRowIndex,1);};prototype.deleteVirtualElementRange=function(fromVirtualIndex,deleteCount){var deletedRows=this.elements().right().removeRange(fromVirtualIndex,deleteCount);if(deleteCount>0){this.fireEvent(this.newEvent().withElementsDeleted(fromVirtualIndex,deletedRows).get());}
return deletedRows;};prototype.insertVirtualElement=function(row,virtualInsertIndex){this.elements().right().insert(row,virtualInsertIndex);this.fireEvent(this.newEvent().withElementsInserted(virtualInsertIndex,1).get());};prototype.insertAllVirtualElements=function(insertRows,virtualInsertIndex){this.elements().right().insertAll(insertRows,virtualInsertIndex);if(insertRows.length>0){this.fireEvent(this.newEvent().withElementsInserted(virtualInsertIndex,insertRows.length).get());}};prototype.moveVirtualElement=function(fromVirtualIndex,toVirtualIndex){this.moveVirtualElementRange(fromVirtualIndex,toVirtualIndex,1);};prototype.moveVirtualElementRange=function(fromVirtualIndex,toVirtualIndex,count){this.elements().right().moveRange(fromVirtualIndex,toVirtualIndex,count);this.fireEvent(this.newEvent().withElementsMoved(toVirtualIndex,fromVirtualIndex,count).get());};prototype.elements=function(){return this.elems;};prototype.realRef=function(realIndex){return new components.table.AbstractVirtualModel.RealRef(realIndex,this);};prototype.virtualRef=function(virtualIndex){return new components.table.AbstractVirtualModel.VirtualRef(virtualIndex,this);};prototype.clientRef=function(clientIndex){return new components.table.AbstractVirtualModel.ClientRef(clientIndex,this);};prototype.refFor=function(element){var index=this.elements().right().indexOf(element);if(index>=0){return this.virtualRef(index);}
index=this.elements().left().indexOf(element);if(index>=0){return this.realRef(index);}
return this.virtualRef(-1);};prototype.nextElementId=function(){this.lastElementId++;var result="";var charset="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var rest=this.lastElementId;do{var index=rest%charset.length;rest=stjs.trunc(rest/charset.length);result+=charset.charAt(index);}while(rest>0);return result;};constructor.AbstractModelRef=function(index,model){components.table.AbstractRef.call(this,index);if(index<-1){throw new RuntimeException("Illegal index, "+index+" < 0");}
this.model=model;var maxIndex=this.getMaxIndex();if(index>maxIndex){throw new RuntimeException("Illegal index, "+index+" > "+maxIndex);}};constructor.AbstractModelRef=stjs.extend(constructor.AbstractModelRef,components.table.AbstractRef,[],function(constructor,prototype){prototype.model=null;},{model:{name:"components.table.VirtualModel",arguments:["MODEL","ELEMENT"]}},{});constructor.VirtualRef=function(index,model){components.table.AbstractVirtualModel.AbstractModelRef.call(this,index,model);};constructor.VirtualRef=stjs.extend(constructor.VirtualRef,components.table.AbstractVirtualModel.AbstractModelRef,[],function(constructor,prototype){prototype.toReal=function(){if(this.exists()){return new components.table.AbstractVirtualModel.RealRef(this.model.elements().right().oppositeIndex(this.elementIndex),this.model);}
return new components.table.AbstractVirtualModel.RealRef(-1,this.model);};prototype.toClient=function(){if(this.exists()){return this.toReal().toClient();}
return new components.table.AbstractVirtualModel.ClientRef(-1,this.model);};prototype.get=function(){return this.model.elements().right().get(this.elementIndex);};prototype.getMaxIndex=function(){return this.model.elements().right().size()-1;};prototype.copyWithIndex=function(newIndex){return new components.table.AbstractVirtualModel.VirtualRef(newIndex,this.model);};},{model:{name:"components.table.VirtualModel",arguments:["MODEL","ELEMENT"]}},{});constructor.RealRef=function(realIndex,model){components.table.AbstractVirtualModel.AbstractModelRef.call(this,realIndex,model);};constructor.RealRef=stjs.extend(constructor.RealRef,components.table.AbstractVirtualModel.AbstractModelRef,[],function(constructor,prototype){prototype.toVirtual=function(){if(this.exists()){return new components.table.AbstractVirtualModel.VirtualRef(this.model.elements().left().oppositeIndex(this.elementIndex),this.model);}
return new components.table.AbstractVirtualModel.VirtualRef(-1,this.model);};prototype.toClient=function(){if(this.exists()){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var clientIndex=(this.model.getRealModel()).virtualRef(this.elementIndex).toClient().index();return new components.table.AbstractVirtualModel.ClientRef(clientIndex,this.model);}
return new components.table.AbstractVirtualModel.ClientRef(this.elementIndex,this.model);}
return new components.table.AbstractVirtualModel.ClientRef(-1,this.model);};prototype.get=function(){return this.model.elements().left().get(this.elementIndex);};prototype.getMaxIndex=function(){return this.model.elements().left().size()-1;};prototype.copyWithIndex=function(newIndex){return new components.table.AbstractVirtualModel.RealRef(newIndex,this.model);};},{model:{name:"components.table.VirtualModel",arguments:["MODEL","ELEMENT"]}},{});constructor.ClientRef=function(index,model){components.table.AbstractVirtualModel.AbstractModelRef.call(this,index,model);};constructor.ClientRef=stjs.extend(constructor.ClientRef,components.table.AbstractVirtualModel.AbstractModelRef,[],function(constructor,prototype){prototype.toVirtual=function(){if(this.exists()){return this.toReal().toVirtual();}
return new components.table.AbstractVirtualModel.VirtualRef(-1,this.model);};prototype.toReal=function(){if(this.exists()){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var realIndex=(this.model.getRealModel()).clientRef(this.elementIndex).toVirtual().index();return new components.table.AbstractVirtualModel.RealRef(realIndex,this.model);}
return new components.table.AbstractVirtualModel.RealRef(this.elementIndex,this.model);}
return new components.table.AbstractVirtualModel.RealRef(-1,this.model);};prototype.get=function(){return this.toReal().get();};prototype.getMaxIndex=function(){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var parentModel=this.model.getRealModel();var parentClientIndex=parentModel.clientRef(this.elementIndex);return parentClientIndex.getMaxIndex();}
return this.model.elements().left().size()-1;};prototype.copyWithIndex=function(newIndex){return new components.table.AbstractVirtualModel.ClientRef(newIndex,this.model);};},{model:{name:"components.table.VirtualModel",arguments:["MODEL","ELEMENT"]}},{});},{elems:{name:"components.table.ParallelList",arguments:["ELEMENT"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.DirectRef=function(index,model){components.table.AbstractRef.call(this,index);this.model=model;};components.table.DirectRef=stjs.extend(components.table.DirectRef,components.table.AbstractRef,[],function(constructor,prototype){prototype.model=null;constructor.Direct=function(index,model){components.table.DirectRef.call(this,index,model);};constructor.Direct=stjs.extend(constructor.Direct,components.table.DirectRef,[],function(constructor,prototype){prototype.toClient=function(){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var clientIndex=(this.model.getRealModel()).virtualRef(this.elementIndex).toClient().index();return new components.table.DirectRef.Client(clientIndex,this.model);}
return this;};prototype.getMaxIndex=function(){return this.model.getElementCount()-1;};prototype.copyWithIndex=function(newIndex){return new components.table.DirectRef.Direct(newIndex,this.model);};prototype.get=function(){return this.model.getModelObject(this.elementIndex);};},{model:{name:"components.table.DirectModel",arguments:["MODEL","ELEMENT"]}},{});constructor.Client=function(index,model){components.table.DirectRef.call(this,index,model);};constructor.Client=stjs.extend(constructor.Client,components.table.DirectRef,[],function(constructor,prototype){prototype.toVirtual=function(){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var parentVirtualIndex=(this.model.getRealModel()).clientRef(this.elementIndex).toVirtual().index();return new components.table.DirectRef.Direct(parentVirtualIndex,this.model);}
return this;};prototype.toReal=function(){return this.toVirtual();};prototype.getMaxIndex=function(){if(stjs.isInstanceOf(this.model.getRealModel().constructor,components.table.VirtualModel)){var parentTableModel=this.model.getRealModel();var parentClientIndex=parentTableModel.clientRef(this.elementIndex);return parentClientIndex.getMaxIndex();}
return this.model.getElementCount()-1;};prototype.copyWithIndex=function(newIndex){return new components.table.DirectRef.Client(newIndex,this.model);};prototype.get=function(){return this.toVirtual().get();};},{model:{name:"components.table.DirectModel",arguments:["MODEL","ELEMENT"]}},{});},{model:{name:"components.table.DirectModel",arguments:["MODEL","ELEMENT"]}},{});stjs.ns("components.table");components.table.ObjectRowTableModel=function(){components.table.AbstractTableModel.call(this);this.rowData=[];};components.table.ObjectRowTableModel=stjs.extend(components.table.ObjectRowTableModel,components.table.AbstractTableModel,[],function(constructor,prototype){prototype.rowData=null;prototype.appendRow=function(row){this.insertRow(this.getRowCount(),row);};prototype.insertRow=function(pos,row){this.rowData.splice(pos,0,row);this.fireEvent(this.newEvent().withElementsInserted(pos,1).get());};prototype.insertRows=function(pos,rows){if(rows.length>0){this.rowData=this.rowData.slice(0,pos).concat(rows,this.rowData.slice(pos));this.fireEvent(this.newEvent().withElementsInserted(pos,rows.length).get());}};prototype.moveRow=function(modelIndex,targetPosition){if(modelIndex!=targetPosition){var row=this.rowData.splice(modelIndex,1)[0];this.rowData.splice(targetPosition,0,row);var event=this.newEvent().withElementsMoved(targetPosition,modelIndex,1).get();this.fireEvent(event);}};prototype.updateRow=function(pos,value){if(!this.rowData[pos].equals(value)){this.rowData[pos]=value;this.fireEvent(this.newEvent().withElementsUpdated(pos,1).get());}};prototype.deleteRows=function(pos,amount){if(amount>0){var deleted=this.rowData.splice(pos,amount);this.fireEvent(this.newEvent().withElementsDeleted(pos,deleted).get());}};prototype.clear=function(){if(this.rowData.length>0){var e=this.newEvent().withElementsDeleted(0,this.rowData).get();this.rowData=[];this.fireEvent(e);}};prototype.getRowCount=function(){return this.rowData.length;};prototype.getRowData=function(rowIndex){return this.rowData[rowIndex];};},{rowData:{name:"Array",arguments:["T"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.MatrixTableModel=function(){components.table.AbstractTableModel.call(this);this.cells=[];this.columnIdentifiers=[];};components.table.MatrixTableModel=stjs.extend(components.table.MatrixTableModel,components.table.AbstractTableModel,[],function(constructor,prototype){prototype.cells=null;prototype.columnCount=0;prototype.columnIdentifiers=null;prototype.setValue=function(row,col,value){var oldRowCount=this.cells.length;var rowVals=this.cells[row];if(rowVals==null){rowVals=[];this.cells[row]=rowVals;}
var oldValue=rowVals[col];rowVals[col]=value;var oldColumnCount=this.columnCount;this.columnCount=stjs.trunc(Math.max(this.columnCount,col+1));if(oldColumnCount<this.columnCount){for(var i=oldColumnCount;i<this.columnCount;i++){this.columnIdentifiers.push(i.toString());}}
var ev=null;if(oldRowCount!=this.cells.length){ev=this.newEvent().withElementsInserted(row,1).get();}else if(oldValue!=value){ev=this.newEvent().withElementPropertiesUpdated([col.toString()],row,1).get();}
if(ev!=null){this.fireEvent(ev);}};prototype.deleteRow=function(row){var rowData=this.cells.splice(row,1);this.fireEvent(this.newEvent().withElementsDeleted(row,rowData).get());};prototype.getRowCount=function(){return this.cells.length;};prototype.getRowData=function(rowIndex){return this.cells[rowIndex];};prototype.getValueAt=function(row,col){var rowVals=this.cells[row];if(rowVals==null){return null;}
return rowVals[parseInt(col,10)];};},{cells:{name:"Array",arguments:[{name:"Array",arguments:["Object"]}]},columnIdentifiers:{name:"Array",arguments:[null]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.TableColumn=function(modelIdentifier,name){this.modelIdentifier=modelIdentifier;this.name=name;this.headerColspan=1;this.sortable=true;this.deletable=true;this.cssClass="";this.headerTitle="";this.headerCssClass="";this.formatter=new components.table.DefaultCellFormatter(null);this.headerFormatter=new components.table.DefaultHeaderCellFormatter(null);this.comparator=null;this.listeners=[];this.extensionProperties={};};components.table.TableColumn=stjs.extend(components.table.TableColumn,null,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("TableColumn");constructor.NULLABLE=true;constructor.NOT_NULL=false;prototype.modelIdentifier=null;prototype.name=null;prototype.headerColspan=0;prototype.deletable=false;prototype.sortable=false;prototype.cssClass=null;prototype.headerTitle=null;prototype.headerCssClass=null;prototype.formatter=null;prototype.headerFormatter=null;prototype.comparator=null;prototype.extensionProperties=null;prototype.listeners=null;constructor.anonColumn=function(modelIdentifier){return new components.table.TableColumn(modelIdentifier,"");};constructor.column=function(modelIdentifier,name){return new components.table.TableColumn(modelIdentifier,name);};prototype.alignCenter=function(){this.cssClass+=" center";this.headerCssClass+=" center";return this;};prototype.alignRight=function(){this.cssClass+=" right";this.headerCssClass+=" right";return this;};prototype.withHeaderTitle=function(headerTitle){this.headerTitle=headerTitle;return this;};prototype.alignLeft=function(){this.cssClass+=" left";this.headerCssClass+=" left";return this;};prototype.bold=function(){this.cssClass+=" bold";return this;};prototype.immutable=function(){this.sortable=false;this.deletable=false;return this;};prototype.undeletable=function(){this.deletable=false;return this;};prototype.withClass=function(aCssClass){this.cssClass+=" "+aCssClass;this.headerCssClass+=" "+aCssClass;return this;};prototype.withSortable=function(sortable){this.sortable=sortable;return this;};prototype.formattedAs=function(aFormatter){aFormatter.setNext(this.formatter);this.formatter=aFormatter;return this;};prototype.headerFormattedAs=function(aHeaderFormatter){aHeaderFormatter.setNext(this.headerFormatter);this.headerFormatter=aHeaderFormatter;return this;};prototype.spans=function(colspan){this.headerColspan=colspan;return this;};prototype.sortedWith=function(aComparator){this.comparator=aComparator;return this;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.updateProperty(this,"name",this.name,name,components.table.TableColumn.NOT_NULL);};prototype.getHeaderColspan=function(){return this.headerColspan;};prototype.setHeaderColspan=function(headerColspan){this.updateProperty(this,"headerColspan",this.headerColspan,headerColspan,components.table.TableColumn.NOT_NULL);};prototype.withHeaderColspan=function(headerColspan){this.headerColspan=headerColspan;return this;};prototype.isSortable=function(){return this.sortable;};prototype.setSortable=function(sortable){this.updateProperty(this,"sortable",this.sortable,sortable,components.table.TableColumn.NOT_NULL);};prototype.getCssClass=function(){return this.cssClass;};prototype.setCssClass=function(cssClass){this.updateProperty(this,"cssClass",this.cssClass,cssClass,components.table.TableColumn.NOT_NULL);};prototype.getHeaderCssClass=function(){return this.headerCssClass;};prototype.getHeaderTitle=function(){return this.headerTitle;};prototype.setHeaderCssClass=function(headerCssClass){this.updateProperty(this,"headerCssClass",this.headerCssClass,headerCssClass,components.table.TableColumn.NOT_NULL);};prototype.withHeaderCssClass=function(headerCssClass){this.headerCssClass=headerCssClass;return this;};prototype.getFormatter=function(){return this.formatter;};prototype.getHeaderFormatter=function(){return this.headerFormatter;};prototype.getComparator=function(){return this.comparator;};prototype.setComparator=function(comparator){this.updateProperty(this,"comparator",this.comparator,comparator,components.table.TableColumn.NULLABLE);};prototype.getModelIdentifier=function(){return this.modelIdentifier;};prototype.isDeletable=function(){return this.deletable;};prototype.setDeletable=function(deletable){this.updateProperty(this,"deletable",this.deletable,deletable,components.table.TableColumn.NOT_NULL);};prototype.withExtensionProperty=function(name,value){this.extensionProperties[name]=value;return this;};prototype.setExtensionProperty=function(name,value){this.updateProperty(this.extensionProperties,name,this.getExtensionProperty(name),value,components.table.TableColumn.NULLABLE);};prototype.getExtensionProperty=function(name){return this.extensionProperties[name];};prototype.addListener=function(listener){if(this.listeners.indexOf(listener)<0){this.listeners.push(listener);return true;}
return false;};prototype.removeListener=function(listener){var index=this.listeners.indexOf(listener);if(index>=0){this.listeners.splice(index,1);return true;}
return false;};prototype.updateProperty=function(target,property,oldValue,newValue,nullable){if(!nullable&&newValue==null){throw new RuntimeException("Property "+property+" may not be null or undefined");}
if(oldValue==newValue){return false;}
(target)[property]=newValue;this.fireEvent(property,target!=this,oldValue,newValue);return true;};prototype.fireEvent=function(property,isExtensionProperty,oldValue,newValue){var evt=new components.table.TableColumnEvent(this,property,isExtensionProperty,oldValue,newValue);this.listeners.forEach(function(l){try{l(evt);}catch(e){components.table.TableColumn.LOG.error("An error occurred while handling a TableColumnEvent: ",e);}});};},{LOG:"squp.util.Logger",formatter:"components.table.CellFormatter",headerFormatter:"components.table.CellFormatter",comparator:{name:"SortFunction",arguments:["Object"]},extensionProperties:{name:"Map",arguments:[null,"Object"]},listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.SectionManager=function(debugRepainting,dispatcher,domClickListener){this.debugRepainting=debugRepainting;this.domClickListener=domClickListener;this.dispatcher=dispatcher;};components.table.SectionManager=stjs.extend(components.table.SectionManager,null,[],function(constructor,prototype){prototype.debugRepainting=false;prototype.dispatcher=null;prototype.domClickListener=null;prototype.sizeMonitor=null;prototype.section=null;prototype.destroy=function(){if(this.section!=null){this.section.removeClickListener(this.domClickListener);}};prototype.scheduleSizeRecalculation=function(){if(this.sizeMonitor!=null){this.sizeMonitor.scheduleSizeRecalculation();}};prototype.dispatchRenderAndFormatSection=function(table){this.section=this.dispatcher.dispatchRenderSection();if(this.section!=null){this.dispatcher.appendSectionToTable(table,this.section);this.dispatcher.dispatchFormatSection(this.section);}};prototype.doEmpty=function(){if(this.section!=null){this.section.empty();}};prototype.doInitSection=function(section,rowCount){this.section=section;if(section!=null){this.doRenderSectionContent(rowCount);section.addClickListener(this.domClickListener);this.sizeMonitor=new components.table.SizeChangeMonitor(section,stjs.bind(this.dispatcher,"dispatchSizeChanged"));}};prototype.doRenderSectionContent=function(rowCount){for(var rowIndex=0;rowIndex<rowCount;rowIndex++){var row=this.dispatcher.dispatchRenderRow(rowIndex);this.section.appendRow(row);this.dispatcher.dispatchFormatRow(rowIndex,row);}};prototype.doRenderRowContent=function(row,rowIndex,columnCount){if(row==null){throw new RuntimeException("A row that was present in the final TableModel was not rendered. All rows that exist in the final TableModel MUST be rendered.");}
var remainingColspan=1;for(var colIndex=0;colIndex<columnCount;colIndex++){remainingColspan--;if(remainingColspan>0){row.appendCell(new components.table.MergedCell());}else{var rendered=this.dispatcher.dispatchRenderCell(rowIndex,colIndex);row.appendCell(rendered);this.dispatcher.dispatchFormatCell(rowIndex,colIndex,rendered);remainingColspan=rendered.getColspan();}}};prototype.doInsertRows=function(rowCount,insertRow,totalRowCount){var rowIndex={};for(var i=0;i<rowCount;i++){rowIndex.value=insertRow+i;var child=this.dispatcher.dispatchRenderRow(rowIndex.value);this.section.insertRow(rowIndex.value,child);this.dispatcher.dispatchFormatRow(rowIndex.value,child);this.addDebuggingHighlight(child,"inserted");}
var reformatStart=insertRow+rowCount;this.doReformatRows(reformatStart,totalRowCount-reformatStart);};prototype.doDeleteRows=function(firstRow,rowCount,totalRowCount){for(var i=firstRow;i<firstRow+rowCount;i++){this.section.removeRow(firstRow);}
this.doReformatRows(firstRow,totalRowCount-firstRow);};prototype.doUpdateRows=function(firstRow,rowCount,columnIndices,totalColumnCount){var manyCellsAreDirty=columnIndices.length==0||columnIndices.length>10&&columnIndices.length>stjs.trunc(totalColumnCount/3);var lastRow=firstRow+rowCount-1;var rowIndex={};var existingRow={};for(var i=firstRow;i<=lastRow;i++){rowIndex.value=i;if(manyCellsAreDirty){var newRow=this.dispatcher.dispatchRenderRow(rowIndex.value);this.section.replaceRow(rowIndex.value,newRow);this.dispatcher.dispatchFormatRow(rowIndex.value,newRow);this.addDebuggingHighlight(newRow,"replaced");}else{existingRow.value=this.section.getRow(rowIndex.value);columnIndices.forEach(stjs.bind(this,function(colIndex){var cell=existingRow.value.getCell(colIndex);cell.clearFormatting();this.dispatcher.dispatchFormatCell(rowIndex.value,colIndex,cell);this.addDebuggingHighlight(cell,"repainted");}));}}};prototype.doMoveRows=function(firstRow,rowCount,destinationRow,totalRowCount){var sourceRow=firstRow;var lastRow=firstRow+rowCount-1;if(firstRow>destinationRow){sourceRow=lastRow;}
var count=lastRow-firstRow+1;for(var i=0;i<count;i++){this.section.moveRow(sourceRow,destinationRow);this.addDebuggingHighlight(this.section.getRow(destinationRow),"moved");}
var reformatStart=stjs.trunc(Math.min(firstRow,destinationRow));this.doReformatRows(reformatStart,totalRowCount-reformatStart);};prototype.doReformatSection=function(){this.section.clearFormatting();this.dispatcher.dispatchFormatSection(this.section);};prototype.doReformatRows=function(firstRow,rowCount){for(var i=0;i<rowCount;i++){var rowIndex=firstRow+i;var row=this.section.getRow(rowIndex);if(row.isVirtual()){continue;}
var saved=this.saveDebuggingHighlights(row);row.clearFormatting();this.dispatcher.dispatchFormatRow(rowIndex,row);this.restoreDebuggingHighlights(row,saved);this.addDebuggingHighlight(row,"reformatted");}};prototype.addDebuggingHighlight=function(elem,event){if(this.debugRepainting&&!elem.isVirtual()){var cssClass="u-debugrepaint-"+event;components.table.Dom.addClass(elem.getElement(),cssClass);setTimeout(function(){return components.table.Dom.removeClass(elem.getElement(),cssClass);},1000);}};prototype.restoreDebuggingHighlights=function(row,saved){if(this.debugRepainting&&!row.isVirtual()){saved.forEach(function(cl){return components.table.Dom.addClass(row.getElement(),cl);});}};prototype.saveDebuggingHighlights=function(row){if(this.debugRepainting&&!row.isVirtual()){var cssClass=row.getElement().getAttribute("class");if(cssClass==null||cssClass.length==0){return[];}
return(cssClass).split(" ").filter(function(cl,i,arr){return cl.startsWith("u-debugrepaint-");});}
return[];};prototype.doReformatCells=function(firstRow,rowCount,columnIndices){for(var i=0;i<rowCount;i++){var rowIndex=firstRow+i;var row=this.section.getRow(rowIndex);for(var j=0;j<columnIndices.length;j++){var columnIndex=columnIndices[j];var cell=row.getCell(columnIndex);if(cell.isVirtual()){continue;}
var saved=this.saveDebuggingHighlights(cell);cell.clearFormatting();this.dispatcher.dispatchFormatCell(rowIndex,columnIndex,cell);this.restoreDebuggingHighlights(cell,saved);this.addDebuggingHighlight(cell,"reformatted");}}};},{dispatcher:"components.table.SectionDispatcher",domClickListener:{name:"Callback1",arguments:["components.table.SectionClickedEvent"]},sizeMonitor:"components.table.SizeChangeMonitor",section:"components.table.RenderedSection"},{});stjs.ns("components.table");components.table.FirstTableExtension=function(tableSizeChangedListener){components.table.AbstractTableExtension.call(this);this.headerClickListeners=[];this.cellClickListeners=[];this.clientColumnModelListener=stjs.bind(this,"onColumnModelEvent");this.clientTableModelListener=stjs.bind(this,"onTableModelUpdated");this.tableSizeChangedListener=tableSizeChangedListener;};components.table.FirstTableExtension=stjs.extend(components.table.FirstTableExtension,components.table.AbstractTableExtension,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("FirstTableExtension");prototype.headerClickListeners=null;prototype.cellClickListeners=null;prototype.clientTableModelListener=null;prototype.clientColumnModelListener=null;prototype.tableSizeChangedListener=null;prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){components.table.AbstractTableExtension.prototype.init.call(this,dataModel,columnModel,options,attributes,extensions,chain);this.getTableModel().addListener(this.clientTableModelListener);this.getColumnModel().addListener(this.clientColumnModelListener);};prototype.destroy=function(chain){this.getTableModel().removeListener(this.clientTableModelListener);this.getColumnModel().removeListener(this.clientColumnModelListener);components.table.AbstractTableExtension.prototype.destroy.call(this,chain);};prototype.onColumnModelEvent=function(event){this.forwardChain().handleTableColumnModelEvent(event);};prototype.onTableModelUpdated=function(event){this.forwardChain().handleTableModelEvent(event);};prototype.handleBodySectionSizeChanged=function(event,chain){this.tableSizeChangedListener();};prototype.handleHeadSectionSizeChanged=function(event,chain){this.tableSizeChangedListener();};prototype.renderTable=function(chain){var table=components.table.Dom.elem("table");return new components.table.DefaultRenderedTable(table);};prototype.handleTableCellClicked=function(event,chain){this.fireEvent(this.cellClickListeners,event);};prototype.handleTableHeaderClicked=function(event,chain){this.fireEvent(this.headerClickListeners,event);};prototype.fireEvent=function(listeners,event){listeners.forEach(function(listener){try{listener(event);}catch(e){components.table.FirstTableExtension.LOG.error("Error thrown when handling a click event",e);}});};prototype.formatTable=function(table,chain){if(this.getOptions().id!=null){table.getElement().setAttribute("id",this.getOptions().id);}
if(this.getOptions().cssClass!=null){table.getElement().setAttribute("class",this.getOptions().cssClass);}
table.getElement().setAttribute("cellSpacing","0");};prototype.renderHeadSection=function(chain){return new components.table.DefaultRenderedSection(components.table.Dom.elem("thead"));};prototype.formatHeadSection=function(head,chain){};prototype.renderHeadRow=function(chain){return new components.table.DefaultRenderedRow(components.table.Dom.elem("tr"));};prototype.formatHeadRow=function(row,chain){};prototype.renderHeadCell=function(columnIndex,chain){return new components.table.DefaultRenderedCell(components.table.Dom.elem("th"));};prototype.formatHeadCell=function(columnIndex,cell,chain){var column=this.getColumnModel().getColumn(columnIndex);column.getHeaderFormatter().formatCell(cell.getElement(),null,column);};prototype.renderBodySection=function(chain){return new components.table.DefaultRenderedSection(components.table.Dom.elem("tbody"));};prototype.formatBodySection=function(body,chain){};prototype.renderBodyRow=function(rowIndex,chain){return new components.table.DefaultRenderedRow(components.table.Dom.elem("tr"));};prototype.formatBodyRow=function(rowIndex,row,chain){};prototype.renderBodyCell=function(rowIndex,columnIndex,chain){return new components.table.DefaultRenderedCell(components.table.Dom.elem("td"));};prototype.formatBodyCell=function(rowIndex,columnIndex,cell,chain){var column=this.getColumnModel().getColumn(columnIndex);var value=this.getTableModel().getValueAt(rowIndex,column.getModelIdentifier());column.getFormatter().formatCell(cell.getElement(),value,column);};prototype.addHeaderClickListener=function(listener){this.headerClickListeners.push(listener);};prototype.addCellClickListener=function(listener){this.cellClickListeners.push(listener);};},{LOG:"squp.util.Logger",headerClickListeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]},cellClickListeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]},clientTableModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableModel"]}]},clientColumnModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableColumnModel"]}]},tableSizeChangedListener:"Callback0",tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes"},{});stjs.ns("components.table");components.table.DefaultVirtualTableColumnModel=function(realModel){components.table.AbstractVirtualModel.call(this,realModel);};components.table.DefaultVirtualTableColumnModel=stjs.extend(components.table.DefaultVirtualTableColumnModel,components.table.AbstractVirtualModel,[components.table.VirtualTableColumnModel],function(constructor,prototype){prototype.newRealElement=function(id){return new components.table.DefaultVirtualTableColumnModel.RealColumn(this,id);};prototype.getColumn=function(columnIndex){return this.elements().right().get(columnIndex).getColumn();};prototype.getColumnByIdentifier=function(modelIdentifier){var virt=this.elements().right().find(function(v,i){return v.getColumn().getModelIdentifier()==modelIdentifier;});if(virt==null){return null;}
return virt.getColumn();};prototype.getColumnIndex=function(modelIdentifier){return this.elements().right().findIndex(function(v,i){return v.getColumn().getModelIdentifier()==modelIdentifier;});};prototype.getColumnCount=function(){return this.elements().right().size();};prototype.getColumnIndices=function(modelIdentifiers){return modelIdentifiers.map(stjs.bind(this,function(id,i,arr){return this.getColumnIndex(id);}));};constructor.RealColumn=function(model,id){this.model=model;this.id=id;};constructor.RealColumn=stjs.extend(constructor.RealColumn,null,[components.table.VirtualColumn],function(constructor,prototype){prototype.model=null;prototype.id=null;prototype.getColumn=function(){return this.model.getRealModel().getColumn(this.getRealColumnIndex());};prototype.getId=function(){return this.id;};prototype.getRealColumnIndex=function(){return this.model.elements().left().indexOf(this);};},{model:"components.table.DefaultVirtualTableColumnModel"},{});},{elems:{name:"components.table.ParallelList",arguments:["ELEMENT"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.DefaultVirtualTableModel=function(realModel){components.table.AbstractVirtualModel.call(this,realModel);};components.table.DefaultVirtualTableModel=stjs.extend(components.table.DefaultVirtualTableModel,components.table.AbstractVirtualModel,[components.table.VirtualTableModel],function(constructor,prototype){prototype.newRealElement=function(id){return new components.table.DefaultVirtualTableModel.RealRow(this,id);};prototype.getRowCount=function(){return this.elements().right().size();};prototype.getRowData=function(virtualRowIndex){var row=this.elements().right().get(virtualRowIndex);return row.getRowData();};prototype.getValueAt=function(virtualRowIndex,columnIdentifier){var row=this.elements().right().get(virtualRowIndex);return row.getValue(columnIdentifier);};constructor.RealRow=function(model,id){this.model=model;this.id=id;};constructor.RealRow=stjs.extend(constructor.RealRow,null,[components.table.VirtualRow],function(constructor,prototype){prototype.model=null;prototype.id=null;prototype.getValue=function(columnId){return this.model.getRealModel().getValueAt(this.getRealRowIndex(),columnId);};prototype.getRowData=function(){return this.model.getRealModel().getRowData(this.getRealRowIndex());};prototype.getId=function(){return this.id;};prototype.getRealRowIndex=function(){return this.model.elements().left().indexOf(this);};},{model:"components.table.DefaultVirtualTableModel"},{});},{elems:{name:"components.table.ParallelList",arguments:["ELEMENT"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.DirectTableColumnModel=function(realModel){components.table.AbstractTableColumnModel.call(this);this.realModel=realModel;};components.table.DirectTableColumnModel=stjs.extend(components.table.DirectTableColumnModel,components.table.AbstractTableColumnModel,[components.table.VirtualTableColumnModel,components.table.DirectModel],function(constructor,prototype){prototype.realModel=null;prototype.getColumn=function(columnIndex){return this.getRealModel().getColumn(columnIndex);};prototype.getColumnByIdentifier=function(modelIdentifier){return this.getRealModel().getColumnByIdentifier(modelIdentifier);};prototype.getColumnCount=function(){return this.getRealModel().getColumnCount();};prototype.getColumnIndex=function(modelIdentifier){return this.getRealModel().getColumnIndex(modelIdentifier);};prototype.getColumnIndices=function(modelIdentifiers){return this.getRealModel().getColumnIndices(modelIdentifiers);};prototype.getRealModel=function(){return this.realModel;};prototype.getClientModel=function(){if(stjs.isInstanceOf(this.realModel.constructor,components.table.VirtualTableColumnModel)){return(this.realModel).getClientModel();}
return this.realModel;};prototype.applyEvent=function(underlyingEvent,listener){return this.newEvent().withStepsFrom(underlyingEvent).get();};prototype.elements=function(){return new components.table.DirectParallelList(this);};prototype.realRef=function(realIndex){return new components.table.DirectRef.Direct(realIndex,this);};prototype.virtualRef=function(virtualIndex){return new components.table.DirectRef.Direct(virtualIndex,this);};prototype.clientRef=function(clientIndex){return new components.table.DirectRef.Client(clientIndex,this);};prototype.refFor=function(virtualCol){var index=this.elements().left().indexOf(virtualCol);return this.realRef(index);};prototype.getElementCount=function(){return this.getColumnCount();};prototype.getModelObject=function(index){return new components.table.DirectTableColumnModel.DirectColumn(this,index);};constructor.DirectColumn=function(columnModel,index){this.columnModel=columnModel;this.index=index;};constructor.DirectColumn=stjs.extend(constructor.DirectColumn,null,[components.table.VirtualColumn],function(constructor,prototype){prototype.columnModel=null;prototype.index=0;prototype.getColumn=function(){return this.columnModel.getColumn(this.index);};prototype.getId=function(){return"id";};},{columnModel:"components.table.DirectTableColumnModel"},{});},{realModel:"components.table.TableColumnModel",columnPropertyChangeListener:{name:"Callback1",arguments:["components.table.TableColumnEvent"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.DirectTableModel=function(realModel){components.table.AbstractTableModel.call(this);this.realModel=realModel;};components.table.DirectTableModel=stjs.extend(components.table.DirectTableModel,components.table.AbstractTableModel,[components.table.VirtualTableModel,components.table.DirectModel],function(constructor,prototype){prototype.realModel=null;prototype.getRowCount=function(){return this.getRealModel().getRowCount();};prototype.getRowData=function(rowIndex){return this.getRealModel().getRowData(rowIndex);};prototype.getValueAt=function(rowIndex,columnIdentifier){return this.getRealModel().getValueAt(rowIndex,columnIdentifier);};prototype.applyEvent=function(underlyingEvent,listener){return this.newEvent().withStepsFrom(underlyingEvent).get();};prototype.elements=function(){return new components.table.DirectParallelList(this);};prototype.getRealModel=function(){return this.realModel;};prototype.getClientModel=function(){if(stjs.isInstanceOf(this.realModel.constructor,components.table.VirtualTableModel)){return(this.realModel).getClientModel();}
return this.realModel;};prototype.realRef=function(realIndex){return new components.table.DirectRef.Direct(realIndex,this);};prototype.virtualRef=function(virtualIndex){return new components.table.DirectRef.Direct(virtualIndex,this);};prototype.clientRef=function(clientIndex){return new components.table.DirectRef.Client(clientIndex,this);};prototype.refFor=function(virtualRow){var index=this.elements().left().indexOf(virtualRow);return this.realRef(index);};prototype.getElementCount=function(){return this.realModel.getRowCount();};prototype.getModelObject=function(index){return new components.table.DirectTableModel.DirectRow(this,index);};constructor.DirectRow=function(tableModel,index){this.tableModel=tableModel;this.index=index;};constructor.DirectRow=stjs.extend(constructor.DirectRow,null,[components.table.VirtualRow],function(constructor,prototype){prototype.tableModel=null;prototype.index=0;prototype.getValue=function(columnId){return this.tableModel.getValueAt(this.index,columnId);};prototype.getRowData=function(){return this.tableModel.getRowData(this.index);};prototype.getId=function(){return"id";};},{tableModel:"components.table.DirectTableModel"},{});},{realModel:"components.table.TableModel",LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.PropertyTableModel=function(rows){components.table.ObjectRowTableModel.call(this);if(rows!=null&&rows.length>0){this.insertRows(0,rows);}};components.table.PropertyTableModel=stjs.extend(components.table.PropertyTableModel,components.table.ObjectRowTableModel,[],function(constructor,prototype){prototype.getValueAt=function(rowIndex,columnIdentifier){return(this.getRowData(rowIndex))[columnIdentifier];};prototype.notifyRowDataUpdated=function(rowIndex,properties){this.fireEvent(this.newEvent().withElementPropertiesUpdated(properties,rowIndex,1).get());};},{rowData:{name:"Array",arguments:["T"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.ProvidersTableModel=function(providers){components.table.ObjectRowTableModel.call(this);this.providers=providers;};components.table.ProvidersTableModel=stjs.extend(components.table.ProvidersTableModel,components.table.ObjectRowTableModel,[],function(constructor,prototype){prototype.providers=null;prototype.getDataProvider=function(columnId){return this.providers[columnId];};prototype.getValueAt=function(row,columnId){var rowData=this.getRowData(row);return this.getDataProvider(columnId)(rowData);};prototype.updateRow=function(pos,newRowData){var oldRowData=this.getRowData(pos);var changedColIds=[];for(var colId in this.providers){if(!this.valueEqualityCompare(colId,oldRowData,newRowData)){changedColIds.push(colId);}}
this.rowData[pos]=newRowData;if(changedColIds.length>0){this.fireEvent(this.newEvent().withElementPropertiesUpdated(changedColIds,pos,1).get());}};prototype.valueEqualityCompare=function(colId,oldRowData,newRowData){var provider=this.providers[colId];return provider(oldRowData)==provider(newRowData);};constructor.constantProvider=function(normalResult){return function(data){return normalResult;};};constructor.propertyProvider=function(_arguments){var propertyNames=[];for(var i=0;i<arguments.length;++i){propertyNames.push(arguments[i]);}
return function(data){var bean=(data);for(var p in propertyNames){if(!(propertyNames).hasOwnProperty(p))
continue;if(bean==null){return null;}
bean=(bean[propertyNames[p]]);}
return bean;};};},{providers:{name:"Map",arguments:[null,{name:"Function1",arguments:["T","Object"]}]},rowData:{name:"Array",arguments:["T"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.SimpleTableColumnModel=function(columns){components.table.AbstractTableColumnModel.call(this);this.columns=new components.table.BidiUniqueList(stjs.bind("getModelIdentifier"));if(columns!=null){this.insertColumns(columns,0);}};components.table.SimpleTableColumnModel=stjs.extend(components.table.SimpleTableColumnModel,components.table.AbstractTableColumnModel,[],function(constructor,prototype){prototype.columns=null;prototype.getColumn=function(columnIndex){return this.columns.get(columnIndex);};prototype.getColumnByIdentifier=function(modelIdentifier){return this.columns.getByKey(modelIdentifier);};prototype.getColumnIndex=function(modelIdentifier){return this.columns.indexOfKey(modelIdentifier);};prototype.getColumnIndices=function(modelIdentifiers){return modelIdentifiers.map(stjs.bind(this,function(id,i,arr){return this.columns.indexOfKey(id);}));};prototype.getColumnCount=function(){return this.columns.size();};prototype.moveColumn=function(columnIndex,newIndex){if(columnIndex!=newIndex){this.columns.move(columnIndex,newIndex);this.fireEvent(this.newEvent().withElementsMoved(newIndex,columnIndex,1).get());}};prototype.appendColumn=function(column){this.insertColumn(column,this.getColumnCount());};prototype.insertColumn=function(column,colPosition){this.columns.insert(column,colPosition);this.startListeningToColumn(column);this.fireEvent(this.newEvent().withElementsInserted(colPosition,1).get());};prototype.insertColumns=function(columns,colPosition){columns.forEach(stjs.bind(this,"startListeningToColumn"));this.columns.insertAll(columns,colPosition);this.fireEvent(this.newEvent().withElementsInserted(colPosition,columns.length).get());};prototype.deleteColumn=function(column){return this.deleteColumnWithIdentifier(column.getModelIdentifier());};prototype.deleteColumnWithIdentifier=function(identifier){var index=this.columns.indexOfKey(identifier);if(index>=0){return this.deleteColumnAt(index);}
return false;};prototype.deleteColumnAt=function(index){var column=this.columns.removeIndex(index);this.stopListeningToColumn(column);this.fireEvent(this.newEvent().withElementsDeleted(index,[column]).get());return true;};prototype.deleteColumns=function(index,columnCount){var deleted=this.columns.removeRange(index,columnCount);deleted.forEach(stjs.bind(this,"stopListeningToColumn"));this.fireEvent(this.newEvent().withElementsDeleted(index,deleted).get());return true;};},{columns:{name:"components.table.BidiUniqueList",arguments:["components.table.TableColumn"]},columnPropertyChangeListener:{name:"Callback1",arguments:["components.table.TableColumnEvent"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.LastTableExtension=function(){components.table.AbstractTableExtension.call(this);};components.table.LastTableExtension=stjs.extend(components.table.LastTableExtension,components.table.AbstractTableExtension,[],function(constructor,prototype){prototype.bodySection=null;prototype.headSection=null;prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){components.table.AbstractTableExtension.prototype.init.call(this,dataModel,columnModel,options,attributes,extensions,chain);var debugRepainting=false;if(options.debugRepainting!=null){debugRepainting=options.debugRepainting;}else{if(window.location.search!=null&&window.location.search.contains("table.debugRepainting=true")){debugRepainting=true;}}
this.headSection=new components.table.SectionManager(debugRepainting,new components.table.SectionDispatcher.Head(extensions),stjs.bind(this,"onHeadSectionClicked"));this.bodySection=new components.table.SectionManager(debugRepainting,new components.table.SectionDispatcher.Body(extensions),stjs.bind(this,"onBodySectionClicked"));};prototype.destroy=function(chain){this.headSection.destroy();this.bodySection.destroy();components.table.AbstractTableExtension.prototype.destroy.call(this,chain);};prototype.handleTableModelEvent=function(event,chain){if(this.bodySection==null){return;}
var that=this;event.visit(new(stjs.extend(function LastTableExtension$1(){},null,[components.table.ModelEvent.Visitor],function(constructor,prototype){prototype.visitInsert=function(step,model){that.bodySection.doInsertRows(step.getElementCount(),step.getInsertIndex(),model.getRowCount());};prototype.visitDelete=function(step,model){that.bodySection.doDeleteRows(step.getDeleteIndex(),step.getElementCount(),model.getRowCount());};prototype.visitMove=function(step,model){that.bodySection.doMoveRows(step.getSourceIndex(),step.getElementCount(),step.getDestinationIndex(),model.getRowCount());};prototype.visitUpdate=function(step,model){var dirtyColIndices;if(step.affectsAllProperties()){dirtyColIndices=[];}else{dirtyColIndices=step.getPropertyIds().map(function(colId,i,a){return that.getColumnModel().getColumnIndex(colId);}).filter(function(colIndex,i,a){return colIndex>=0;});if(dirtyColIndices.length==0){return;}}
that.bodySection.doUpdateRows(step.getUpdateIndex(),step.getElementCount(),dirtyColIndices,that.getColumnModel().getColumnCount());};},{},{}))());this.bodySection.scheduleSizeRecalculation();};prototype.handleTableColumnModelEvent=function(evt,chain){this.headSection.doEmpty();this.bodySection.doEmpty();this.headSection.doRenderSectionContent(1);this.bodySection.doRenderSectionContent(this.getTableModel().getRowCount());this.headSection.scheduleSizeRecalculation();this.bodySection.scheduleSizeRecalculation();};prototype.handleInvalidate=function(event,chain){var section;switch(event.getSection()){case components.table.InvalidateEvent.Section.BODY:section=this.bodySection;break;case components.table.InvalidateEvent.Section.HEAD:section=this.headSection;break;default:return;}
var that=this;event.visit(new(stjs.extend(function LastTableExtension$2(){},null,[components.table.InvalidateEvent.StepVisitor],function(constructor,prototype){prototype.visitRows=function(step,s){section.doReformatRows(step.getFirstRow(),step.getRowCount());};prototype.visitSection=function(step,s){section.doReformatSection();};prototype.visitCells=function(step,s){section.doReformatCells(step.getFirstRow(),step.getRowCount(),that.getColumnModel().getColumnIndices(step.getColumnIdentifiers()));};},{},{}))());section.scheduleSizeRecalculation();};prototype.handleInvalidateSizes=function(event,chain){if(event.isOnBody()){this.bodySection.scheduleSizeRecalculation();}
if(event.isOnHead()){this.headSection.scheduleSizeRecalculation();}};prototype.renderBodyRow=function(rowIndex,chain){var row=chain.renderBodyRow(rowIndex);this.bodySection.doRenderRowContent(row,rowIndex,this.getColumnModel().getColumnCount());return row;};prototype.renderBodySection=function(chain){var sect=chain.renderBodySection();this.bodySection.doInitSection(sect,this.getTableModel().getRowCount());return sect;};prototype.renderHeadRow=function(chain){var row=chain.renderHeadRow();this.headSection.doRenderRowContent(row,1,this.getColumnModel().getColumnCount());return row;};prototype.renderHeadSection=function(chain){var sect=chain.renderHeadSection();this.headSection.doInitSection(sect,1);return sect;};prototype.renderTable=function(chain){var table=chain.renderTable();if(table==null){throw new RuntimeException("The table root element is mandatory and must be rendered.");}
this.headSection.dispatchRenderAndFormatSection(table);this.bodySection.dispatchRenderAndFormatSection(table);return table;};prototype.formatBodySection=function(body,chain){if(!body.isVirtual()){components.table.Dom.addClass(body.getElement(),"Table__body");chain.formatBodySection(body);}};prototype.formatBodyRow=function(rowIndex,row,chain){if(!row.isVirtual()){components.table.Dom.addClass(row.getElement(),"Table__bodyRow");chain.formatBodyRow(rowIndex,row);}};prototype.formatBodyCell=function(rowIndex,columnIndex,cell,chain){if(!cell.isVirtual()){this.addCellCssClasses(columnIndex,cell,"Table__bodyCell");chain.formatBodyCell(rowIndex,columnIndex,cell);}};prototype.formatHeadSection=function(head,chain){if(!head.isVirtual()){components.table.Dom.addClass(head.getElement(),"Table__head");chain.formatHeadSection(head);}};prototype.formatHeadRow=function(row,chain){if(!row.isVirtual()){components.table.Dom.addClass(row.getElement(),"Table__headRow");chain.formatHeadRow(row);}};prototype.formatHeadCell=function(columnIndex,cell,chain){if(!cell.isVirtual()){this.addCellCssClasses(columnIndex,cell,"Table__headCell");chain.formatHeadCell(columnIndex,cell);}};prototype.addCellCssClasses=function(columnIndex,cell,cssClass){components.table.Dom.addClass(cell.getElement(),cssClass);if(columnIndex==0){components.table.Dom.addClass(cell.getElement(),cssClass+"--first");}else if(columnIndex==this.getColumnModel().getColumnCount()-1){components.table.Dom.addClass(cell.getElement(),cssClass+"--last");}};prototype.formatTable=function(table,chain){if(!table.isVirtual()){components.table.Dom.addClass(table.getElement(),"Table");chain.formatTable(table);}};prototype.onBodySectionClicked=function(event){var column=this.getColumnModel().getColumn(event.getColumnIndex());var cellValue=this.getTableModel().getValueAt(event.getRowIndex(),column.getModelIdentifier());var cellEvent=new components.table.TableCellClickedEvent(event.getRowIndex(),event.getColumnIndex(),column,cellValue,event.getEvent());this.backwardChain().handleTableCellClicked(cellEvent);};prototype.onHeadSectionClicked=function(event){var headerEvent=new components.table.TableHeaderClickedEvent(event.getColumnIndex(),this.getColumnModel().getColumn(event.getColumnIndex()),event.getEvent());this.backwardChain().handleTableHeaderClicked(headerEvent);};},{bodySection:"components.table.SectionManager",headSection:"components.table.SectionManager",tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes"},{});stjs.ns("components.table");components.table.VirtualTableExtension=function(){components.table.AbstractTableExtension.call(this);this.tableModelListener=stjs.bind(this,function(ev){return this.forwardChain().handleTableModelEvent(ev);});this.columnModelListener=stjs.bind(this,function(ev){return this.forwardChain().handleTableColumnModelEvent(ev);});};components.table.VirtualTableExtension=stjs.extend(components.table.VirtualTableExtension,components.table.AbstractTableExtension,[],function(constructor,prototype){prototype.columnModelListener=null;prototype.tableModelListener=null;prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){var wrappedTableModel=this.wrapTableModel(dataModel);var wrappedColumnModel=this.wrapColumnModel(columnModel);wrappedTableModel.addListener(this.tableModelListener);wrappedColumnModel.addListener(this.columnModelListener);components.table.AbstractTableExtension.prototype.init.call(this,wrappedTableModel,wrappedColumnModel,options,attributes,extensions,chain);};prototype.destroy=function(chain){chain.destroy();this.getColumnModel().removeListener(this.columnModelListener);this.getTableModel().removeListener(this.tableModelListener);};prototype.wrapTableModel=function(underlying){return new components.table.DirectTableModel(underlying);};prototype.wrapColumnModel=function(underlying){return new components.table.DirectTableColumnModel(underlying);};prototype.getTableModel=function(){return components.table.AbstractTableExtension.prototype.getTableModel.call(this);};prototype.getColumnModel=function(){return components.table.AbstractTableExtension.prototype.getColumnModel.call(this);};prototype.handleTableModelEvent=function(event,chain){chain.handleTableModelEvent(this.getTableModel().applyEvent(event,null));};prototype.handleTableColumnModelEvent=function(event,chain){chain.handleTableColumnModelEvent(this.getColumnModel().applyEvent(event,null));};prototype.renderBodyRow=function(rowIndex,chain){var rowRef=this.getTableModel().virtualRef(rowIndex);if(!rowRef.exists()){return chain.renderBodyRow(-1);}
var realRowRef=rowRef.toReal();if(realRowRef.exists()){return chain.renderBodyRow(realRowRef.index());}
return this.renderVirtualRow(rowRef,chain);};prototype.renderVirtualRow=function(rowRef,chain){return chain.renderBodyRow(-1);};prototype.formatBodyRow=function(rowIndex,row,chain){var rowRef=this.getTableModel().virtualRef(rowIndex);if(!rowRef.exists()){chain.formatBodyRow(-1,row);return;}
var realRowRef=rowRef.toReal();if(realRowRef.exists()){chain.formatBodyRow(realRowRef.index(),row);return;}
this.formatVirtualBodyRow(rowRef,row,chain);};prototype.formatVirtualBodyRow=function(rowRef,row,chain){};prototype.renderBodyCell=function(rowIndex,columnIndex,chain){var rowRef=this.getTableModel().virtualRef(rowIndex);var colRef=this.getColumnModel().virtualRef(columnIndex);var realRowRef=rowRef.toReal();var realColRef=colRef.toReal();if(!rowRef.exists()||!colRef.exists()){return chain.renderBodyCell(rowRef.toReal().index(),colRef.toReal().index());}
if(realRowRef.exists()&&realColRef.exists()){return chain.renderBodyCell(realRowRef.index(),realColRef.index());}
return this.renderVirtualBodyCell(rowRef,colRef,chain);};prototype.renderVirtualBodyCell=function(rowRef,colRef,chain){return chain.renderBodyCell(rowRef.toReal().index(),colRef.toReal().index());};prototype.formatBodyCell=function(rowIndex,columnIndex,cell,chain){var rowRef=this.getTableModel().virtualRef(rowIndex);var colRef=this.getColumnModel().virtualRef(columnIndex);if(!rowRef.exists()||!colRef.exists()){chain.formatBodyCell(rowRef.index(),colRef.index(),cell);return;}
var realRowRef=rowRef.toReal();var realColRef=colRef.toReal();if(realRowRef.exists()&&realColRef.exists()){chain.formatBodyCell(realRowRef.index(),realColRef.index(),cell);return;}
this.formatVirtualBodyCell(rowRef,colRef,cell,chain);};prototype.formatVirtualBodyCell=function(rowRef,colRef,cell,chain){var column=colRef.get().getColumn();var value=this.getTableModel().getValueAt(rowRef.index(),column.getModelIdentifier());column.getFormatter().formatCell(cell.getElement(),value,column);};prototype.formatHeadCell=function(columnIndex,cell,chain){var colRef=this.getColumnModel().virtualRef(columnIndex);if(!colRef.exists()){chain.formatHeadCell(-1,cell);return;}
var realColRef=colRef.toReal();if(realColRef.exists()){chain.formatHeadCell(realColRef.index(),cell);return;}
this.formatVirtualHeadCell(colRef,cell,chain);};prototype.formatVirtualHeadCell=function(colRef,cell,chain){chain.formatHeadCell(colRef.toReal().index(),cell);};prototype.handleTableCellClicked=function(event,chain){var realRowRef=this.getTableModel().virtualRef(event.getRowIndex()).toReal();var realColRef=this.getColumnModel().virtualRef(event.getColumnIndex()).toReal();if(realRowRef.exists()&&realColRef.exists()){chain.handleTableCellClicked(event.withIndices(realRowRef.index(),realColRef.index()));}};prototype.handleTableHeaderClicked=function(event,chain){var realColRef=this.getColumnModel().virtualRef(event.getColumnIndex()).toReal();if(realColRef.exists()){chain.handleTableHeaderClicked(event.withIndex(realColRef.index()));}};prototype.renderHeadCell=function(columnIndex,chain){var colRef=this.getColumnModel().virtualRef(columnIndex);if(!colRef.exists()){return chain.renderHeadCell(-1);}
var realColRef=colRef.toReal();if(realColRef.exists()){return chain.renderHeadCell(realColRef.index());}
return this.renderVirtualHeadCell(colRef,chain);};prototype.renderVirtualHeadCell=function(colRef,chain){return chain.renderHeadCell(-1);};},{columnModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableColumnModel"]}]},tableModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableModel"]}]},tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes"},{});stjs.ns("components.table");components.table.TableColumnModelWithFactorySupport=function(columns){components.table.SimpleTableColumnModel.call(this,columns);};components.table.TableColumnModelWithFactorySupport=stjs.extend(components.table.TableColumnModelWithFactorySupport,components.table.SimpleTableColumnModel,[],null,{columns:{name:"components.table.BidiUniqueList",arguments:["components.table.TableColumn"]},columnPropertyChangeListener:{name:"Callback1",arguments:["components.table.TableColumnEvent"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.PropertyTableColumnModel=function(properties){components.table.SimpleTableColumnModel.call(this,properties.map(function(prop,i,arr){return components.table.PropertyTableColumnModel.buildColumn(prop);}));};components.table.PropertyTableColumnModel=stjs.extend(components.table.PropertyTableColumnModel,components.table.SimpleTableColumnModel,[],function(constructor,prototype){constructor.buildColumn=function(prop){return components.table.TableColumn.column(prop,prop);};},{columns:{name:"components.table.BidiUniqueList",arguments:["components.table.TableColumn"]},columnPropertyChangeListener:{name:"Callback1",arguments:["components.table.TableColumnEvent"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.Table=function(model,columnModel,options){this.model=model;this.columnModel=columnModel;this.resizeListeners=[];if(options==null){options={};}
this.options=options;this.extensions=new components.table.TableExtensionList(options.extensions,-1);this.attributes=new components.table.TableAttributes();this.firstExtension=new components.table.FirstTableExtension(stjs.bind(this,"scheduleSizeRecalculation"));this.extensions.unshift(this.firstExtension);this.lastExtension=new components.table.LastTableExtension();this.extensions.push(this.lastExtension);this.forwardChain().init(model,columnModel,options,this.attributes,this.extensions);};components.table.Table=stjs.extend(components.table.Table,null,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("Table");prototype.model=null;prototype.columnModel=null;prototype.options=null;prototype.firstExtension=null;prototype.lastExtension=null;prototype.extensions=null;prototype.attributes=null;prototype.table=null;prototype.tableMonitor=null;prototype.resizeListeners=null;prototype.render=function(){this.table=this.backwardChain().renderTable();this.backwardChain().formatTable(this.table);this.tableMonitor=new components.table.SizeChangeMonitor(this.table,stjs.bind(this,"fireTableResized"));return this.table.getElement();};prototype.addHeaderClickListener=function(listener){this.firstExtension.addHeaderClickListener(listener);};prototype.addCellClickListener=function(listener){this.firstExtension.addCellClickListener(listener);};prototype.addResizeListener=function(listener){if(this.resizeListeners.indexOf(listener)<0){this.resizeListeners.push(listener);return true;}
return false;};prototype.destroy=function(){this.forwardChain().destroy();};prototype.invalidateSizes=function(){this.forwardChain().handleInvalidateSizes(new components.table.InvalidateSizesEvent(true,true));};prototype.getModel=function(){return this.model;};prototype.getColumnModel=function(){return this.columnModel;};prototype.getOptions=function(){return this.options;};prototype.fireTableResized=function(event){this.resizeListeners.forEach(function(listener){try{listener(event);}catch(e){components.table.Table.LOG.error("An error occurred while handling a Table resized event",e);}});};prototype.scheduleSizeRecalculation=function(){if(this.tableMonitor!=null){this.tableMonitor.scheduleSizeRecalculation();}};prototype.forwardChain=function(){return this.extensions.forwardChain();};prototype.backwardChain=function(){return this.extensions.anchoredAtEnd().backwardChain();};},{LOG:"squp.util.Logger",model:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",firstExtension:"components.table.FirstTableExtension",lastExtension:"components.table.LastTableExtension",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes",table:"components.table.RenderedTable",tableMonitor:"components.table.SizeChangeMonitor",resizeListeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});
stjs.ns("components.table");components.table.RowExpander=function(){};components.table.RowExpander=stjs.extend(components.table.RowExpander,null,[],function(constructor,prototype){prototype.onAdded=function(mediator){};prototype.formatRow=function(row,rowValue){};prototype.formatCell=function(cell,rowValue){};prototype.destroy=function(){};prototype.onResize=function(newWidth){};prototype.addResizeListener=function(listener){};prototype.toggleShadow=function(shadowType,hideShadow){};constructor.ShadowType=function(){};constructor.ShadowType=stjs.extend(constructor.ShadowType,null,[],function(constructor,prototype){constructor.TOP="top";constructor.BOTTOM="bottom";},{},{});},{},{});stjs.ns("components.table");components.table.ExpandableTableMediator=function(){};components.table.ExpandableTableMediator=stjs.extend(components.table.ExpandableTableMediator,null,[],function(constructor,prototype){prototype.getViewportWidth=function(){};prototype.getViewportHeight=function(){};prototype.updateViewportHeight=function(heightToUpdate){};prototype.updateViewportWidth=function(widthToUpdate){};prototype.addExpander=function(rowIndex,expander,priority){};prototype.removeExpander=function(expander){};prototype.getExpanders=function(rowIndex){};prototype.getExpandersOfType=function(rowIndex,expanderType){};prototype.getAllExpandersOfType=function(expanderType){};},{},{});stjs.ns("components.table");components.table.ExpandableRowDeletedEvent=function(tableModel,columnModel,destroyedExpanders){this.tableModel=tableModel;this.columnModel=columnModel;this.destroyedExpanders=destroyedExpanders;};components.table.ExpandableRowDeletedEvent=stjs.extend(components.table.ExpandableRowDeletedEvent,null,[],function(constructor,prototype){prototype.tableModel=null;prototype.columnModel=null;prototype.destroyedExpanders=null;prototype.getColumnModel=function(){return this.columnModel;};prototype.getTableModel=function(){return this.tableModel;};prototype.getDestroyedExpanders=function(){return this.destroyedExpanders;};prototype.getDestroyedExpandersOfType=function(type){return this.destroyedExpanders.filter(function(exp,i,arr){return(exp).constructor==type;});};},{tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",destroyedExpanders:{name:"Array",arguments:["components.table.RowExpander"]}},{});stjs.ns("components.table");components.table.RowExpanderMediator=function(){};components.table.RowExpanderMediator=stjs.extend(components.table.RowExpanderMediator,null,[],function(constructor,prototype){prototype.remove=function(){};},{},{});stjs.ns("components.table");components.table.RowExpanderManager=function(){};components.table.RowExpanderManager=stjs.extend(components.table.RowExpanderManager,null,[],function(constructor,prototype){prototype.init=function(mediator){};prototype.formatExpandableRow=function(rowIndex,row,tableModel,installedExpanders){};prototype.onExpandableRowClicked=function(expandableRowClickedEvent){};prototype.onExpandableRowAdded=function(expandableRowAddedEvent){};prototype.onExpandableRowDeleted=function(expandableRowAddedEvent){};prototype.onExpanderDestroyed=function(expander){};},{},{});stjs.ns("components.table");components.table.ExpandableRowClickedEvent=function(rowIndex,columnId,tableModel,columnModel,installedExpanders,event){this.rowIndex=rowIndex;this.columnId=columnId;this.tableModel=tableModel;this.columnModel=columnModel;this.installedExpanders=installedExpanders;this.event=event;};components.table.ExpandableRowClickedEvent=stjs.extend(components.table.ExpandableRowClickedEvent,null,[],function(constructor,prototype){prototype.rowIndex=0;prototype.columnId=null;prototype.tableModel=null;prototype.columnModel=null;prototype.installedExpanders=null;prototype.event=null;prototype.getRowIndex=function(){return this.rowIndex;};prototype.getColumnId=function(){return this.columnId;};prototype.getColumnModel=function(){return this.columnModel;};prototype.getTableModel=function(){return this.tableModel;};prototype.getInstalledExpanders=function(){return this.installedExpanders;};prototype.getInstalledExpandersOfType=function(type){return this.installedExpanders.filter(function(exp,i,arr){return(exp).constructor==type;});};prototype.getEvent=function(){return this.event;};},{tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",installedExpanders:{name:"Array",arguments:["components.table.RowExpander"]},event:"Event"},{});stjs.ns("components.table");components.table.ExpandableRowAddedEvent=function(rowIndex,tableModel,columnModel){this.rowIndex=rowIndex;this.tableModel=tableModel;this.columnModel=columnModel;};components.table.ExpandableRowAddedEvent=stjs.extend(components.table.ExpandableRowAddedEvent,null,[],function(constructor,prototype){prototype.rowIndex=0;prototype.tableModel=null;prototype.columnModel=null;prototype.getRowIndex=function(){return this.rowIndex;};prototype.getColumnModel=function(){return this.columnModel;};prototype.getTableModel=function(){return this.tableModel;};},{tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel"},{});stjs.ns("components.table");components.table.RowExpanderAction=function(manager,actions){this.manager=manager;this.actions=actions;};components.table.RowExpanderAction=stjs.extend(components.table.RowExpanderAction,null,[],function(constructor,prototype){prototype.manager=null;prototype.actions=null;prototype.toString=function(){return"RowExpanderAction["+this.actions.toString()+"]";};prototype.visit=function(visitor){this.actions.forEach(stjs.bind(this,function(step,i,a){return step.accept(visitor,this.manager);}));};constructor.on=function(manager){return new components.table.RowExpanderAction.Builder(manager);};constructor.Action=function(rowIndex,expander){this.rowIndex=rowIndex;this.expander=expander;};constructor.Action=stjs.extend(constructor.Action,null,[],function(constructor,prototype){prototype.rowIndex=0;prototype.expander=null;prototype.getExpander=function(){return this.expander;};prototype.getRowIndex=function(){return this.rowIndex;};prototype.accept=function(visitor,manager){};},{expander:"components.table.RowExpander"},{});constructor.Add=function(rowIndex,expander){components.table.RowExpanderAction.Action.call(this,rowIndex,expander);};constructor.Add=stjs.extend(constructor.Add,components.table.RowExpanderAction.Action,[],function(constructor,prototype){prototype.accept=function(visitor,manager){visitor.visitAdd(this,manager);};prototype.toString=function(){return"add(rowIndex: "+this.getRowIndex()+", expander: "+this.getExpander()+")";};},{expander:"components.table.RowExpander"},{});constructor.Remove=function(rowIndex,expander){components.table.RowExpanderAction.Action.call(this,rowIndex,expander);};constructor.Remove=stjs.extend(constructor.Remove,components.table.RowExpanderAction.Action,[],function(constructor,prototype){prototype.accept=function(visitor,manager){visitor.visitRemove(this,manager);};prototype.toString=function(){return"remove(rowIndex: "+this.getRowIndex()+", expander: "+this.getExpander()+")";};},{expander:"components.table.RowExpander"},{});constructor.Visitor=function(){};constructor.Visitor=stjs.extend(constructor.Visitor,null,[],function(constructor,prototype){prototype.visitAdd=function(add,manager){};prototype.visitRemove=function(remove,manager){};},{},{});constructor.Builder=function(manager){this.manager=manager;this.actions=[];};constructor.Builder=stjs.extend(constructor.Builder,null,[],function(constructor,prototype){prototype.manager=null;prototype.actions=null;prototype.withAdd=function(rowIndex,expander){this.actions.push(new components.table.RowExpanderAction.Add(rowIndex,expander));return this;};prototype.withRemove=function(rowIndex,expander){this.actions.push(new components.table.RowExpanderAction.Remove(rowIndex,expander));return this;};prototype.get=function(){return new components.table.RowExpanderAction(this.manager,this.actions);};},{manager:"components.table.RowExpanderManager",actions:{name:"Array",arguments:["components.table.RowExpanderAction.Action"]}},{});},{manager:"components.table.RowExpanderManager",actions:{name:"Array",arguments:["components.table.RowExpanderAction.Action"]}},{});stjs.ns("components.table");components.table.StaticRowExpander=function(html){this.html=html;};components.table.StaticRowExpander=stjs.extend(components.table.StaticRowExpander,null,[components.table.RowExpander],function(constructor,prototype){prototype.html=null;prototype.formatCell=function(cell,rowValue){cell.getElement().innerHTML=this.html;};prototype.onAdded=function(mediator){};prototype.formatRow=function(row,rowValue){};prototype.destroy=function(){};prototype.onResize=function(newWidth){};prototype.addResizeListener=function(listener){return true;};prototype.toggleShadow=function(shadowType,hideShadow){};},{},{});stjs.ns("components.table");components.table.ExpanderRow=function(expander,manager,id){this.expander=expander;this.manager=manager;this.id=id;};components.table.ExpanderRow=stjs.extend(components.table.ExpanderRow,null,[components.table.VirtualRow],function(constructor,prototype){prototype.expander=null;prototype.manager=null;prototype.id=null;prototype.getValue=function(columnId){return null;};prototype.getRowData=function(){return null;};prototype.getId=function(){return this.id;};prototype.getExpander=function(){return this.expander;};prototype.getManager=function(){return this.manager;};},{expander:"components.table.RowExpander",manager:"components.table.RowExpanderManager"},{});stjs.ns("components.table");components.table.ExpandableRow=function(actual){this.actual=actual;this.expanders=[];};components.table.ExpandableRow=stjs.extend(components.table.ExpandableRow,null,[components.table.VirtualRow],function(constructor,prototype){prototype.actual=null;prototype.expanders=null;prototype.getValue=function(columnId){return this.actual.getValue(columnId);};prototype.getRowData=function(){return this.actual.getRowData();};prototype.getId=function(){return this.actual.getId();};prototype.getExpanders=function(){return this.expanders.map(function(exp,i,arr){return exp.expander;});};prototype.getManagers=function(){return this.expanders.map(function(exp,i,arr){return exp.manager;});};prototype.getExpandersForManager=function(manager){return this.expanders.filter(function(exp,i,arr){return exp.manager==manager;}).map(function(exp,i,arr){return exp.expander;});};prototype.addExpander=function(expander,manager,weight){var insertIndex=0;for(;insertIndex<this.expanders.length;insertIndex++){if(this.expanders[insertIndex].weight>weight){break;}}
this.expanders.splice(insertIndex,0,new components.table.ExpandableRow.WeightedExpander(weight,expander,manager));return insertIndex;};prototype.removeExpander=function(expander){for(var i=0;i<this.expanders.length;i++){if(this.expanders[i].expander==expander){this.expanders.splice(i,1);return i;}}
return-1;};prototype.getExpanderCount=function(){return this.expanders.length;};constructor.WeightedExpander=function(weight,expander,manager){this.weight=weight;this.expander=expander;this.manager=manager;};constructor.WeightedExpander=stjs.extend(constructor.WeightedExpander,null,[],function(constructor,prototype){prototype.weight=0;prototype.expander=null;prototype.manager=null;},{expander:"components.table.RowExpander",manager:"components.table.RowExpanderManager"},{});},{actual:"components.table.VirtualRow",expanders:{name:"Array",arguments:["components.table.ExpandableRow.WeightedExpander"]}},{});stjs.ns("components.table");components.table.RowExpandersTableModel=function(realModel){components.table.DefaultVirtualTableModel.call(this,realModel);};components.table.RowExpandersTableModel=stjs.extend(components.table.RowExpandersTableModel,components.table.DefaultVirtualTableModel,[],function(constructor,prototype){prototype.init=function(){components.table.AbstractVirtualModel.prototype.init.call(this);for(var i=0;i<this.getRowCount();i++){var row=this.virtualRef(i).get();this.elements().replace(row,new components.table.ExpandableRow(row));}};prototype.applyRealElementsInsertedEvent=function(builder,realStep){var virtualInsertIndex;if(realStep.getInsertIndex()<this.elements().left().size()){virtualInsertIndex=this.realRef(realStep.getInsertIndex()).toVirtual().index();}else{virtualInsertIndex=this.elements().right().size();}
var insertRows=[];for(var i=0;i<realStep.getElementCount();i++){insertRows.push(new components.table.ExpandableRow(this.newRealElement(this.nextElementId())));}
this.elements().left().insertAll(insertRows,realStep.getInsertIndex());this.elements().right().insertAll(insertRows,virtualInsertIndex);builder.withElementsInserted(virtualInsertIndex,realStep.getElementCount());};prototype.applyRealElementsMovedEvent=function(builder,realStep){var firstVirtualRowIndex=this.elements().left().oppositeIndex(realStep.getSourceIndex());var virtualRowCount=realStep.getElementCount()+this.getExpanderCountSum(realStep.getSourceIndex(),realStep.getElementCount());var virtualDestinationRowIndex=this.elements().left().oppositeIndex(realStep.getDestinationIndex());if(realStep.getSourceIndex()<realStep.getDestinationIndex()){var destinationRow=this.elements().left().get(realStep.getDestinationIndex());var destinationExpanderCount=destinationRow.getExpanderCount();virtualDestinationRowIndex=virtualDestinationRowIndex+destinationExpanderCount-virtualRowCount+1;}
this.elements().left().moveRange(realStep.getSourceIndex(),realStep.getDestinationIndex(),realStep.getElementCount());this.elements().right().moveRange(firstVirtualRowIndex,virtualDestinationRowIndex,virtualRowCount);builder.withElementsMoved(virtualDestinationRowIndex,firstVirtualRowIndex,virtualRowCount);};prototype.applyRealElementPropertiesUpdatedEvent=function(builder,realStep){components.table.AbstractVirtualModel.prototype.applyRealElementPropertiesUpdatedEvent.call(this,builder,realStep);};prototype.applyRealElementsDeletedEvent=function(builder,realStep){var firstVirtualRowIndex=this.elements().left().oppositeIndex(realStep.getDeleteIndex());var virtualRowCount=realStep.getElementCount()+this.getExpanderCountSum(realStep.getDeleteIndex(),realStep.getElementCount());this.elements().left().removeRange(realStep.getDeleteIndex(),realStep.getElementCount());var rightDeleted=this.elements().right().removeRange(firstVirtualRowIndex,virtualRowCount);builder.withElementsDeleted(firstVirtualRowIndex,rightDeleted);};prototype.getExpanderCountSum=function(fromRealIndex,expandableRowCount){var expanderCount=0;for(var i=fromRealIndex;i<fromRealIndex+expandableRowCount;i++){var row=this.elements().left().get(i);expanderCount+=row.getExpanderCount();}
return expanderCount;};prototype.insertExpander=function(index,expander,manager,weight){var expandable=this.getExpandableRow(index);var expanderIndex=expandable.addExpander(expander,manager,weight);var expanderRow=new components.table.ExpanderRow(expander,manager,this.nextElementId());this.insertVirtualElement(expanderRow,index.toVirtual().index()+1+expanderIndex);};prototype.deleteExpander=function(expander){var expanderIndex=this.virtualRef(this.elements().right().findIndex(function(row,i){return stjs.isInstanceOf(row.constructor,components.table.ExpanderRow)&&(row).getExpander()==expander;}));if(!expanderIndex.exists()){throw new RuntimeException("Unable to find expander "+expander+" in this table");}
var parentIndex=this.getParentRowIndex(expanderIndex);this.getExpandableRow(parentIndex).removeExpander(expander);this.deleteVirtualElement(expanderIndex.toVirtual().index());return parentIndex;};prototype.getExpandableRow=function(index){var row=index.get();if(!(stjs.isInstanceOf(row.constructor,components.table.ExpandableRow))){throw new RuntimeException("The row at "+index+" is not expandable and can't have expanders");}
return row;};prototype.getParentRowIndex=function(childRowIndex){this.getExpanderRow(childRowIndex);for(var i=childRowIndex.toVirtual().index();i>=0;i--){var index=this.virtualRef(i);if(stjs.isInstanceOf(index.get().constructor,components.table.ExpandableRow)){return index;}}
throw new RuntimeException("Could not find the parent row of the ExpanderRow at "+childRowIndex);};prototype.getParentRow=function(childRowIndex){return this.getParentRowIndex(childRowIndex).get();};prototype.getExpanderRow=function(index){var row=index.get();if(!(stjs.isInstanceOf(row.constructor,components.table.ExpanderRow))){throw new RuntimeException("The row at "+row+" is not an ExpanderRow");}
return row;};prototype.getParentRowData=function(childRowIndex){return this.getParentRow(childRowIndex).getRowData();};prototype.getExpanders=function(index){return this.getExpandableRow(index).getExpanders().slice(0);};prototype.getExpandersForManager=function(index,manager){return this.getExpandableRow(index).getExpandersForManager(manager);};prototype.getManagers=function(index){return this.getExpandableRow(index).getManagers().slice(0);};prototype.getExpandersOfType=function(index,expanderType){return this.getExpanders(index).filter(function(expander,i,arr){return(expander).constructor==expanderType;}).map(function(expander,i,arr){return expander;});};prototype.getExpandersOfTypeForManager=function(index,expanderType,manager){return this.getExpandersForManager(index,manager).filter(function(expander,i,arr){return(expander).constructor==expanderType;}).map(function(expander,i,arr){return expander;});};prototype.getAllExpanders=function(){return this.elements().right().filter(function(row,index){return stjs.isInstanceOf(row.constructor,components.table.ExpanderRow);}).map(function(row,i,arr){return(row).getExpander();});};prototype.getAllExpandersOfType=function(expanderType){return this.getAllExpanders().filter(function(expander,i,arr){return(expander).constructor==expanderType;});};},{elems:{name:"components.table.ParallelList",arguments:["ELEMENT"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});stjs.ns("components.table");components.table.RowExpandersExtension=function(managers,cssClass){components.table.VirtualTableExtension.call(this);this.managers=managers.slice(0);this.cssClass=cssClass;};components.table.RowExpandersExtension=stjs.extend(components.table.RowExpandersExtension,components.table.VirtualTableExtension,[],function(constructor,prototype){constructor.LOG=squp.util.LoggerFactory.getLogger("RowExpandersExtension");prototype.managers=null;prototype.cssClass=null;prototype.init=function(dataModel,columnModel,options,attributes,extensions,chain){components.table.VirtualTableExtension.prototype.init.call(this,dataModel,columnModel,options,attributes,extensions,chain);this.initListeners();this.invokeManagersSafely(stjs.bind(this,function(manager){return manager.init(new components.table.RowExpandersExtension.TableMediator(this,manager));}),"init()");};prototype.initListeners=function(){var that=this;var VIEWPORT_WIDTH_UPDATE_LISTENER=function(paramName,nextValue,prevValue){if(Boolean(prevValue)&&stjs.trunc(prevValue)!=stjs.trunc(nextValue)){that.notifySizeChanged(stjs.trunc(nextValue));}};this.getAttributes().addListener(components.table.TableAttributes.Attributes.VIEWPORT_WIDTH.name(),VIEWPORT_WIDTH_UPDATE_LISTENER);};prototype.wrapTableModel=function(underlying){return new components.table.RowExpandersTableModel(underlying);};prototype.getTableModel=function(){return components.table.VirtualTableExtension.prototype.getTableModel.call(this);};prototype.handleInvalidate=function(event,chain){if(event.getSection()==components.table.InvalidateEvent.Section.HEAD){chain.handleInvalidate(event);return;}
var that=this;var translated=new components.table.InvalidateEvent.Builder(event.getSection());event.visit(new(stjs.extend(function RowExpandersExtension$1(){},null,[components.table.InvalidateEvent.StepVisitor],function(constructor,prototype){prototype.visitRows=function(step,section){that.forAllContiguousVirtualRanges(step.getFirstRow(),step.getRowCount(),stjs.bind(translated,"withRows"));};prototype.visitSection=function(step,section){translated.withSection();};prototype.visitCells=function(step,section){that.forAllContiguousVirtualRanges(step.getFirstRow(),step.getRowCount(),function(rangeFirstRow,rangeRowCount){translated.withCells(step.getColumnIdentifiers(),rangeFirstRow,rangeRowCount);});};},{},{}))());chain.handleInvalidate(translated.get());};prototype.handleBodySectionSizeChanged=function(event,chain){components.table.AbstractTableExtension.prototype.handleBodySectionSizeChanged.call(this,event,chain);};prototype.handleInvalidateSizes=function(event,chain){components.table.AbstractTableExtension.prototype.handleInvalidateSizes.call(this,event,chain);};prototype.notifySizeChanged=function(newWidth){this.getTableModel().getAllExpanders().forEach(stjs.bind(this,function(e){return this.invokeExpanderSafely(e,function(exp){return exp.onResize(newWidth);},"onResize()");}));};prototype.forAllContiguousVirtualRanges=function(fromRealIndex,realRowCount,cb){var firstVirtualRow=this.getTableModel().realRef(fromRealIndex).toVirtual().index();var rowCount=1;for(var i=1;i<realRowCount;i++){var rowRealIndex=this.getTableModel().realRef(fromRealIndex+i);var row=this.getTableModel().getExpandableRow(rowRealIndex);if(row.getExpanderCount()==0){rowCount++;}else{cb(firstVirtualRow,rowCount+1);firstVirtualRow=rowRealIndex.next().toVirtual().index();rowCount=0;}}
if(rowCount>0){cb(firstVirtualRow,rowCount);}};prototype.handleTableCellClicked=function(event,chain){var virtualRowIndex=event.getRowIndex();var row=this.getTableModel().virtualRef(virtualRowIndex).get();if(stjs.isInstanceOf(row.constructor,components.table.ExpandableRow)){var col=this.getColumnModel().getColumn(event.getColumnIndex());this.onExpandableRowClicked(virtualRowIndex,col,row,event);components.table.VirtualTableExtension.prototype.handleTableCellClicked.call(this,event,chain);}};prototype.handleTableModelEvent=function(event,chain){var that=this;chain.handleTableModelEvent(this.getTableModel().applyEvent(event,new(stjs.extend(function RowExpandersExtension$2(){components.table.ApplyEventListener.Adapter.call(this);},components.table.ApplyEventListener.Adapter,[],function(constructor,prototype){prototype.beforeApplyDelete=function(step,tableModel){that.onExpandableRowsDeleted(step.getDeleteIndex(),step.getElementCount());};prototype.afterApplyInsert=function(step,tableModel){that.onExpandableRowsAdded(step.getInsertIndex(),step.getElementCount());};},{},{}))()));};prototype.onExpandableRowClicked=function(virtualRowIndex,column,row,originalEvent){var clientIndex=this.getTableModel().virtualRef(virtualRowIndex).toClient();if(!clientIndex.exists()){return;}
var event=new components.table.ExpandableRowClickedEvent(clientIndex.index(),column.getModelIdentifier(),this.getTableModel().getClientModel(),this.getColumnModel(),row.getExpanders(),originalEvent.getEvent());this.fireManagerEvent(stjs.bind(this,function(manager){if(manager.onExpandableRowClicked(event)){var invalidateEvent=components.table.InvalidateEvent.onBody().withRows(virtualRowIndex,1).get();this.forwardChain().handleInvalidate(invalidateEvent);}}),"ExpandableRowClickedEvent");};prototype.onExpandableRowsAdded=function(insertRow,rowCount){for(var realIndex=insertRow;realIndex<insertRow+rowCount;realIndex++){var clientIndex=this.getTableModel().realRef(realIndex).toClient();if(clientIndex.exists()){this.fireExpandableRowAdded(clientIndex);}}};prototype.fireExpandableRowAdded=function(clientIndex){var evt=new components.table.ExpandableRowAddedEvent(clientIndex.index(),this.getTableModel().getClientModel(),this.getColumnModel());this.fireManagerEvent(function(manager){return manager.onExpandableRowAdded(evt);},"ExpandableRowAddedEvent");};prototype.onExpandableRowsDeleted=function(firstRow,rowCount){for(var i=firstRow;i<firstRow+rowCount;i++){var realIndex=this.getTableModel().realRef(i);var expanders=this.getTableModel().getExpanders(realIndex);var managers=this.getTableModel().getManagers(realIndex);for(var j=0;j<expanders.length;j++){this.destroyExpander(expanders[j],managers[j]);}
this.fireExpandableRowDeleted(expanders);}};prototype.destroyExpander=function(expander,manager){this.invokeExpanderSafely(expander,stjs.bind("destroy"),"destroy()");this.invokeManagerSafely(manager,function(m){return m.onExpanderDestroyed(expander);},"onExpanderDestroyed()");};prototype.fireExpandableRowDeleted=function(expanders){var evt=new components.table.ExpandableRowDeletedEvent(this.getTableModel().getClientModel(),this.getColumnModel(),expanders);this.fireManagerEvent(function(manager){return manager.onExpandableRowDeleted(evt);},"ExpandableRowDeletedEvent");};prototype.fireManagerEvent=function(invoker,eventName){setTimeout(stjs.bind(this,function(){return this.invokeManagersSafely(invoker,eventName);}),0);};prototype.invokeManagersSafely=function(invoker,eventName){this.managers.forEach(stjs.bind(this,function(manager){return this.invokeManagerSafely(manager,invoker,eventName);}));};prototype.invokeManagerSafely=function(manager,invoker,eventName){try{invoker(manager);}catch(e){components.table.RowExpandersExtension.LOG.error("An error occurred while dispatching an "+eventName,e);}};prototype.invokeExpanderSafely=function(expander,invoker,eventName){try{invoker(expander);}catch(e){components.table.RowExpandersExtension.LOG.error("An error occurred while dispatching an "+eventName,e);}};prototype.renderVirtualBodyCell=function(rowRef,colRef,chain){if(colRef.index()==0){var cell=chain.renderBodyCell(-1,colRef.toReal().index());cell.setColspan(this.getColumnModel().getColumnCount());return cell;}
return new components.table.MergedCell();};prototype.formatBodyRow=function(rowIndex,row,chain){var virtualIndex=this.getTableModel().virtualRef(rowIndex);var realIndex=virtualIndex.toReal();if(realIndex.exists()){chain.formatBodyRow(realIndex.index(),row);this.invokeManagersSafely(stjs.bind(this,function(manager){return manager.formatExpandableRow(realIndex.toClient().index(),row,this.getTableModel().getClientModel(),this.getTableModel().getExpanders(realIndex));}),"formatExpandableRow()");}else{if(this.cssClass.length>0){components.table.Dom.addClass(row.getElement(),this.cssClass);}
var erow=this.getTableModel().getExpanderRow(virtualIndex);var rowData=this.getTableModel().getParentRowData(virtualIndex);this.invokeExpanderSafely(erow.getExpander(),function(ex){return ex.formatRow(row,rowData);},"formatRow()");}};prototype.formatVirtualBodyCell=function(rowRef,colRef,cell,chain){if(this.cssClass.length>0){components.table.Dom.addClass(cell.getElement(),this.cssClass+"__cell");}
var erow=rowRef.get();var rowData=this.getTableModel().getParentRowData(rowRef);this.invokeExpanderSafely(erow.getExpander(),function(ex){return ex.formatCell(cell,rowData);},"formatCell()");};prototype.insertExpanderAtClientIndex=function(clientRowIndex,expander,manager,weight){if((typeof weight)==undefined){weight=this.managers.indexOf(manager);}
this.getTableModel().insertExpander(this.getTableModel().clientRef(clientRowIndex),expander,manager,weight);var mediator=new components.table.RowExpandersExtension.ExpanderMediator(expander,this,manager);this.invokeExpanderSafely(expander,function(e){return e.onAdded(mediator);},"onAdded()");expander.addResizeListener(stjs.bind(this,function(evt){return this.onExpanderResized();}));};prototype.onExpanderResized=function(){this.forwardChain().handleInvalidateSizes(new components.table.InvalidateSizesEvent(true,false));};prototype.deleteExpander=function(expander,manager){this.destroyExpander(expander,manager);this.getTableModel().deleteExpander(expander);};prototype.getExpandersAtClientIndex=function(clientRowIndex,manager){return this.getTableModel().getExpandersForManager(this.getTableModel().clientRef(clientRowIndex),manager);};prototype.getExpandersAtClientIndexOfType=function(clientRowIndex,manager,expanderType){return this.getTableModel().getExpandersOfTypeForManager(this.getTableModel().clientRef(clientRowIndex),expanderType,manager);};prototype.getAllExpandersOfType=function(expanderType){return this.getTableModel().getAllExpandersOfType(expanderType);};constructor.TableMediator=function(extension,manager){this.extension=extension;this.manager=manager;};constructor.TableMediator=stjs.extend(constructor.TableMediator,null,[components.table.ExpandableTableMediator],function(constructor,prototype){prototype.extension=null;prototype.manager=null;prototype.getViewportWidth=function(){return stjs.trunc(this.extension.getAttributes().get(components.table.TableAttributes.Attributes.VIEWPORT_WIDTH.name()));};prototype.getViewportHeight=function(){return stjs.trunc(this.extension.getAttributes().get(components.table.TableAttributes.Attributes.VIEWPORT_HEIGHT.name()));};prototype.updateViewportHeight=function(heightToUpdate){var oldViewPortHeight=this.getViewportHeight();if(heightToUpdate!=0){this.extension.getAttributes().put(components.table.TableAttributes.Attributes.VIEWPORT_HEIGHT.name(),oldViewPortHeight+heightToUpdate);}};prototype.updateViewportWidth=function(widthToUpdate){var oldViewPortWidth=this.getViewportWidth();if(widthToUpdate!=0){this.extension.getAttributes().put(components.table.TableAttributes.Attributes.VIEWPORT_WIDTH.name(),oldViewPortWidth+widthToUpdate);}};prototype.addExpander=function(rowIndex,expander,priority){this.extension.insertExpanderAtClientIndex(rowIndex,expander,this.manager,priority);};prototype.removeExpander=function(expander){this.extension.deleteExpander(expander,this.manager);};prototype.getExpanders=function(rowIndex){return this.extension.getExpandersAtClientIndex(rowIndex,this.manager);};prototype.getExpandersOfType=function(rowIndex,expanderType){return this.extension.getExpandersAtClientIndexOfType(rowIndex,this.manager,expanderType);};prototype.getAllExpandersOfType=function(expanderType){return this.extension.getAllExpandersOfType(expanderType);};},{extension:"components.table.RowExpandersExtension",manager:"components.table.RowExpanderManager"},{});constructor.ExpanderMediator=function(expander,extension,manager){this.expander=expander;this.extension=extension;this.manager=manager;};constructor.ExpanderMediator=stjs.extend(constructor.ExpanderMediator,null,[components.table.RowExpanderMediator],function(constructor,prototype){prototype.expander=null;prototype.extension=null;prototype.manager=null;prototype.remove=function(){this.extension.deleteExpander(this.expander,this.manager);};},{expander:"components.table.RowExpander",extension:"components.table.RowExpandersExtension",manager:"components.table.RowExpanderManager"},{});},{LOG:"squp.util.Logger",managers:{name:"Array",arguments:["components.table.RowExpanderManager"]},columnModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableColumnModel"]}]},tableModelListener:{name:"Callback1",arguments:[{name:"components.table.ModelEvent",arguments:["components.table.TableModel"]}]},tableModel:"components.table.TableModel",columnModel:"components.table.TableColumnModel",options:"components.table.TableRenderingOptions",extensions:"components.table.TableExtensionList",attributes:"components.table.TableAttributes"},{});stjs.ns("components.table");components.table.RowExpanders=function(){this.managers=[];this.cssClass="RowExpander";};components.table.RowExpanders=stjs.extend(components.table.RowExpanders,null,[],function(constructor,prototype){prototype.managers=null;prototype.cssClass=null;prototype.extension=null;prototype.withManager=function(manager){this.verifyExtensionNotBuilt();this.verifyNotNull(manager,"manager");this.managers.push(manager);return this;};prototype.withCssClass=function(cssClass){this.verifyExtensionNotBuilt();this.verifyNotNull(cssClass,"cssClass");this.cssClass=cssClass;return this;};prototype.toExtension=function(){if(this.extension==null){this.extension=new components.table.RowExpandersExtension(this.managers,this.cssClass);}
return this.extension;};prototype.verifyNotNull=function(value,propertyName){if(value==null){throw new RuntimeException("Property "+propertyName+" may not be null or undefined");}};prototype.verifyExtensionNotBuilt=function(){if(this.extension!=null){throw new RuntimeException("Illegal state: extension already built");}};},{managers:{name:"Array",arguments:["components.table.RowExpanderManager"]},extension:"components.table.RowExpandersExtension"},{});
stjs.ns("sq.ithemes");sq.ithemes.LinkButton=function(label){this.linkButton=components.table.Dom.elem("a");this.linkButton.innerHTML=label;this.linkButton.setAttribute("target","_blank");this.linkButton.addEventListener("click",function(domEvent){(domEvent).stopPropagation();});};sq.ithemes.LinkButton=stjs.extend(sq.ithemes.LinkButton,null,[],function(constructor,prototype){prototype.linkButton=null;prototype.setUrl=function(url){this.linkButton.setAttribute("href",url);return this;};prototype.setPiwik=function(value){this.linkButton.setAttribute("data-analytics",value);return this;};prototype.withClass=function(className){components.table.Dom.addClass(this.linkButton,className);return this;};prototype.getElement=function(){return this.linkButton;};},{linkButton:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.DetailRow=function(){this.row=components.table.Dom.elem("tr");this.rightCell=components.table.Dom.elem("td");components.table.Dom.addClass(this.rightCell,"fullquote-table__cell fullquote-table__cell--right");};sq.ithemes.DetailRow=stjs.extend(sq.ithemes.DetailRow,null,[],function(constructor,prototype){prototype.row=null;prototype.rightCell=null;prototype.withLabel=function(label){var leftCell=components.table.Dom.elem("td");components.table.Dom.addClass(leftCell,"fullquote-table__cell");leftCell.innerHTML=label;this.row.appendChild(leftCell);return this;};prototype.createRow=function(themeQuote){};},{row:"Element",rightCell:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.MultipleUnderlyingRow=function(){sq.ithemes.DetailRow.call(this);};sq.ithemes.MultipleUnderlyingRow=stjs.extend(sq.ithemes.MultipleUnderlyingRow,sq.ithemes.DetailRow,[],function(constructor,prototype){prototype.createRow=function(themeQuote){if(themeQuote.isMultiUnderlyings()){this.rightCell.innerHTML=sq.ithemes.MessagesUtil.i18n.multipleUnderlying();}else{this.rightCell.innerHTML=themeQuote.getUnderlyingName();}
this.row.appendChild(this.rightCell);return this.row;};},{row:"Element",rightCell:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.PropertyRow=function(){sq.ithemes.DetailRow.call(this);this.properties=[];};sq.ithemes.PropertyRow=stjs.extend(sq.ithemes.PropertyRow,sq.ithemes.DetailRow,[],function(constructor,prototype){prototype.properties=null;prototype.withProperty=function(propertyName){return this.createProperty(propertyName,null);};prototype.withFormattedProperty=function(propertyName,formatterCallback){return this.createProperty(propertyName,formatterCallback);};prototype.createProperty=function(propertyName,formatterCallback){this.properties.push({property:propertyName,formatter:formatterCallback});return this;};prototype.withLabel=function(label){sq.ithemes.DetailRow.prototype.withLabel.call(this,label);return this;};prototype.createRow=function(themeQuote){var self=this;if(themeQuote!=null){this.properties.forEach(function(detailColunm){var data=(themeQuote)[detailColunm.property];if(data==null){return;}
if(detailColunm.formatter!=null){data=detailColunm.formatter(data);}
var content=self.rightCell.innerHTML;if(content!=""){content+="/";}
content+=data;self.rightCell.innerHTML=content;});}
this.row.appendChild(this.rightCell);return this.row;};constructor.DetailColunm=function(){};constructor.DetailColunm=stjs.extend(constructor.DetailColunm,null,[],function(constructor,prototype){prototype.property=null;prototype.formatter=null;},{formatter:{name:"Function1",arguments:["Object",null]}},{});},{properties:{name:"Array",arguments:["sq.ithemes.PropertyRow.DetailColunm"]},row:"Element",rightCell:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.MaturityRow=function(){sq.ithemes.PropertyRow.call(this);};sq.ithemes.MaturityRow=stjs.extend(sq.ithemes.MaturityRow,sq.ithemes.PropertyRow,[],function(constructor,prototype){prototype.createRow=function(themeQuote){if(themeQuote.isOpenEnded()){this.rightCell.innerHTML=sq.ithemes.MessagesUtil.i18n.openEnded();this.row.appendChild(this.rightCell);return this.row;}
return sq.ithemes.PropertyRow.prototype.createRow.call(this,themeQuote);};},{properties:{name:"Array",arguments:["sq.ithemes.PropertyRow.DetailColunm"]},row:"Element",rightCell:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.FullquoteLinkRow=function(){sq.ithemes.DetailRow.call(this);};sq.ithemes.FullquoteLinkRow=stjs.extend(sq.ithemes.FullquoteLinkRow,sq.ithemes.DetailRow,[],function(constructor,prototype){prototype.createRow=function(themeQuote){var linkButton=new sq.ithemes.LinkButton(sq.ithemes.MessagesUtil.i18n.moreInformation()).withClass("Table__bodyCell__link").setPiwik("track:event, category:Theme detail, action:Clicked, name: View fullquote"+themeQuote.getName()).setUrl("/url/fullquote?s="+themeQuote.getDisplayKey()+"&originalPartnerSource=ithemes").getElement();linkButton.setAttribute("data-hover-box",themeQuote.getStockKey().toString()+"-hover-box");this.rightCell.innerHTML="";components.table.Dom.removeClass(this.rightCell,"fullquote-table__cell--right");components.table.Dom.addClass(this.rightCell,"fullquote-table__cell--center");this.rightCell.setAttribute("colspan","2");this.rightCell.appendChild(linkButton);this.row.appendChild(this.rightCell);return this.row;};},{row:"Element",rightCell:"Element"},{});
stjs.ns("sq.ithemes");sq.ithemes.RowFormatters=function(){};sq.ithemes.RowFormatters=stjs.extend(sq.ithemes.RowFormatters,null,[],function(constructor,prototype){constructor.DATE_FORMATTER=function(o){return moment(o).format("DD/MM/YYYY");};constructor.TYPE_FORMATTER=function(o){var type=o;if(type==sq.ithemes.SecurityType.WARRANT){return sq.ithemes.MessagesUtil.i18n.warrant();}
if(type==sq.ithemes.SecurityType.OTHER_DERIVATIVE){return sq.ithemes.MessagesUtil.i18n.otherDerivative();}
return"";};constructor.INTEGER_FORMATTER=function(o){return new ThousandsSeparatorNumberFormatter().format(o);};constructor.DECIMAL_FORMATTER=function(o){return new AbbreviateNumberFormatter().format(o);};},{DATE_FORMATTER:{name:"Function1",arguments:["Object",null]},TYPE_FORMATTER:{name:"Function1",arguments:["Object",null]},INTEGER_FORMATTER:{name:"Function1",arguments:["Object",null]},DECIMAL_FORMATTER:{name:"Function1",arguments:["Object",null]}},{});
stjs.ns("sq.ithemes");sq.ithemes.DetailRowProvider=function(){};sq.ithemes.DetailRowProvider=stjs.extend(sq.ithemes.DetailRowProvider,null,[],function(constructor,prototype){prototype.getRows=function(){};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.WarrantProvider=function(){};sq.ithemes.WarrantProvider=stjs.extend(sq.ithemes.WarrantProvider,null,[sq.ithemes.DetailRowProvider],function(constructor,prototype){prototype.getRows=function(){return[new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.productType()).withFormattedProperty(sq.ithemes.ThemeQuote.TYPE_PROP,sq.ithemes.RowFormatters.TYPE_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.callPut()).withProperty(sq.ithemes.ThemeQuote.CALL_PUT_PROP),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.strike()).withFormattedProperty(sq.ithemes.ThemeQuote.STRIKE_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.MaturityRow().withLabel(sq.ithemes.MessagesUtil.i18n.maturity()).withFormattedProperty(sq.ithemes.ThemeQuote.MATURITY_PROP,sq.ithemes.RowFormatters.DATE_FORMATTER),new sq.ithemes.MultipleUnderlyingRow().withLabel(sq.ithemes.MessagesUtil.i18n.underlying()),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.issuer()).withProperty(sq.ithemes.ThemeQuote.ISSUER_PROP),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.exchange()).withProperty(sq.ithemes.ThemeQuote.STOCK_EXCHANGE_PROP),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.volatility()).withProperty(sq.ithemes.ThemeQuote.VOLATILITY_PROP),new sq.ithemes.FullquoteLinkRow()];};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ShareProvider=function(){};sq.ithemes.ShareProvider=stjs.extend(sq.ithemes.ShareProvider,null,[sq.ithemes.DetailRowProvider],function(constructor,prototype){prototype.getRows=function(){return[new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.close()).withFormattedProperty(sq.ithemes.ThemeQuote.CLOSE_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.open()).withFormattedProperty(sq.ithemes.ThemeQuote.OPEN_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.highLow()).withProperty(sq.ithemes.ThemeQuote.HIGH_PROP).withProperty(sq.ithemes.ThemeQuote.LOW_PROP),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.volume()).withFormattedProperty(sq.ithemes.ThemeQuote.VOLUME_PROP,sq.ithemes.RowFormatters.INTEGER_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.exchange()).withProperty(sq.ithemes.ThemeQuote.STOCK_EXCHANGE_PROP),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.dividend()).withFormattedProperty(sq.ithemes.ThemeQuote.DIVIDEND_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.dateDividend()).withFormattedProperty(sq.ithemes.ThemeQuote.DIVIDEND_DATE_PROP,sq.ithemes.RowFormatters.DATE_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.earning()).withFormattedProperty(sq.ithemes.ThemeQuote.EARNING_PER_SHARE_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.PropertyRow().withLabel(sq.ithemes.MessagesUtil.i18n.priceEarning()).withFormattedProperty(sq.ithemes.ThemeQuote.PRICE_EARNING_PROP,sq.ithemes.RowFormatters.DECIMAL_FORMATTER),new sq.ithemes.FullquoteLinkRow()];};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.RowProviderFactory=function(){};sq.ithemes.RowProviderFactory=stjs.extend(sq.ithemes.RowProviderFactory,null,[],function(constructor,prototype){constructor.create=function(type){switch(type.toString()){case"SHARE":case"ETF":return new sq.ithemes.ShareProvider();case"WARRANT":case"OTHER_DERIVATIVE":return new sq.ithemes.WarrantProvider();default:return new(stjs.extend(function RowProviderFactory$1(){},null,[sq.ithemes.DetailRowProvider],function(constructor,prototype){prototype.getRows=function(){return[];};},{},{}))();}};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.InfoBlock=function(){};sq.ithemes.InfoBlock=stjs.extend(sq.ithemes.InfoBlock,null,[],function(constructor,prototype){prototype.body=null;prototype.header=null;prototype.quote=null;prototype.render=function(){};prototype.destroy=function(){};prototype.onShow=function(){};prototype.isAvailable=function(){};},{body:"Element",header:"Element",quote:"sq.ithemes.ThemeQuote"},{});
stjs.ns("sq.ithemes");sq.ithemes.DetailBlock=function(quote){sq.ithemes.InfoBlock.call(this);this.quote=quote;};sq.ithemes.DetailBlock=stjs.extend(sq.ithemes.DetailBlock,sq.ithemes.InfoBlock,[],function(constructor,prototype){prototype.render=function(){this.initHeader();this.body=components.table.Dom.elem("section");components.table.Dom.addClass(this.body,"fullquote-expander__section");this.body.appendChild(this.header);this.body.appendChild(this.buildContent());sq.ithemes.SQAnalyticUtil.attachEvents(this.body);return this.body;};prototype.buildContent=function(){var blockContent=components.table.Dom.elem("div");components.table.Dom.addClass(blockContent,"fullquote-expander__section__content");var rows=sq.ithemes.RowProviderFactory.create(this.quote.getType()).getRows();var table=components.table.Dom.elem("table");components.table.Dom.addClass(table,"fullquote-table");for(var i=0;i<rows.length;i++){table.appendChild(rows[i].createRow(this.quote));}
blockContent.appendChild(table);return blockContent;};prototype.initHeader=function(){this.header=components.table.Dom.elem("header");components.table.Dom.addClass(this.header,"fullquote-expander__section__header");this.header.appendChild(components.table.Dom.text(sq.ithemes.MessagesUtil.i18n.fullQuote()));};prototype.destroy=function(){};prototype.onShow=function(){};prototype.isAvailable=function(){return this.quote.getType()!=null&&(this.quote.getType()==sq.ithemes.SecurityType.WARRANT||this.quote.getType()==sq.ithemes.SecurityType.SHARE||this.quote.getType()==sq.ithemes.SecurityType.ETF||this.quote.getType()==sq.ithemes.SecurityType.OTHER_DERIVATIVE);};},{body:"Element",header:"Element",quote:"sq.ithemes.ThemeQuote"},{});
stjs.ns("sq.ithemes");sq.ithemes.ChartBlock=function(quote){sq.ithemes.InfoBlock.call(this);this.quote=quote;};sq.ithemes.ChartBlock=stjs.extend(sq.ithemes.ChartBlock,sq.ithemes.InfoBlock,[],function(constructor,prototype){prototype.blockCanvasChart=null;prototype.chartBlockContent=null;prototype.render=function(){this.initHeader();this.body=components.table.Dom.elem("section");components.table.Dom.addClass(this.body,"fullquote-expander__section");this.chartBlockContent=components.table.Dom.elem("div");components.table.Dom.addClass(this.chartBlockContent,"fullquote-expander__section__content");this.body.appendChild(this.header);this.body.appendChild(this.chartBlockContent);this.blockCanvasChart=new sq.ithemes.BlockCanvasChart(this.quote.getStockKey().toString());return this.body;};prototype.initHeader=function(){this.header=components.table.Dom.elem("header");components.table.Dom.addClass(this.header,"fullquote-expander__section__header");this.header.appendChild(components.table.Dom.text(sq.ithemes.MessagesUtil.i18n.chart()));};prototype.destroy=function(){if(this.blockCanvasChart!=null){this.blockCanvasChart.destroy();}};prototype.onShow=function(){if(this.blockCanvasChart!=null){this.blockCanvasChart.render($(this.chartBlockContent));}};prototype.isAvailable=function(){return this.quote!=null;};},{blockCanvasChart:"sq.ithemes.BlockCanvasChart",chartBlockContent:"Element",body:"Element",header:"Element",quote:"sq.ithemes.ThemeQuote"},{});
stjs.ns("sq.ithemes");sq.ithemes.InfoPanel=function(quote){this.blocks=[new sq.ithemes.ChartBlock(quote),new sq.ithemes.DetailBlock(quote)];};sq.ithemes.InfoPanel=stjs.extend(sq.ithemes.InfoPanel,null,[],function(constructor,prototype){prototype.blocks=null;prototype.render=function(container){this.blocks.forEach(function(quoteInfoBlock){if(quoteInfoBlock.isAvailable()){container.appendChild(quoteInfoBlock.render());}});};prototype.destroy=function(){for(var i=0;i<this.blocks.length;i++){this.blocks[i].destroy();}};prototype.onShow=function(){for(var i=0;i<this.blocks.length;i++){this.blocks[i].onShow();}};},{blocks:{name:"Array",arguments:["Object"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.SingleRowExpanderManager=function(){this.rowsStorage=[];};sq.ithemes.SingleRowExpanderManager=stjs.extend(sq.ithemes.SingleRowExpanderManager,null,[components.table.RowExpanderManager],function(constructor,prototype){constructor.ANIMATE_TIMEOUT=1000;constructor.CSS_CLASS_IS_EXPANDED="is-expanded";constructor.ROW_ACTION_EXPAND="expand";constructor.ROW_ACTION_COLLAPSE="collapse";prototype.rowsStorage=null;prototype.expandableTableMediator=null;prototype.init=function(expandableTableMediator){this.expandableTableMediator=expandableTableMediator;};prototype.formatExpandableRow=function(i,row,tableModel,array){if(this.isRowWithoutColumns(row)||this.rowsStorage[i]!=null){return;}
this.rowsStorage[i]=row;this.providePiwikData(i,sq.ithemes.SingleRowExpanderManager.ROW_ACTION_EXPAND);components.table.Dom.addClass(row.getCell(0).getElement(),"Table__bodyCell--expandable");};prototype.isRowWithoutColumns=function(row){return row==null||row.getCells().length<1;};prototype.providePiwikData=function(rowIndex,action){var row=this.rowsStorage[rowIndex];if(this.isRowWithoutColumns(row)){return;}
row.getElement().setAttribute("data-analytics","track:event, category:Theme detail, action:Clicked, name: Expander - "+action);};prototype.onExpandableRowClicked=function(event){var that=this;var expanders=event.getInstalledExpandersOfType(sq.ithemes.SingleRowExpanderManager.SingleRowExpander);var rowIndex=event.getRowIndex();if(expanders.length==0){this.updateArrow(rowIndex,true);this.providePiwikData(rowIndex,sq.ithemes.SingleRowExpanderManager.ROW_ACTION_COLLAPSE);this.expandableTableMediator.addExpander(event.getRowIndex(),new sq.ithemes.SingleRowExpanderManager.SingleRowExpander());return false;}
this.updateArrow(rowIndex,false);expanders[0].getContainer().slideUp(sq.ithemes.SingleRowExpanderManager.ANIMATE_TIMEOUT,function(element){that.expandableTableMediator.removeExpander(expanders[0]);that.providePiwikData(rowIndex,sq.ithemes.SingleRowExpanderManager.ROW_ACTION_EXPAND);});return false;};prototype.updateArrow=function(rowIndex,expanded){var row=this.rowsStorage[rowIndex];if(this.isRowWithoutColumns(row)){return;}
var firstCell=row.getCell(0).getElement();if(expanded){components.table.Dom.addClass(firstCell,sq.ithemes.SingleRowExpanderManager.CSS_CLASS_IS_EXPANDED);}else{components.table.Dom.removeClass(firstCell,sq.ithemes.SingleRowExpanderManager.CSS_CLASS_IS_EXPANDED);}};prototype.onExpandableRowAdded=function(event){};prototype.onExpandableRowDeleted=function(event){};prototype.onExpanderDestroyed=function(expander){};prototype.toString=function(){return"SingleRowExpanderManager";};constructor.SingleRowExpander=function(){};constructor.SingleRowExpander=stjs.extend(constructor.SingleRowExpander,null,[components.table.RowExpander],function(constructor,prototype){prototype.mediator=null;prototype.container=null;prototype.infoPanel=null;prototype.onAdded=function(mediator){var that=this;this.mediator=mediator;this.container.slideDown(sq.ithemes.SingleRowExpanderManager.ANIMATE_TIMEOUT,function(element){if(that.infoPanel!=null){that.infoPanel.onShow();}});};prototype.getContainer=function(){return this.container;};prototype.formatRow=function(row,rowValue){components.table.Dom.addClass(row.getElement()," SingleRowExpander");};prototype.formatCell=function(cell,rowValue){var rowModel=rowValue;components.table.Dom.addClass(cell.getElement(),"SingleRowExpander__cell");this.container=$("<div class='fullquote-expander' />");this.infoPanel=new sq.ithemes.InfoPanel(rowModel.themeQuote);this.infoPanel.render(this.container.get(0));cell.getElement().appendChild(this.container.get(0));};prototype.destroy=function(){if(this.infoPanel!=null){this.infoPanel.destroy();}};prototype.onResize=function(newWidth){};prototype.addResizeListener=function(listener){return false;};prototype.toggleShadow=function(shadowType,hideShadow){};prototype.toString=function(){return"SingleRowExpander";};},{mediator:"components.table.RowExpanderMediator",container:"sq.ithemes.IThemesJQuery",infoPanel:"sq.ithemes.InfoPanel"},{});},{rowsStorage:{name:"Array",arguments:["components.table.RenderedRow"]},expandableTableMediator:"components.table.ExpandableTableMediator"},{});
stjs.ns("sq.ithemes");sq.ithemes.LessStrictPropertyModel=function(rows,formattedColumns){components.table.PropertyTableModel.call(this,rows);this.formattedColumns=formattedColumns;};sq.ithemes.LessStrictPropertyModel=stjs.extend(sq.ithemes.LessStrictPropertyModel,components.table.PropertyTableModel,[],function(constructor,prototype){prototype.formattedColumns=null;prototype.getValueAt=function(rowIndex,columnIdentifier){return this.formattedColumns.indexOf(columnIdentifier)!=-1?this.getRowData(rowIndex):components.table.PropertyTableModel.prototype.getValueAt.call(this,rowIndex,columnIdentifier);};prototype.getRows=function(){return this.rowData;};},{formattedColumns:{name:"Array",arguments:[null]},rowData:{name:"Array",arguments:["T"]},LOGGER:"squp.util.Logger",listeners:{name:"Array",arguments:[{name:"Callback1",arguments:["Object"]}]}},{});
stjs.ns("sq.ithemes");sq.ithemes.TableRowModel=function(){};sq.ithemes.TableRowModel=stjs.extend(sq.ithemes.TableRowModel,null,[],function(constructor,prototype){prototype.name=null;prototype.symbol=null;prototype.last=null;prototype.currency=null;prototype.readableLastChangePercent=null;prototype.weight=null;prototype.isin=null;prototype.exchangeId=null;prototype.key=null;prototype.displayKey=null;prototype.themeQuote=null;prototype.termsheetUrl=null;prototype.equals=function(o){var rowModel=o;if(this.name!=null?!this.name.equals(rowModel.name):rowModel.name!=null){return false;}
if(this.symbol!=null?!this.symbol.equals(rowModel.symbol):rowModel.symbol!=null){return false;}
if(this.last!=null?!this.last.equals(rowModel.last):rowModel.last!=null){return false;}
if(this.currency!=null?!this.currency.equals(rowModel.currency):rowModel.currency!=null){return false;}
if(this.readableLastChangePercent!=null?!this.readableLastChangePercent.equals(rowModel.readableLastChangePercent):rowModel.readableLastChangePercent!=null){return false;}
if(this.exchangeId!=null?!this.exchangeId.equals(rowModel.exchangeId):rowModel.exchangeId!=null){return false;}
if(this.key!=null?!this.key.equals(rowModel.key):rowModel.key!=null){return false;}
if(this.displayKey!=null?!this.displayKey.equals(rowModel.displayKey):rowModel.displayKey!=null){return false;}
return(this.weight!=null?!this.weight.equals(rowModel.weight):rowModel.weight!=null);};},{themeQuote:"sq.ithemes.ThemeQuote"},{});
stjs.ns("sq.ithemes");sq.ithemes.CellFormatters=function(){};sq.ithemes.CellFormatters=stjs.extend(sq.ithemes.CellFormatters,null,[],function(constructor,prototype){constructor.tradeButtonFormatter=function(tableType){return new(stjs.extend(function CellFormatters$1(arg0){components.table.AbstractCellFormatter.call(this,arg0);},components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){var tableRowModel=value;var tradeButton=new sq.ithemes.LinkButton(sq.ithemes.MessagesUtil.i18n.trade()).withClass("Table__bodyCell__trade-button").setPiwik("track:event, category:Theme detail, action:Clicked, name: Trade: "+tableType+";type:goal, value: 1").setUrl("/url/tradeMask?isin="+tableRowModel.isin+"&currency="+tableRowModel.currency+"&stockExchange="+tableRowModel.exchangeId+"&partnerSource=ithemes").getElement();cell.innerHTML="";cell.appendChild(tradeButton);components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);};},{next:"components.table.CellFormatter"},{}))(null);};constructor.termsheet=function(){return new(stjs.extend(function CellFormatters$2(arg0){components.table.AbstractCellFormatter.call(this,arg0);},components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){if(value!=null&&value!=undefined){var linkButton=new sq.ithemes.LinkButton("").withClass("Table__bodyCell__termsheet").setPiwik("track:event, category:Theme detail, action:Clicked, name:View termsheet").setUrl(sq.ithemes.Constant.SQI_PREMIUM_URL+value).getElement();cell.innerHTML="";cell.appendChild(linkButton);}
components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);};},{next:"components.table.CellFormatter"},{}))(null);};constructor.weightFormatter=function(){return new(stjs.extend(function CellFormatters$3(arg0){components.table.AbstractCellFormatter.call(this,arg0);},components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,sq.ithemes.FormatterUtil.formatPercentWithoutMultiply(value),col);};},{next:"components.table.CellFormatter"},{}))(null);};constructor.emptyFormatter=function(){return new(stjs.extend(function CellFormatters$4(arg0){components.table.AbstractCellFormatter.call(this,arg0);},components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){if(value==null||value.toString()==""){value="-";}
components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);};},{next:"components.table.CellFormatter"},{}))(null);};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeQuoteTable=function(themeQuoteArray){this.themeQuoteArray=themeQuoteArray;this.headerColumns=[];};sq.ithemes.ThemeQuoteTable=stjs.extend(sq.ithemes.ThemeQuoteTable,null,[],function(constructor,prototype){prototype.table=null;prototype.themeQuoteArray=null;prototype.model=null;prototype.headerColumns=null;prototype.tableType=null;prototype.initTable=function(){var expanders=new components.table.RowExpanders().withManager(new sq.ithemes.SingleRowExpanderManager());this.buildColumnModel();this.buildTableModel();this.table=new components.table.Table(this.model,new components.table.SimpleTableColumnModel(this.headerColumns),{extensions:[expanders.toExtension()],cssClass:"DataTable"});};prototype.buildColumnModel=function(){this.headerColumns=[components.table.TableColumn.column("trade","").formattedAs(sq.ithemes.CellFormatters.tradeButtonFormatter(this.tableType)).alignLeft(),components.table.TableColumn.column("name",sq.ithemes.MessagesUtil.i18n.name()).formattedAs(sq.ithemes.CellFormatters.emptyFormatter()).alignLeft(),components.table.TableColumn.column("symbol",sq.ithemes.MessagesUtil.i18n.symbol()).formattedAs(sq.ithemes.CellFormatters.emptyFormatter()).alignCenter(),components.table.TableColumn.column("last",sq.ithemes.MessagesUtil.i18n.price()).formattedAs(sq.ithemes.CellFormatters.emptyFormatter()).alignRight(),components.table.TableColumn.column("currency",sq.ithemes.MessagesUtil.i18n.currency()).formattedAs(sq.ithemes.CellFormatters.emptyFormatter()).alignCenter(),components.table.TableColumn.column("readableLastChangePercent",sq.ithemes.MessagesUtil.i18n.dailyChange()).formattedAs(sq.ithemes.CellFormatters.emptyFormatter()).alignRight()];};prototype.buildTableModel=function(){this.model=new sq.ithemes.LessStrictPropertyModel(this.themeQuoteArray.map(function(themeQuote,aLong,strings){if(themeQuote==null){return null;}
var row=new sq.ithemes.TableRowModel();row.name=themeQuote.getName();row.symbol=themeQuote.getSymbol();row.last=themeQuote.getLast();var stockKey=themeQuote.getStockKey();row.currency=stockKey.getCurrency();row.readableLastChangePercent=themeQuote.getReadableLastChangePercent();row.weight=themeQuote.getWeight();row.isin=stockKey.getIsin();row.exchangeId=stockKey.getExchangeId().toString();row.key=stockKey.toString();row.displayKey=themeQuote.getDisplayKey();row.themeQuote=themeQuote;row.termsheetUrl=themeQuote.getTermsheetUrl();return row;}),["trade"]);};prototype.render=function(){return this.table.render();};},{table:"components.table.Table",themeQuoteArray:{name:"Array",arguments:["sq.ithemes.ThemeQuote"]},model:{name:"components.table.PropertyTableModel",arguments:["sq.ithemes.TableRowModel"]},headerColumns:{name:"Array",arguments:["components.table.TableColumn"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.StructuredProductTable=function(themeTitle,structuredProducts){sq.ithemes.ThemeQuoteTable.call(this,structuredProducts);this.tableType="Structured product";this.themeTitle=themeTitle;this.initTable();};sq.ithemes.StructuredProductTable=stjs.extend(sq.ithemes.StructuredProductTable,sq.ithemes.ThemeQuoteTable,[],function(constructor,prototype){prototype.themeTitle=null;prototype.buildColumnModel=function(){sq.ithemes.ThemeQuoteTable.prototype.buildColumnModel.call(this);var termsheet=sq.ithemes.MessagesUtil.i18n.termsheet();this.headerColumns.push(components.table.TableColumn.column("termsheetUrl",termsheet).withHeaderTitle(termsheet).alignCenter().formattedAs(sq.ithemes.CellFormatters.termsheet()));};prototype.buildTableModel=function(){sq.ithemes.ThemeQuoteTable.prototype.buildTableModel.call(this);for(var i=0,count=this.model.getRowCount();i<count;i++){var structuredProductModel=this.model.getRowData(i);structuredProductModel.name="Themes Trading: "+this.themeTitle;this.model.updateRow(i,structuredProductModel);}};},{table:"components.table.Table",themeQuoteArray:{name:"Array",arguments:["sq.ithemes.ThemeQuote"]},model:{name:"components.table.PropertyTableModel",arguments:["sq.ithemes.TableRowModel"]},headerColumns:{name:"Array",arguments:["components.table.TableColumn"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.PortfolioTable=function(themeQuoteArray){sq.ithemes.ThemeQuoteTable.call(this,themeQuoteArray);this.tableType="Portfolio";this.initTable();};sq.ithemes.PortfolioTable=stjs.extend(sq.ithemes.PortfolioTable,sq.ithemes.ThemeQuoteTable,[],function(constructor,prototype){prototype.buildColumnModel=function(){sq.ithemes.ThemeQuoteTable.prototype.buildColumnModel.call(this);this.headerColumns.push(components.table.TableColumn.column("weight",sq.ithemes.MessagesUtil.i18n.weight()).alignRight().formattedAs(sq.ithemes.CellFormatters.weightFormatter()).headerFormattedAs(new(stjs.extend(function PortfolioTable$1(arg0){components.table.AbstractCellFormatter.call(this,arg0);},components.table.AbstractCellFormatter,[],function(constructor,prototype){prototype.formatCell=function(cell,value,col){components.table.AbstractCellFormatter.prototype.formatCell.call(this,cell,value,col);var tooltip=components.table.Dom.elem("div");components.table.Dom.addClass(tooltip,"tooltip-icon");tooltip.title=sq.ithemes.MessagesUtil.i18n.weightTooltip();tooltip.innerHTML="?";cell.appendChild(tooltip);};},{next:"components.table.CellFormatter"},{}))(null)));};},{table:"components.table.Table",themeQuoteArray:{name:"Array",arguments:["sq.ithemes.ThemeQuote"]},model:{name:"components.table.PropertyTableModel",arguments:["sq.ithemes.TableRowModel"]},headerColumns:{name:"Array",arguments:["components.table.TableColumn"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.SocialButton=function(){var that=this;this.button=$("<a class='social-icons__icon' data-analytics='track:event, category:Theme detail, action:Clicked, name: Social link - "+this.getName()+"' />");this.button.click(stjs.bind(this,function(ev,THIS){if(that.buttonHandler!=null){that.buttonHandler();}
return false;},1));};sq.ithemes.SocialButton=stjs.extend(sq.ithemes.SocialButton,null,[],function(constructor,prototype){prototype.buttonHandler=null;prototype.button=null;constructor.URL_WITH_MENU="https://www.swissquote.ch/url/theme-detail?id=";constructor.URL_WITHOUT_MENU="https://www.swissquote.ch/investment_themes/IThemeDetail.action?id=";constructor.SHARE_IMAGE_URL="https://www.swissquote.ch/investment_themes/images/ithemes/theme_trading_share.png";prototype.getButton=function(){return this.button;};prototype.getUrlWithMenu=function(themeId){return sq.ithemes.SocialButton.URL_WITH_MENU+themeId;};prototype.getUrlWithoutMenu=function(themeId){return sq.ithemes.SocialButton.URL_WITHOUT_MENU+themeId;};prototype.getShareImageUrl=function(){return sq.ithemes.SocialButton.SHARE_IMAGE_URL;};prototype.getName=function(){};},{buttonHandler:"Callback0",button:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.FacebookSocialButton=function(themeDetail){sq.ithemes.SocialButton.call(this);var that=this;this.facebook_url+="u="+encodeURIComponent(this.getUrlWithMenu(themeDetail.getThemeId()));this.facebook_url+="&title="+encodeURIComponent(themeDetail.getTitle());this.facebook_url+="&description="+encodeURIComponent(themeDetail.getShortDescription());this.facebook_url+="&picture="+this.getShareImageUrl();this.buttonHandler=function(){window.open(that.facebook_url,"_blank","location=yes,height=329,width=670,scrollbars=yes,status=yes",false);};this.button.addClass("social-icons__icon--fb");};sq.ithemes.FacebookSocialButton=stjs.extend(sq.ithemes.FacebookSocialButton,sq.ithemes.SocialButton,[],function(constructor,prototype){prototype.facebook_url="http://www.facebook.com/share.php?";prototype.getName=function(){return"Facebook";};},{buttonHandler:"Callback0",button:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.TwitterSocialButton=function(themeDetail){sq.ithemes.SocialButton.call(this);var that=this;this.twitterUrl+="url="+encodeURIComponent(this.getUrlWithoutMenu(themeDetail.getThemeId()));this.twitterUrl+="&text="+encodeURIComponent(themeDetail.getTitle()+": ");this.twitterUrl+="&hashtags=THEMESTRADING";this.buttonHandler=function(){window.open(that.twitterUrl,"_blank","location=yes,height=329,width=670,scrollbars=yes,status=yes",false);};this.button.addClass("social-icons__icon--tw");};sq.ithemes.TwitterSocialButton=stjs.extend(sq.ithemes.TwitterSocialButton,sq.ithemes.SocialButton,[],function(constructor,prototype){prototype.twitterUrl="http://twitter.com/share?";prototype.getName=function(){return"Twitter";};},{buttonHandler:"Callback0",button:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.LinkedInSocialButton=function(themeDetail){sq.ithemes.SocialButton.call(this);var that=this;this.linkedInUrl+="url="+encodeURIComponent(this.getUrlWithMenu(themeDetail.getThemeId()));this.linkedInUrl+="&title="+encodeURIComponent(themeDetail.getTitle());this.linkedInUrl+="&summary="+encodeURIComponent(themeDetail.getShortDescription());this.linkedInUrl+="&mini=true";this.buttonHandler=function(){window.open(that.linkedInUrl,"_blank","location=yes,height=329,width=670,scrollbars=yes,status=yes",false);};this.button.addClass("social-icons__icon--in");};sq.ithemes.LinkedInSocialButton=stjs.extend(sq.ithemes.LinkedInSocialButton,sq.ithemes.SocialButton,[],function(constructor,prototype){prototype.linkedInUrl="http://www.linkedin.com/shareArticle?";prototype.getName=function(){return"LinkedIn";};},{buttonHandler:"Callback0",button:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.SQPulseSocialButton=function(themeDetail){sq.ithemes.SocialButton.call(this);var that=this;this.template=themeDetail.getTitle()+": "+window.location.href+" #THEMESTRADING";this.buttonHandler=function(){localStorage.setItem(sq.ithemes.SQPulseSocialButton.LOCAL_STORAGE_KEY_FOR_SQ_PULSE,that.template);window.open(sq.ithemes.SQPulseSocialButton.SQ_PULSE_URL,"_blank");};this.button.addClass("social-icons__icon--sp");};sq.ithemes.SQPulseSocialButton=stjs.extend(sq.ithemes.SQPulseSocialButton,sq.ithemes.SocialButton,[],function(constructor,prototype){constructor.SQ_PULSE_URL="https://www.swissquote.ch/sqi-now-plugin/index";constructor.LOCAL_STORAGE_KEY_FOR_SQ_PULSE="pulsePostContentTemplate";prototype.template=null;prototype.getName=function(){return"SQPulse";};},{buttonHandler:"Callback0",button:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.MessagesUtil=function(){};sq.ithemes.MessagesUtil=stjs.extend(sq.ithemes.MessagesUtil,null,[],function(constructor,prototype){constructor.i18n=null;constructor.init=function(messages){sq.ithemes.MessagesUtil.i18n=messages;};},{i18n:"sq.ithemes.Messages"},{});
stjs.ns("sq.ithemes");sq.ithemes.SQAnalyticUtil=function(){};sq.ithemes.SQAnalyticUtil=stjs.extend(sq.ithemes.SQAnalyticUtil,null,[],function(constructor,prototype){constructor.initTracking=function(piwikStatsUrl,lang,pageTitle){var trackingOption={siteId:2,title:pageTitle,url:window.location.href,piwikUrl:piwikStatsUrl,language:lang};$(window.document).ready(function(event,element){SQAnalytics.track(trackingOption);sq.ithemes.Console.log(trackingOption);return true;});};constructor.attachEvents=function(elem){SQAnalytics.attachEvents(elem);};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.WebUtil=function(){};sq.ithemes.WebUtil=stjs.extend(sq.ithemes.WebUtil,null,[],function(constructor,prototype){constructor.getCookie=function(cname){var namePrefix=cname+"=";var cookies=(window.document.cookie).split(";");for(var index in cookies){if(!(cookies).hasOwnProperty(index))
continue;var currentCookie=cookies[index].trim();if(currentCookie.startsWith(namePrefix)){return currentCookie.substring(namePrefix.length,currentCookie.length);}}
return"";};constructor.setCookie=function(cname,value){window.document.cookie=cname+"="+value;};constructor.setAutoExpiredCookie=function(cname,value){window.document.cookie=cname+"="+value+";expires="+moment().endOf("day").toString();};constructor.getParameterByName=function(name){var match=new RegExp("[?&]"+name+"=([^&]*)").exec(window.location.search);if(match==null){return null;}
return decodeURIComponent((match[1]).replace(new RegExp("\\+","g")," "));};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.TemplateRenderer=function(){};sq.ithemes.TemplateRenderer=stjs.extend(sq.ithemes.TemplateRenderer,null,[],function(constructor,prototype){constructor.TEMPLATES_SELECTOR="script[type='text/x-handlebars-template']";constructor.render=function(context){$(sq.ithemes.TemplateRenderer.TEMPLATES_SELECTOR).each(function(index,el){var template=Handlebars.compile($(el).html());$(el).parent().append(template(context,{}));$(el).remove();return null;});};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.MarkupUtil=function(){};sq.ithemes.MarkupUtil=stjs.extend(sq.ithemes.MarkupUtil,null,[],function(constructor,prototype){constructor.SIZE_TEXT_CHOOSER_SUFFIX="FontSize";constructor.ID_SELECTOR_PREFIX="#";constructor.CLASS_SELECTOR_PREFIX=".";constructor.DATA_GROUP_TERM_SUFFIX="-term";constructor.DATA_GROUP_RISK_SUFFIX="-risk";constructor.ALL_DROPDOWN_ID="all";constructor.NEWSLETTER_TILE_DATA_GROUP="newsletter-tile";constructor.createIdSelector=function(name){return sq.ithemes.MarkupUtil.ID_SELECTOR_PREFIX+name;};constructor.createClassSelector=function(name){return sq.ithemes.MarkupUtil.CLASS_SELECTOR_PREFIX+name;};constructor.createDiv=function(cssClasses,innerElement){return $(window.document.createElement("div")).addClass(cssClasses).append(innerElement);};constructor.createSpan=function(cssClasses,innerElement){return $(window.document.createElement("span")).addClass(cssClasses).append(innerElement);};constructor.createImg=function(imgSrc){return $(window.document.createElement("img")).attr("src",imgSrc);};constructor.createEmptyUl=function(){return $(window.document.createElement("ul"));};constructor.createEmptyLi=function(){return $(window.document.createElement("li"));};constructor.createEmptyTable=function(){return $(window.document.createElement("table"));};constructor.createEmptyTableHead=function(){return $(window.document.createElement("thead"));};constructor.createEmptyTableBody=function(){return $(window.document.createElement("tbody"));};constructor.createAnchor=function(href,cssClass){return $("<a href='"+href+"' class='"+cssClass+"' />");};constructor.createEmptyTr=function(){return $(window.document.createElement("tr"));};constructor.createTh=function(text){return $(window.document.createElement("th")).text(text);};constructor.createTd=function(text){return $(window.document.createElement("td")).text(text);};constructor.createEmptyTableRow=function(columnCount){var tableRow=sq.ithemes.MarkupUtil.createEmptyTr();for(var i=0;i<columnCount;i++){tableRow.append(sq.ithemes.MarkupUtil.createTd(""));}
return tableRow;};constructor.createSizeTextChooserSelector=function(size){return sq.ithemes.MarkupUtil.createIdSelector(size+sq.ithemes.MarkupUtil.SIZE_TEXT_CHOOSER_SUFFIX);};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.FormatterUtil=function(){};sq.ithemes.FormatterUtil=stjs.extend(sq.ithemes.FormatterUtil,null,[],function(constructor,prototype){constructor.percentNumberFormatter=new PercentNumberFormatter();constructor.abbreviateNumberFormatter=new AbbreviateNumberFormatter();constructor.formatPercentValue=function(value){if(value==null||isNaN(value)){return"- %";}
return sq.ithemes.FormatterUtil.percentNumberFormatter.format(value*100);};constructor.formatPercentWithoutMultiply=function(value){if(value==null||isNaN(value)){return"-";}
return sq.ithemes.FormatterUtil.percentNumberFormatter.format(value);};constructor.formatNumber=function(value){if(value==null||isNaN(value)){return"-";}
return sq.ithemes.FormatterUtil.abbreviateNumberFormatter.format(value);};},{percentNumberFormatter:"PercentNumberFormatter",abbreviateNumberFormatter:"AbbreviateNumberFormatter"},{});
stjs.ns("sq.ithemes");sq.ithemes.Constant=function(){};sq.ithemes.Constant=stjs.extend(sq.ithemes.Constant,null,[],function(constructor,prototype){constructor.THEME_CHART_POINTS="theme_chart_points";constructor.INDEX_POINTS="index_chart_points";constructor.DEBUG=false;constructor.SHUFFLE_SPEED=250;constructor.DELTA_DELAY=50;constructor.SELECTED_THEME="id";constructor.SHOW_GBP_AS_GBX=false;constructor.ATTR_DATA_CREATED="date-created";constructor.ATTR_IS_STRUCTURED="is-structured";constructor.ATTR_DATA_TRENDING="data-trending";constructor.ATTR_DATA_DIVIDEND="data-dividend";constructor.ATTR_DATA_PERFORMANCE="data-performance";constructor.MAX_INTEGER_FIRST=9007199254740991;constructor.MAX_INTEGER_SECOND=9007199254740989;constructor.MAX_DOUBLE_FIRST=9.007199254740991E15;constructor.MAX_DOUBLE_SECOND=9.007199254740989E15;constructor.PIWIK_MAIN_PAGE_TITLE="ThemesTrading ::Themes ::Overview";constructor.PIWIK_DETAIL_PAGE_TITLE="ThemesTrading ::Themes ::Detail";constructor.SQI_PREMIUM_URL="/sqi_premium";},{},{});
stjs.ns("sq.ithemes");sq.ithemes.Console=function(){};sq.ithemes.Console=stjs.extend(sq.ithemes.Console,null,[],function(constructor,prototype){constructor.log=function(_arguments){if(sq.ithemes.Constant.DEBUG){console.log(arguments);}};constructor.error=function(_arguments){if(sq.ithemes.Constant.DEBUG){console.error(arguments);}};constructor.warn=function(_arguments){if(sq.ithemes.Constant.DEBUG){console.warn(arguments);}};constructor.info=function(_arguments){if(sq.ithemes.Constant.DEBUG){console.info(arguments);}};constructor.trace=function(_arguments){if(sq.ithemes.Constant.DEBUG){console.trace(arguments);}};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.RequestHandlerUtil=function(){};sq.ithemes.RequestHandlerUtil=stjs.extend(sq.ithemes.RequestHandlerUtil,null,[],function(constructor,prototype){constructor.getParameterByName=function(name){var match=new RegExp("[?&]"+name+"=([^&]*)").exec(window.location.search);if(match==null){return null;}
return decodeURIComponent((match[1]).replace(new RegExp("\\+","g")," "));};constructor.redirect=function(url){window.location.assign(url);};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.Messages=function(){};sq.ithemes.Messages=stjs.extend(sq.ithemes.Messages,null,[],function(constructor,prototype){prototype.errorWhileLoadingTheThemes=function(){};prototype.errorWhileLoadingTheTheme=function(){};prototype.ourSelection=function(){};prototype.newest=function(){};prototype.trending=function(){};prototype.dividend=function(){};prototype.performance=function(){};prototype.filters=function(){};prototype.viewAllButton=function(){};prototype.selectWhatYouWant=function(){};prototype.onlyThemesWithStructured=function(){};prototype.singularTheme=function(){};prototype.pluralThemes=function(){};prototype.perfTime=function(){};prototype.allCountries=function(){};prototype.tileShortTerm=function(){};prototype.tileMidTerm=function(){};prototype.tileLongTerm=function(){};prototype.tileLowRisk=function(){};prototype.tileMidRisk=function(){};prototype.tileHighRisk=function(){};prototype.sinceInception=function(){};prototype.returnDay=function(){};prototype.dividendYield=function(){};prototype.dateCreated=function(){};prototype.dateUpdated=function(){};prototype.description=function(){};prototype.portfolio=function(){};prototype.buyStructuredProduct=function(){};prototype.name=function(){};prototype.symbol=function(){};prototype.currency=function(){};prototype.price=function(){};prototype.ccy=function(){};prototype.dailyChange=function(){};prototype.weight=function(){};prototype.weightTooltip=function(){};prototype.relatedThemes=function(){};prototype.chart=function(){};prototype.fullQuote=function(){};prototype.trade=function(){};prototype.newsletter=function(){};prototype.subscription=function(){};prototype.subscriptionThankYou=function(){};prototype.placeholder=function(){};prototype.oneMonth=function(){};prototype.close=function(){};prototype.open=function(){};prototype.highLow=function(){};prototype.volume=function(){};prototype.exchange=function(){};prototype.fqDividend=function(){};prototype.dateDividend=function(){};prototype.earning=function(){};prototype.productType=function(){};prototype.callPut=function(){};prototype.strike=function(){};prototype.maturity=function(){};prototype.underlying=function(){};prototype.issuer=function(){};prototype.volatility=function(){};prototype.priceEarning=function(){};prototype.moreInformation=function(){};prototype.multipleUnderlying=function(){};prototype.openEnded=function(){};prototype.warrant=function(){};prototype.otherDerivative=function(){};prototype.termsheet=function(){};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.MessagesEn=function(){};sq.ithemes.MessagesEn=stjs.extend(sq.ithemes.MessagesEn,null,[sq.ithemes.Messages],function(constructor,prototype){prototype.errorWhileLoadingTheThemes=function(){return"Error while loading the themes";};prototype.errorWhileLoadingTheTheme=function(){return"Error while loading the theme";};prototype.ourSelection=function(){return"Our selection";};prototype.newest=function(){return"Newest";};prototype.trending=function(){return"Trending";};prototype.dividend=function(){return"Highest Dividend";};prototype.performance=function(){return"Highest Performance";};prototype.filters=function(){return"Filters";};prototype.viewAllButton=function(){return"All sectors";};prototype.selectWhatYouWant=function(){return"Sectors";};prototype.onlyThemesWithStructured=function(){return"Only themes with structured products";};prototype.singularTheme=function(){return"theme";};prototype.pluralThemes=function(){return"themes";};prototype.perfTime=function(){return"return";};prototype.oneMonth=function(){return"1-month";};prototype.allCountries=function(){return"Countries";};prototype.tileShortTerm=function(){return"SHORT TERM";};prototype.tileMidTerm=function(){return"MID TERM";};prototype.tileLongTerm=function(){return"LONG TERM";};prototype.tileLowRisk=function(){return"LOW RISK";};prototype.tileMidRisk=function(){return"MID RISK";};prototype.tileHighRisk=function(){return"HIGH RISK";};prototype.sinceInception=function(){return"Since Inception";};prototype.returnDay=function(){return"Return day";};prototype.dividendYield=function(){return"Est. dividend yield";};prototype.dateCreated=function(){return"Date created";};prototype.dateUpdated=function(){return"Date updated";};prototype.description=function(){return"Description";};prototype.portfolio=function(){return"Portfolio";};prototype.buyStructuredProduct=function(){return"Buy structured product";};prototype.name=function(){return"Name";};prototype.symbol=function(){return"Symbol";};prototype.currency=function(){return"Currency";};prototype.price=function(){return"Price";};prototype.ccy=function(){return"CCY";};prototype.dailyChange=function(){return"Daily change";};prototype.weight=function(){return"Weight";};prototype.chart=function(){return"Chart";};prototype.fullQuote=function(){return"FullQuote";};prototype.trade=function(){return"Trade";};prototype.relatedThemes=function(){return"Related Themes";};prototype.newsletter=function(){return"Newsletter";};prototype.subscription=function(){return"Subscribe";};prototype.subscriptionThankYou=function(){return"<p>Thank you </p>for subscribing to our newsletter.";};prototype.placeholder=function(){return"name.surname@domain.com";};prototype.termsheet=function(){return"Termsheet";};prototype.close=function(){return"Close";};prototype.open=function(){return"Open";};prototype.highLow=function(){return"High / Low";};prototype.volume=function(){return"Volume";};prototype.exchange=function(){return"Stock Exchange";};prototype.fqDividend=function(){return"Dividend";};prototype.dateDividend=function(){return"Date (dividend)";};prototype.earning=function(){return"Earnings per share";};prototype.productType=function(){return"Product type";};prototype.callPut=function(){return"C/P";};prototype.strike=function(){return"Strike";};prototype.maturity=function(){return"Maturity";};prototype.underlying=function(){return"Underlying";};prototype.issuer=function(){return"Issuer";};prototype.volatility=function(){return"Volatility";};prototype.priceEarning=function(){return"P/E";};prototype.moreInformation=function(){return"More information";};prototype.multipleUnderlying=function(){return"Multi underlying";};prototype.openEnded=function(){return"Open-End";};prototype.warrant=function(){return"Warrant";};prototype.otherDerivative=function(){return"Other Derivative";};prototype.weightTooltip=function(){return"Weight at Inception Each portfolio is built using a market capitalization-weighted average.";};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.MessagesFr=function(){};sq.ithemes.MessagesFr=stjs.extend(sq.ithemes.MessagesFr,null,[sq.ithemes.Messages],function(constructor,prototype){prototype.errorWhileLoadingTheThemes=function(){return"Erreur lors du chargement des th\xe8me";};prototype.errorWhileLoadingTheTheme=function(){return"Erreur lors du chargement des th\xe8me";};prototype.ourSelection=function(){return"Notre choix";};prototype.newest=function(){return"Les plus r\xe9cents";};prototype.trending=function(){return"Trending";};prototype.dividend=function(){return"Dividende le plus \xe9lev\xe9";};prototype.performance=function(){return"Performance la plus \xe9lev\xe9e";};prototype.filters=function(){return"Filtres";};prototype.viewAllButton=function(){return"Tous secteurs";};prototype.selectWhatYouWant=function(){return"Secteurs";};prototype.onlyThemesWithStructured=function(){return"Uniquement th\xe8mes avec des produits structur\xe9s";};prototype.singularTheme=function(){return"th\xe8me";};prototype.pluralThemes=function(){return"th\xe8mes";};prototype.perfTime=function(){return"rendement";};prototype.oneMonth=function(){return"1 mois";};prototype.allCountries=function(){return"Pays";};prototype.tileShortTerm=function(){return"COURT TERME";};prototype.tileMidTerm=function(){return"MOYEN TERME";};prototype.tileLongTerm=function(){return"LONG TERME";};prototype.tileLowRisk=function(){return"risque faible";};prototype.tileMidRisk=function(){return"risque mod\xe9r\xe9";};prototype.tileHighRisk=function(){return"risque \xe9lev\xe9";};prototype.sinceInception=function(){return"Since Inception";};prototype.returnDay=function(){return"Return day";};prototype.dividendYield=function(){return"Est. dividend yield";};prototype.dateCreated=function(){return"Date created";};prototype.dateUpdated=function(){return"Date updated";};prototype.description=function(){return"Description";};prototype.portfolio=function(){return"Portfolio";};prototype.buyStructuredProduct=function(){return"Acheter produit structur\xe9";};prototype.name=function(){return"Nom";};prototype.symbol=function(){return"Symbole";};prototype.currency=function(){return"Devise";};prototype.price=function(){return"Prix";};prototype.ccy=function(){return"CCY";};prototype.dailyChange=function(){return"Variation journali\xe8re";};prototype.weight=function(){return"Pond\xe9ration";};prototype.chart=function(){return"Graphique";};prototype.fullQuote=function(){return"Cotation compl\xe8te";};prototype.trade=function(){return"Trade";};prototype.weightTooltip=function(){return"Pond\xe9ration lors du lancement Chaque portefeuille est cr\xe9\xe9 en utilisant la moyenne pond\xe9r\xe9e de capitalisation boursi\xe8re.";};prototype.relatedThemes=function(){return"Related Themes";};prototype.newsletter=function(){return"Newsletter";};prototype.subscription=function(){return"Souscrire";};prototype.subscriptionThankYou=function(){return"<p>Nous vous remercions</p> de votre inscription \xe0 notre newsletter.";};prototype.placeholder=function(){return"pr\xe9nom.nom@domain.com";};prototype.termsheet=function(){return"Termsheet";};prototype.close=function(){return"Cl\xf4ture";};prototype.open=function(){return"Ouverture";};prototype.highLow=function(){return"Haut/Bas";};prototype.volume=function(){return"Volume";};prototype.exchange=function(){return"March\xe9 financier";};prototype.fqDividend=function(){return"Dividende";};prototype.dateDividend=function(){return"Date (dividende)";};prototype.earning=function(){return"Revenus par action";};prototype.productType=function(){return"Type de produit";};prototype.callPut=function(){return"C/P";};prototype.strike=function(){return"Prix d'exercice";};prototype.maturity=function(){return"\xc9ch\xe9ance";};prototype.underlying=function(){return"Sous-jacent";};prototype.issuer=function(){return"\xc9metteur";};prototype.volatility=function(){return"Volatilit\xe9";};prototype.priceEarning=function(){return"P/E";};prototype.moreInformation=function(){return"Plus d\u2019informations";};prototype.multipleUnderlying=function(){return"Sous-jacents multiples";};prototype.openEnded=function(){return"Sans fin";};prototype.warrant=function(){return"Warrant";};prototype.otherDerivative=function(){return"Other Derivative";};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.MessagesDe=function(){};sq.ithemes.MessagesDe=stjs.extend(sq.ithemes.MessagesDe,null,[sq.ithemes.Messages],function(constructor,prototype){prototype.errorWhileLoadingTheThemes=function(){return"Fehler beim Laden der Themen";};prototype.errorWhileLoadingTheTheme=function(){return"Fehler beim Laden der Thema";};prototype.ourSelection=function(){return"Unsere Wahl";};prototype.newest=function(){return"Neueste";};prototype.trending=function(){return"Trending";};prototype.dividend=function(){return"H\xf6chste Dividende";};prototype.performance=function(){return"H\xf6chste Performance";};prototype.filters=function(){return"Filter";};prototype.viewAllButton=function(){return"Alle Sektoren";};prototype.selectWhatYouWant=function(){return"Sektoren";};prototype.onlyThemesWithStructured=function(){return"Nur Themen mit Strukturierten Produkten";};prototype.singularTheme=function(){return"Thema";};prototype.pluralThemes=function(){return"Themen";};prototype.perfTime=function(){return"Rendite";};prototype.oneMonth=function(){return"1-Monats-";};prototype.allCountries=function(){return"Land";};prototype.tileShortTerm=function(){return"SHORT TERM";};prototype.tileMidTerm=function(){return"MID TERM";};prototype.tileLongTerm=function(){return"LONG TERM";};prototype.tileLowRisk=function(){return"Geringes Risiko";};prototype.tileMidRisk=function(){return"Mittleres Risiko";};prototype.tileHighRisk=function(){return"Hohes Risiko";};prototype.sinceInception=function(){return"Since Inception";};prototype.returnDay=function(){return"Return day";};prototype.dividendYield=function(){return"Est. dividend yield";};prototype.dateCreated=function(){return"Date created";};prototype.dateUpdated=function(){return"Date updated";};prototype.description=function(){return"Description";};prototype.portfolio=function(){return"Portfolio";};prototype.buyStructuredProduct=function(){return"Strukturierte Produkte kaufen";};prototype.name=function(){return"Name";};prototype.price=function(){return"Kurs";};prototype.ccy=function(){return"CCY";};prototype.dailyChange=function(){return"Tagesver\xe4nderung";};prototype.weight=function(){return"Gewichtung";};prototype.chart=function(){return"Chart";};prototype.fullQuote=function(){return"Kursangaben";};prototype.trade=function(){return"Trade";};prototype.weightTooltip=function(){return"Gewichtung bei Auflegung Jedes Portfolio wird mit einer durchschnittlichen Marktkapitalisierung gewichtet.";};prototype.relatedThemes=function(){return"Related Themes";};prototype.newsletter=function(){return"Newsletter";};prototype.subscription=function(){return"Anmelden";};prototype.subscriptionThankYou=function(){return"<p>Vielen Dank </p>f\xfcr die Anmeldung zu unserem Newsletter.";};prototype.placeholder=function(){return"vorname.nachname@domain.com";};prototype.termsheet=function(){return"Termsheet";};prototype.close=function(){return"Schlusskurs";};prototype.open=function(){return"Er\xf6ffnungskurs";};prototype.highLow=function(){return"Hoch / Tief";};prototype.volume=function(){return"Volumen";};prototype.exchange=function(){return"B\xf6rse";};prototype.fqDividend=function(){return"Dividende";};prototype.dateDividend=function(){return"Datum (dividende)";};prototype.earning=function(){return"Gewinn pro Aktie";};prototype.productType=function(){return"Produkttyp";};prototype.callPut=function(){return"B/P";};prototype.strike=function(){return"Strike";};prototype.maturity=function(){return"F\xe4lligkeit";};prototype.underlying=function(){return"Basiswert";};prototype.issuer=function(){return"Emittent";};prototype.volatility=function(){return"Volatilit\xe4t";};prototype.priceEarning=function(){return"KGV";};prototype.moreInformation=function(){return"Mehr Informationen";};prototype.symbol=function(){return"Symbol";};prototype.currency=function(){return"W\xe4hrung";};prototype.multipleUnderlying=function(){return"Multi-Basiswert";};prototype.openEnded=function(){return"Ohne Ende";};prototype.warrant=function(){return"Warrant";};prototype.otherDerivative=function(){return"Other Derivative";};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeTile=function(investmentTheme,investmentThemes,categoriesMap){this.investmentThemes=investmentThemes;if(investmentTheme!=null&&investmentTheme!=undefined){var title=$("<div class='name'></div>");title.html(investmentTheme.getTitle());var desc=sq.ithemes.MarkupUtil.createDiv("desc",null);desc.html(investmentTheme.getShortDescription());var tags=sq.ithemes.MarkupUtil.createDiv("tags",null);this.buildCategoriesSection(tags,investmentTheme,categoriesMap);var termAndRiskDiv=this.buildTermAndRiskDiv(investmentTheme);var perfDiv=this.buildPerfDiv(investmentTheme);var href="/investment_themes/IThemeDetail.action?id="+investmentTheme.getThemeId();this.container=sq.ithemes.MarkupUtil.createAnchor(href,"shuffle-item");this.container.data("theme-id",investmentTheme.getThemeId()).attr("data-"+sq.ithemes.Constant.ATTR_DATA_CREATED,moment(investmentTheme.getCreationDate()).format()).attr("data-"+sq.ithemes.Constant.ATTR_DATA_TRENDING,investmentTheme.getTrending()).attr("data-"+sq.ithemes.Constant.ATTR_DATA_DIVIDEND,investmentTheme.getDividendYield()).attr("data-"+sq.ithemes.Constant.ATTR_DATA_PERFORMANCE,investmentTheme.getSlidingMonthPerformance()).attr("data-analytics","track:event, category:Themes Overview, action:Clicked tile, name: Tile - "+investmentTheme.getTitleForPiwik()).attr("data-content-name","Tile - "+investmentTheme.getTitleForPiwik()).attr("data-content-target",href).attr("data-track-content","").attr("data-content-ignoreinteraction","");var tileSize=sq.ithemes.ThemeSizeUtil.findThemeSize(investmentTheme.getLargeTile());if(sq.ithemes.ThemeSize.BIG.equals(tileSize)){this.container.addClass("big-tile");if(investmentTheme.getImageUrl()!=null&&investmentTheme.getImageUrl()!=""){this.container.css("background-image","url("+investmentTheme.getImageUrl()+")");}}else{this.container.addClass("tile");}
var isStructuredAvailable=false;if(investmentTheme.getStructuredProduct()!=null){isStructuredAvailable=true;this.container.append($("<div class='structured-container'><mark class='structured-container__label'>"+investmentThemes.i18n.buyStructuredProduct()+"</mark></div>"));}
this.container.attr("data-"+sq.ithemes.Constant.ATTR_IS_STRUCTURED,isStructuredAvailable);this.container.append(title).append(tags).append(desc).append(termAndRiskDiv).append(perfDiv);var mainCategory=categoriesMap[investmentTheme.getMainCategory()];if(mainCategory!=null&&mainCategory!=undefined){this.container.css("background-color",mainCategory.getColor());}else{this.container.css("background","repeating-linear-gradient(-55deg,#222,#222 10px,#333 10px,#333 20px)");}
this.addDataGroups(investmentTheme,categoriesMap);}};sq.ithemes.ThemeTile=stjs.extend(sq.ithemes.ThemeTile,null,[],function(constructor,prototype){prototype.container=null;prototype.investmentThemes=null;prototype.buildTermAndRiskDiv=function(investmentTheme){var termAndRiskDiv=sq.ithemes.MarkupUtil.createDiv("risk-level",null);var riskSpan=$("<span class='risk'></span>");var termSpan=$("<span class='term'></span>");var themeRisk=sq.ithemes.ThemeRiskUtil.fromCode(investmentTheme.getRisk());var themeTerm=sq.ithemes.ThemeTermUtil.fromCode(investmentTheme.getTerm());riskSpan.html(sq.ithemes.ThemeRiskUtil.getLabel(themeRisk,this.investmentThemes.i18n));riskSpan.addClass(themeRisk.name().toLowerCase());termSpan.addClass(themeTerm.name().toLowerCase());termSpan.html(sq.ithemes.ThemeTermUtil.getLabel(themeTerm,this.investmentThemes.i18n));termAndRiskDiv.append(termSpan);termAndRiskDiv.append(riskSpan);return termAndRiskDiv;};prototype.buildPerfDiv=function(investmentTheme){var perfDiv=sq.ithemes.MarkupUtil.createDiv("perf",null);var performance=investmentTheme.getDisplayPerformance();var perfValue=sq.ithemes.MarkupUtil.createDiv("perf__value",null);if(performance!=null&&performance!=undefined){if(performance<0){perfValue.addClass("down");}else if(performance>0){perfValue.addClass("up");}
perfValue.html(sq.ithemes.FormatterUtil.formatPercentValue(performance));}else{perfValue.html("-%");}
perfDiv.append(perfValue);var perfTime=sq.ithemes.MarkupUtil.createDiv("perf__time",null);var perfTimeTextClass="fr".equals(this.investmentThemes.getiThemesDataStorage().getLanguage())?"perf__time__text fr":"perf__time__text";var perfTimeText=sq.ithemes.MarkupUtil.createSpan(perfTimeTextClass,null);perfTime.append(this.investmentThemes.i18n.oneMonth());perfTime.append("<br>");perfTimeText.html(this.investmentThemes.i18n.perfTime());perfTime.append(perfTimeText);perfDiv.append(perfTime);return perfDiv;};prototype.buildCategoriesSection=function(tags,investmentTheme,categoriesMap){var bulSeparator=sq.ithemes.MarkupUtil.createSpan("bul",null);bulSeparator.html("&bull;");var categoryTextClass="tags__text";var category=categoriesMap[investmentTheme.getMainCategory()];if(category!=null&&category!=undefined){tags.append(sq.ithemes.MarkupUtil.createSpan(categoryTextClass,null).html(category.getName()));}
category=categoriesMap[investmentTheme.getSecondCategory()];if(category!=null&&category!=undefined){tags.append(bulSeparator.clone());tags.append(sq.ithemes.MarkupUtil.createSpan(categoryTextClass,null).html(category.getName()));}
category=categoriesMap[investmentTheme.getThirdCategory()];if(category!=null&&category!=undefined){tags.append(bulSeparator.clone());tags.append(sq.ithemes.MarkupUtil.createSpan(categoryTextClass,null).html(category.getName()));}};prototype.addDataGroups=function(investmentTheme,categoriesMap){var datagroupsString="[";var category=categoriesMap[investmentTheme.getMainCategory()];if(category!=null&&category!=undefined){datagroupsString+="\""+category.getName()+"\"";}
category=categoriesMap[investmentTheme.getSecondCategory()];if(category!=null&&category!=undefined){datagroupsString+=",\""+category.getName()+"\"";}
category=categoriesMap[investmentTheme.getThirdCategory()];if(category!=null&&category!=undefined){datagroupsString+=",\""+category.getName()+"\"";}
var risk=sq.ithemes.ThemeRiskUtil.fromCode(investmentTheme.getRisk());if(sq.ithemes.ThemeRisk.Unknown!=risk){datagroupsString+=",\""+risk.name().toLowerCase()+sq.ithemes.MarkupUtil.DATA_GROUP_RISK_SUFFIX+"\" ";}
var term=sq.ithemes.ThemeTermUtil.fromCode(investmentTheme.getTerm());if(sq.ithemes.ThemeTerm.Unknown!=term){datagroupsString+=",\""+term.toString().toLowerCase()+sq.ithemes.MarkupUtil.DATA_GROUP_TERM_SUFFIX+"\" ";}
var geoZone=sq.ithemes.MarketZoneUtil.findMarketZone(investmentTheme.getGeographicalZone());if(sq.ithemes.MarketZone.Unknown!=geoZone){datagroupsString+=",\""+geoZone.toString().toLowerCase()+"\" ";}
datagroupsString+="]";this.container.attr("data-groups",datagroupsString);};prototype.getContainer=function(){return this.container;};},{container:"sq.ithemes.IThemesJQuery",investmentThemes:"sq.ithemes.InvestmentThemes"},{});
stjs.ns("sq.ithemes");sq.ithemes.LayoutManager=function(iThemes){var shuffleOptions={};shuffleOptions["itemSelector"]=".shuffle-item";shuffleOptions["speed"]=sq.ithemes.Constant.SHUFFLE_SPEED;shuffleOptions["gutterWidth"]=6;var container=$(".themes-tiles-content");this.shuffleEngine=new sq.ithemes.ShuffleEngine(shuffleOptions,container,this);this.mainPageView=new sq.ithemes.MainPageView(iThemes);this.pageUp=$(".page-up");this.noResults=$(".no-results");};sq.ithemes.LayoutManager=stjs.extend(sq.ithemes.LayoutManager,null,[],function(constructor,prototype){prototype.mainPageView=null;prototype.detailPageView=null;prototype.shuffleEngine=null;prototype.pageUp=null;prototype.noResults=null;constructor.ACTIVE_CLASS="is-active";prototype.getShuffleEngine=function(){return this.shuffleEngine;};prototype.initThemes=function(themes,categoriesMap){this.mainPageView.initFilters(categoriesMap);this.mainPageView.initThemes(themes,categoriesMap);this.shuffleEngine.shuffle(true);this.showPageUpButton();this.pageUp.children().click(stjs.bind(this,function(ev,THIS){var options={};options.duration=600;$("body, html").animate({"scrollTop":"0"},options);return false;},1));};prototype.initThemeDetail=function(theme){this.detailPageView.initTheme(theme);};prototype.refreshTilesNumber=function(tilesNumber){this.mainPageView.refreshTilesNumber(tilesNumber);return this;};prototype.showNoResultsPage=function(tilesNumber){this.noResults.toggleClass(sq.ithemes.LayoutManager.ACTIVE_CLASS,tilesNumber==0);return this;};prototype.showPageUpButton=function(){this.pageUp.toggleClass(sq.ithemes.LayoutManager.ACTIVE_CLASS,document.body.scrollHeight>document.body.offsetHeight);};},{mainPageView:"sq.ithemes.MainPageView",detailPageView:"sq.ithemes.DetailPageView",shuffleEngine:"sq.ithemes.ShuffleEngine",pageUp:"sq.ithemes.IThemesJQuery",noResults:"sq.ithemes.IThemesJQuery"},{});
stjs.ns("sq.ithemes");sq.ithemes.StockKey=function(isin,exchangeId,currency){this.isin=isin;this.exchangeId=exchangeId;this.currency=currency;};sq.ithemes.StockKey=stjs.extend(sq.ithemes.StockKey,null,[],function(constructor,prototype){prototype.isin=null;prototype.exchangeId=null;prototype.currency=null;prototype.getIsin=function(){return this.isin;};prototype.getExchangeId=function(){return this.exchangeId;};prototype.getCurrency=function(){return this.currency;};prototype.toString=function(){return this.isin+"_"+this.exchangeId+"_"+this.currency;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.SecurityType=stjs.enumeration("SHARE","ETF","INDEX","OPTION","OPTION_ON_FUTURE","FUTURE","CURRENCY","COMMODITY","WARRANT","OTHER_DERIVATIVE","FUND","BOND","UNKNOWN");
stjs.ns("sq.ithemes");sq.ithemes.InvestmentTheme=function(){};sq.ithemes.InvestmentTheme=stjs.extend(sq.ithemes.InvestmentTheme,null,[],function(constructor,prototype){prototype.themeId=null;prototype.title=null;prototype.shortDescription=null;prototype.longDescription=null;prototype.creationDate=null;prototype.modificationDate=null;prototype.mainCategory=null;prototype.secondCategory=null;prototype.thirdCategory=null;prototype.status=null;prototype.risk=null;prototype.term=null;prototype.geographicalZone=null;prototype.imageUrl=null;prototype.largeTile=null;prototype.dailyPerformance=null;prototype.slidingMonthPerformance=null;prototype.slidingQuarterPerformance=null;prototype.slidingHalfyearPerformance=null;prototype.slidingYearPerformance=null;prototype.overallPerformance=null;prototype.promoted=null;prototype.structuredProduct=null;prototype.trending=null;prototype.dividendYield=null;prototype.titleForPiwik=null;prototype.isPromoted=function(){return this.promoted;};prototype.setPromoted=function(promoted){this.promoted=promoted;};prototype.getStructuredProduct=function(){return this.structuredProduct;};prototype.setStructuredProduct=function(structuredProduct){this.structuredProduct=structuredProduct;};prototype.getDisplayPerformance=function(){return this.slidingMonthPerformance==null?this.overallPerformance:this.slidingMonthPerformance;};prototype.getThemeId=function(){return this.themeId;};prototype.setThemeId=function(themeId){this.themeId=themeId;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getShortDescription=function(){return this.shortDescription;};prototype.setShortDescription=function(shortDescription){this.shortDescription=shortDescription;};prototype.getLongDescription=function(){return this.longDescription;};prototype.setLongDescription=function(longDescription){this.longDescription=longDescription;};prototype.getCreationDate=function(){return this.creationDate;};prototype.setCreationDate=function(creationDate){this.creationDate=creationDate;};prototype.getModificationDate=function(){return this.modificationDate;};prototype.setModificationDate=function(modificationDate){this.modificationDate=modificationDate;};prototype.getStatus=function(){return this.status;};prototype.setStatus=function(status){this.status=status;};prototype.getRisk=function(){return this.risk;};prototype.setRisk=function(risk){this.risk=risk;};prototype.getTerm=function(){return this.term;};prototype.setTerm=function(term){this.term=term;};prototype.getGeographicalZone=function(){return this.geographicalZone;};prototype.setGeographicalZone=function(geographicalZone){this.geographicalZone=geographicalZone;};prototype.getImageUrl=function(){return this.imageUrl;};prototype.setImageUrl=function(imageUrl){this.imageUrl=imageUrl;};prototype.getLargeTile=function(){return this.largeTile;};prototype.setLargeTile=function(largeTile){this.largeTile=largeTile;};prototype.getDailyPerformance=function(){return this.dailyPerformance;};prototype.setDailyPerformance=function(dailyPerformance){this.dailyPerformance=dailyPerformance;};prototype.getMainCategory=function(){return this.mainCategory;};prototype.setMainCategory=function(mainCategory){this.mainCategory=mainCategory;};prototype.getSecondCategory=function(){return this.secondCategory;};prototype.setSecondCategory=function(secondCategory){this.secondCategory=secondCategory;};prototype.getThirdCategory=function(){return this.thirdCategory;};prototype.setThirdCategory=function(thirdCategory){this.thirdCategory=thirdCategory;};prototype.getOverallPerformance=function(){return this.overallPerformance;};prototype.setOverallPerformance=function(overallPerformance){this.overallPerformance=overallPerformance;};prototype.getSlidingMonthPerformance=function(){return this.slidingMonthPerformance;};prototype.setSlidingMonthPerformance=function(slidingMonthPerformance){this.slidingMonthPerformance=slidingMonthPerformance;};prototype.getSlidingQuarterPerformance=function(){return this.slidingQuarterPerformance;};prototype.setSlidingQuarterPerformance=function(slidingQuarterPerformance){this.slidingQuarterPerformance=slidingQuarterPerformance;};prototype.getSlidingHalfyearPerformance=function(){return this.slidingHalfyearPerformance;};prototype.setSlidingHalfyearPerformance=function(slidingHalfyearPerformance){this.slidingHalfyearPerformance=slidingHalfyearPerformance;};prototype.getSlidingYearPerformance=function(){return this.slidingYearPerformance;};prototype.setSlidingYearPerformance=function(slidingYearPerformance){this.slidingYearPerformance=slidingYearPerformance;};prototype.getTitleForPiwik=function(){return this.titleForPiwik;};prototype.setTitleForPiwik=function(titleForPiwik){this.titleForPiwik=titleForPiwik;};prototype.getTrending=function(){return this.trending;};prototype.setTrending=function(trending){this.trending=trending;};prototype.getDividendYield=function(){return this.dividendYield;};prototype.setDividendYield=function(dividendYield){this.dividendYield=(dividendYield!=null)?dividendYield:0.0;};},{creationDate:"Date",modificationDate:"Date",structuredProduct:"sq.ithemes.ThemeQuote"},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeDetail=function(){};sq.ithemes.ThemeDetail=stjs.extend(sq.ithemes.ThemeDetail,null,[],function(constructor,prototype){prototype.themeId=null;prototype.title=null;prototype.shortDescription=null;prototype.longDescription=null;prototype.creationDate=null;prototype.modificationDate=null;prototype.inceptionDate=null;prototype.mainCategory=null;prototype.secondCategory=null;prototype.thirdCategory=null;prototype.status=null;prototype.risk=null;prototype.term=null;prototype.geographicalZone=null;prototype.imageUrl=null;prototype.largeTile=null;prototype.dailyPerformance=null;prototype.slidingMonthPerformance=null;prototype.slidingQuarterPerformance=null;prototype.slidingHalfyearPerformance=null;prototype.slidingYearPerformance=null;prototype.overallPerformance=null;prototype.dividendYield=null;prototype.displayPerformance=null;prototype.portfolio=null;prototype.structuredProduct=null;prototype.index=null;prototype.nameMainThemeCategory=null;prototype.nameSecondThemeCategory=null;prototype.nameThirdThemeCategory=null;prototype.color=null;prototype.riskClass=null;prototype.termClass=null;prototype.riskText=null;prototype.termText=null;prototype.relatedThemes=null;prototype.performanceHistos=null;prototype.trending=null;prototype.titleForPiwik=null;prototype.performanceCurrency=null;prototype.performanceBasedOnStructuredProduct=null;prototype.getIndex=function(){return this.index;};prototype.setIndex=function(index){this.index=index;};prototype.getThemeId=function(){return this.themeId;};prototype.setThemeId=function(themeId){this.themeId=themeId;};prototype.getTitle=function(){return this.title;};prototype.setTitle=function(title){this.title=title;};prototype.getShortDescription=function(){return this.shortDescription;};prototype.setShortDescription=function(shortDescription){this.shortDescription=shortDescription;};prototype.getLongDescription=function(){return this.longDescription;};prototype.setLongDescription=function(longDescription){this.longDescription=longDescription;};prototype.getCreationDate=function(){return this.creationDate;};prototype.setCreationDate=function(creationDate){this.creationDate=creationDate;};prototype.getModificationDate=function(){return this.modificationDate;};prototype.setModificationDate=function(modificationDate){this.modificationDate=modificationDate;};prototype.getStatus=function(){return this.status;};prototype.setStatus=function(status){this.status=status;};prototype.getRisk=function(){return this.risk;};prototype.setRisk=function(risk){this.risk=risk;};prototype.getTerm=function(){return this.term;};prototype.setTerm=function(term){this.term=term;};prototype.getGeographicalZone=function(){return this.geographicalZone;};prototype.setGeographicalZone=function(geographicalZone){this.geographicalZone=geographicalZone;};prototype.getImageUrl=function(){return this.imageUrl;};prototype.setImageUrl=function(imageUrl){this.imageUrl=imageUrl;};prototype.getLargeTile=function(){return this.largeTile;};prototype.setLargeTile=function(largeTile){this.largeTile=largeTile;};prototype.getDailyPerformance=function(){return this.dailyPerformance;};prototype.setDailyPerformance=function(dailyPerformance){this.dailyPerformance=dailyPerformance;};prototype.getOverallPerformance=function(){return this.overallPerformance;};prototype.setOverallPerformance=function(overallPerformance){this.overallPerformance=overallPerformance;};prototype.getMainCategory=function(){return this.mainCategory;};prototype.setMainCategory=function(mainCategory){this.mainCategory=mainCategory;};prototype.getSecondCategory=function(){return this.secondCategory;};prototype.setSecondCategory=function(secondCategory){this.secondCategory=secondCategory;};prototype.getThirdCategory=function(){return this.thirdCategory;};prototype.setThirdCategory=function(thirdCategory){this.thirdCategory=thirdCategory;};prototype.getNameMainThemeCategory=function(){return this.nameMainThemeCategory;};prototype.setNameMainThemeCategory=function(nameMainThemeCategory){this.nameMainThemeCategory=nameMainThemeCategory;};prototype.getNameSecondThemeCategory=function(){return this.nameSecondThemeCategory;};prototype.setNameSecondThemeCategory=function(nameSecondThemeCategory){this.nameSecondThemeCategory=nameSecondThemeCategory;};prototype.getNameThirdThemeCategory=function(){return this.nameThirdThemeCategory;};prototype.setNameThirdThemeCategory=function(nameThirdThemeCategory){this.nameThirdThemeCategory=nameThirdThemeCategory;};prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getPortfolio=function(){return this.portfolio;};prototype.setPortfolio=function(portfolio){this.portfolio=portfolio;};prototype.getStructuredProduct=function(){return this.structuredProduct;};prototype.setStructuredProduct=function(structuredProduct){this.structuredProduct=structuredProduct;};prototype.getRelatedThemes=function(){return this.relatedThemes;};prototype.setRelatedThemes=function(relatedThemes){this.relatedThemes=relatedThemes;};prototype.getRiskClass=function(){return this.riskClass;};prototype.setRiskClass=function(riskClass){this.riskClass=riskClass;};prototype.getTermClass=function(){return this.termClass;};prototype.setTermClass=function(termClass){this.termClass=termClass;};prototype.getRiskText=function(){return this.riskText;};prototype.setRiskText=function(riskText){this.riskText=riskText;};prototype.getTermText=function(){return this.termText;};prototype.setTermText=function(termText){this.termText=termText;};prototype.getPerformanceHistos=function(){return this.performanceHistos;};prototype.setPerformanceHistos=function(performanceHistos){this.performanceHistos=performanceHistos;};prototype.getDividendYield=function(){return this.dividendYield;};prototype.setDividendYield=function(dividendYield){this.dividendYield=dividendYield;};prototype.getSlidingMonthPerformance=function(){return this.slidingMonthPerformance;};prototype.setSlidingMonthPerformance=function(slidingMonthPerformance){this.slidingMonthPerformance=slidingMonthPerformance;};prototype.getSlidingQuarterPerformance=function(){return this.slidingQuarterPerformance;};prototype.setSlidingQuarterPerformance=function(slidingQuarterPerformance){this.slidingQuarterPerformance=slidingQuarterPerformance;};prototype.getSlidingHalfyearPerformance=function(){return this.slidingHalfyearPerformance;};prototype.setSlidingHalfyearPerformance=function(slidingHalfyearPerformance){this.slidingHalfyearPerformance=slidingHalfyearPerformance;};prototype.getSlidingYearPerformance=function(){return this.slidingYearPerformance;};prototype.setSlidingYearPerformance=function(slidingYearPerformance){this.slidingYearPerformance=slidingYearPerformance;};prototype.getDisplayPerformance=function(){return this.displayPerformance;};prototype.setDisplayPerformance=function(displayPerformance){this.displayPerformance=displayPerformance;};prototype.getInceptionDate=function(){return this.inceptionDate;};prototype.setInceptionDate=function(inceptionDate){this.inceptionDate=inceptionDate;};prototype.getTrending=function(){return this.trending;};prototype.setTrending=function(trending){this.trending=trending;};prototype.getTitleForPiwik=function(){return this.titleForPiwik;};prototype.setTitleForPiwik=function(titleForPiwik){this.titleForPiwik=titleForPiwik;};prototype.getPerformanceCurrency=function(){return this.performanceCurrency;};prototype.setPerformanceCurrency=function(performanceCurrency){this.performanceCurrency=performanceCurrency;};prototype.isPerformanceBasedOnStructuredProduct=function(){return this.performanceBasedOnStructuredProduct;};prototype.setPerformanceBasedOnStructuredProduct=function(performanceBasedOnStructuredProduct){this.performanceBasedOnStructuredProduct=performanceBasedOnStructuredProduct;};},{creationDate:"Date",modificationDate:"Date",inceptionDate:"Date",portfolio:{name:"Array",arguments:["sq.ithemes.ThemeQuote"]},structuredProduct:"sq.ithemes.ThemeQuote",index:"sq.ithemes.ThemeQuote",relatedThemes:{name:"Array",arguments:["sq.ithemes.ThemeDetail"]},performanceHistos:{name:"Array",arguments:["sq.ithemes.ThemePerformanceHisto"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeCategory=function(){};sq.ithemes.ThemeCategory=stjs.extend(sq.ithemes.ThemeCategory,null,[],function(constructor,prototype){prototype.color=null;prototype.id=null;prototype.name=null;prototype.nameForPiwik=null;prototype.getColor=function(){return this.color;};prototype.setColor=function(color){this.color=color;};prototype.getId=function(){return this.id;};prototype.setId=function(id){this.id=id;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getNameForPiwik=function(){return this.nameForPiwik;};prototype.setNameForPiwik=function(nameForPiwik){this.nameForPiwik=nameForPiwik;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeDetailsDataStorage=function(iThemeDetail){this.iThemeDetail=iThemeDetail;this.cache=Cache.getInstance();};sq.ithemes.ThemeDetailsDataStorage=stjs.extend(sq.ithemes.ThemeDetailsDataStorage,null,[],function(constructor,prototype){prototype.language=null;prototype.themeId=null;prototype.handlebarsContext=null;prototype.iThemeDetail=null;prototype.themeDetail=null;prototype.cache=null;prototype.updateThemeDetails=function(themeDetail){if(themeDetail==null||themeDetail==undefined){sq.ithemes.Console.log("No details for theme!");return;}
this.themeDetail=themeDetail;this.handlebarsContext={};this.handlebarsContext["themeDetail"]=themeDetail;this.registerI18n();this.i18nRelatedThemes(themeDetail.getRelatedThemes());this.handlebarsContext["relatedThemes"]=themeDetail.getRelatedThemes();};prototype.i18nRelatedThemes=function(relatedThemes){if(relatedThemes!=null&&relatedThemes!=undefined){for(var i=0;i<relatedThemes.length;i++){var relatedTheme=relatedThemes[i];relatedTheme.setRiskClass(sq.ithemes.ThemeRiskUtil.fromCode(relatedTheme.getRisk()).name().toLowerCase());relatedTheme.setTermClass(sq.ithemes.ThemeTermUtil.fromCode(relatedTheme.getTerm()).name().toLowerCase());relatedTheme.setRiskText(sq.ithemes.ThemeRiskUtil.getLabelFromCode(relatedTheme.getRisk(),this.iThemeDetail.constructor.i18n));relatedTheme.setTermText(sq.ithemes.ThemeTermUtil.getLabelFromCode(relatedTheme.getTerm(),this.iThemeDetail.constructor.i18n));}}};prototype.registerI18n=function(){this.handlebarsContext["i18n_sinceInception"]=this.iThemeDetail.constructor.i18n.sinceInception();this.handlebarsContext["i18n_returnDay"]=this.iThemeDetail.constructor.i18n.returnDay();this.handlebarsContext["i18n_dividendYield"]=this.iThemeDetail.constructor.i18n.dividendYield();this.handlebarsContext["i18n_dateCreated"]=this.iThemeDetail.constructor.i18n.dateCreated();this.handlebarsContext["i18n_dateUpdated"]=this.iThemeDetail.constructor.i18n.dateUpdated();this.handlebarsContext["i18n_description"]=this.iThemeDetail.constructor.i18n.description();this.handlebarsContext["i18n_portfolio"]=this.iThemeDetail.constructor.i18n.portfolio();this.handlebarsContext["i18n_structuredProduct"]=this.iThemeDetail.constructor.i18n.buyStructuredProduct();this.handlebarsContext["i18n_name"]=this.iThemeDetail.constructor.i18n.name();this.handlebarsContext["i18n_price"]=this.iThemeDetail.constructor.i18n.price();this.handlebarsContext["i18n_ccy"]=this.iThemeDetail.constructor.i18n.ccy();this.handlebarsContext["i18n_dailyChange"]=this.iThemeDetail.constructor.i18n.dailyChange();this.handlebarsContext["i18n_weight"]=this.iThemeDetail.constructor.i18n.weight();this.handlebarsContext["i18n_relatedThemes"]=this.iThemeDetail.constructor.i18n.relatedThemes();};prototype.updateThemeStructuredProduct=function(themeQuoteMap){if(themeQuoteMap==null||themeQuoteMap==undefined){if(sq.ithemes.Constant.DEBUG){console.log("No details for theme!");}
return;}
var structuredProduct=this.themeDetail.getStructuredProduct();if(structuredProduct==null||structuredProduct==undefined){return;}
this.updateThemeQuote(structuredProduct,themeQuoteMap);this.handlebarsContext["structuredProduct"]=this.themeDetail.getStructuredProduct();};prototype.updateThemePortfolio=function(themeQuoteMap){if(themeQuoteMap==null||themeQuoteMap==undefined){if(sq.ithemes.Constant.DEBUG){console.log("No details for theme!");}
return;}
if(this.themeDetail.getPortfolio()!=null&&this.themeDetail.getPortfolio()!=undefined){for(var i=0;i<this.themeDetail.getPortfolio().length;i++){this.updateThemeQuote(this.themeDetail.getPortfolio()[i],themeQuoteMap);}}
this.handlebarsContext["quote"]=this.themeDetail.getPortfolio();};prototype.getLanguage=function(){return this.language;};prototype.setLanguage=function(language){this.language=language;};prototype.getThemeId=function(){return this.themeId;};prototype.setThemeId=function(themeId){this.themeId=themeId;};prototype.getHandleBarContext=function(){return this.handlebarsContext;};prototype.setHandleBarContext=function(handleBarContext){this.handlebarsContext=handleBarContext;};prototype.getThemeDetail=function(){return this.themeDetail;};prototype.setThemeDetail=function(themeDetail){this.themeDetail=themeDetail;};prototype.getCache=function(){return this.cache;};prototype.setCache=function(cache){this.cache=cache;};prototype.getiThemeDetail=function(){return this.iThemeDetail;};prototype.setiThemeDetail=function(iThemeDetail){this.iThemeDetail=iThemeDetail;};prototype.updateThemeQuote=function(themeQuote,themeQuoteMap){var fromThemeQuote=themeQuoteMap[themeQuote.getStockKey().toString()];if(fromThemeQuote==null||fromThemeQuote==undefined){return;}
themeQuote.setCallPut(fromThemeQuote.getCallPut());themeQuote.setClose(fromThemeQuote.getClose());themeQuote.setDailyChange(fromThemeQuote.getDailyChange());themeQuote.setDividend(fromThemeQuote.getDividend());themeQuote.setDividendDate(fromThemeQuote.getDividendDate());themeQuote.setDisplayKey(fromThemeQuote.getDisplayKey());themeQuote.setEarningPerShare(fromThemeQuote.getEarningPerShare());themeQuote.setExchangeName(fromThemeQuote.getExchangeName());themeQuote.setImpliedVolatility(fromThemeQuote.getImpliedVolatility());themeQuote.setIssuerName(fromThemeQuote.getIssuerName());themeQuote.setHigh(fromThemeQuote.getHigh());themeQuote.setLast(fromThemeQuote.getLast());themeQuote.setLastChangePercent(fromThemeQuote.getLastChangePercent());themeQuote.setReadableLastChangePercent(fromThemeQuote.getReadableLastChangePercent());themeQuote.setLow(fromThemeQuote.getLow());themeQuote.setName(fromThemeQuote.getName());themeQuote.setMaturity(fromThemeQuote.getMaturity());themeQuote.setMultiUnderlyings(fromThemeQuote.isMultiUnderlyings());themeQuote.setOpen(fromThemeQuote.getOpen());themeQuote.setOpenEnded(fromThemeQuote.isOpenEnded());themeQuote.setPriceEarning(fromThemeQuote.getPriceEarning());themeQuote.setStrike(fromThemeQuote.getStrike());themeQuote.setSymbol(fromThemeQuote.getSymbol());themeQuote.setTermsheetUrl(fromThemeQuote.getTermsheetUrl());themeQuote.setType(fromThemeQuote.getType());themeQuote.setUnderlyingName(fromThemeQuote.getUnderlyingName());themeQuote.setVolume(fromThemeQuote.getVolume());};prototype.updateThemeIndex=function(themeQuoteMap){if(themeQuoteMap==null||themeQuoteMap==undefined){if(sq.ithemes.Constant.DEBUG){console.log("No details for theme!");}
return;}
var index=this.themeDetail.getIndex();if(index==null||index==undefined){return;}
this.updateThemeQuote(index,themeQuoteMap);this.handlebarsContext["index"]=this.themeDetail.getIndex();};},{handlebarsContext:{name:"Map",arguments:[null,"Object"]},iThemeDetail:"sq.ithemes.IThemeDetail",themeDetail:"sq.ithemes.ThemeDetail",cache:"Cache"},{});
stjs.ns("sq.ithemes");sq.ithemes.MarketZone=stjs.enumeration("World","SwissMarket","EuropeanMarket","USMarket","AsianMarket","Unknown");
stjs.ns("sq.ithemes");sq.ithemes.MarketZoneUtil=function(){};sq.ithemes.MarketZoneUtil=stjs.extend(sq.ithemes.MarketZoneUtil,null,[],function(constructor,prototype){constructor.findMarketZone=function(code){switch(code){case 1:return sq.ithemes.MarketZone.World;case 2:return sq.ithemes.MarketZone.SwissMarket;case 3:return sq.ithemes.MarketZone.EuropeanMarket;case 4:return sq.ithemes.MarketZone.USMarket;case 5:return sq.ithemes.MarketZone.AsianMarket;default:return sq.ithemes.MarketZone.Unknown;}};constructor.getCode=function(marketZone){switch(marketZone){case sq.ithemes.MarketZone.World:return 1;case sq.ithemes.MarketZone.SwissMarket:return 2;case sq.ithemes.MarketZone.EuropeanMarket:return 3;case sq.ithemes.MarketZone.USMarket:return 4;case sq.ithemes.MarketZone.AsianMarket:return 5;default:return-1;}};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeRisk=stjs.enumeration("Low","Mid","High","Unknown");
stjs.ns("sq.ithemes");sq.ithemes.ThemeQuote=function(){};sq.ithemes.ThemeQuote=stjs.extend(sq.ithemes.ThemeQuote,null,[],function(constructor,prototype){constructor.CALL_PUT_PROP="callPut";constructor.STRIKE_PROP="strike";constructor.MATURITY_PROP="maturity";constructor.ISSUER_PROP="issuerName";constructor.STOCK_EXCHANGE_PROP="exchangeName";constructor.VOLATILITY_PROP="impliedVolatility";constructor.CLOSE_PROP="close";constructor.TYPE_PROP="type";constructor.OPEN_PROP="open";constructor.HIGH_PROP="high";constructor.LOW_PROP="low";constructor.VOLUME_PROP="volume";constructor.DIVIDEND_PROP="dividend";constructor.DIVIDEND_DATE_PROP="dividendDate";constructor.EARNING_PER_SHARE_PROP="earningPerShare";constructor.PRICE_EARNING_PROP="priceEarning";prototype.callPut=null;prototype.close=null;prototype.dailyChange=null;prototype.dividend=null;prototype.dividendDate=null;prototype.earningPerShare=null;prototype.exchangeName=null;prototype.impliedVolatility=null;prototype.issuerName=null;prototype.high=null;prototype.last=null;prototype.lastChangePercent=null;prototype.readableLastChangePercent=null;prototype.low=null;prototype.name=null;prototype.maturity=null;prototype.open=null;prototype.openEnded=null;prototype.priceEarning=null;prototype.stockKey=null;prototype.strike=null;prototype.symbol=null;prototype.termsheetUrl=null;prototype.type=null;prototype.multiUnderlyings=null;prototype.underlyingName=null;prototype.volume=null;prototype.displayKey=null;prototype.weight=null;prototype.getCallPut=function(){return this.callPut;};prototype.setCallPut=function(callPut){this.callPut=callPut;};prototype.getClose=function(){return this.close;};prototype.setClose=function(close){this.close=close;};prototype.getDailyChange=function(){return this.dailyChange;};prototype.setDailyChange=function(dailyChange){this.dailyChange=dailyChange;};prototype.getDividend=function(){return this.dividend;};prototype.setDividend=function(dividend){this.dividend=dividend;};prototype.getDividendDate=function(){return this.dividendDate;};prototype.setDividendDate=function(dividendDate){this.dividendDate=dividendDate;};prototype.getEarningPerShare=function(){return this.earningPerShare;};prototype.setEarningPerShare=function(earningPerShare){this.earningPerShare=earningPerShare;};prototype.getExchangeName=function(){return this.exchangeName;};prototype.setExchangeName=function(exchangeName){this.exchangeName=exchangeName;};prototype.getImpliedVolatility=function(){return this.impliedVolatility;};prototype.setImpliedVolatility=function(impliedVolatility){this.impliedVolatility=impliedVolatility;};prototype.getIssuerName=function(){return this.issuerName;};prototype.setIssuerName=function(issuerName){this.issuerName=issuerName;};prototype.getHigh=function(){return this.high;};prototype.setHigh=function(high){this.high=high;};prototype.getLast=function(){return this.last;};prototype.setLast=function(last){this.last=last;};prototype.getLastChangePercent=function(){return this.lastChangePercent;};prototype.setLastChangePercent=function(lastChangePercent){this.lastChangePercent=lastChangePercent;};prototype.getReadableLastChangePercent=function(){return this.readableLastChangePercent;};prototype.setReadableLastChangePercent=function(readableLastChangePercent){this.readableLastChangePercent=readableLastChangePercent;};prototype.getLow=function(){return this.low;};prototype.setLow=function(low){this.low=low;};prototype.getName=function(){return this.name;};prototype.setName=function(name){this.name=name;};prototype.getMaturity=function(){return this.maturity;};prototype.setMaturity=function(maturity){this.maturity=maturity;};prototype.getOpen=function(){return this.open;};prototype.setOpen=function(open){this.open=open;};prototype.isOpenEnded=function(){return this.openEnded;};prototype.setOpenEnded=function(openEnded){this.openEnded=openEnded;};prototype.getPriceEarning=function(){return this.priceEarning;};prototype.setPriceEarning=function(priceEarning){this.priceEarning=priceEarning;};prototype.getStockKey=function(){return this.stockKey;};prototype.setStockKey=function(stockKey){this.stockKey=stockKey;};prototype.getStrike=function(){return this.strike;};prototype.setStrike=function(strike){this.strike=strike;};prototype.getSymbol=function(){return this.symbol;};prototype.setSymbol=function(symbol){this.symbol=symbol;};prototype.getTermsheetUrl=function(){return this.termsheetUrl;};prototype.setTermsheetUrl=function(termsheetUrl){this.termsheetUrl=termsheetUrl;};prototype.getType=function(){return this.type;};prototype.setType=function(type){this.type=type;};prototype.isMultiUnderlyings=function(){return this.multiUnderlyings;};prototype.setMultiUnderlyings=function(multiUnderlyings){this.multiUnderlyings=multiUnderlyings;};prototype.getUnderlyingName=function(){return this.underlyingName;};prototype.setUnderlyingName=function(underlyingName){this.underlyingName=underlyingName;};prototype.getVolume=function(){return this.volume;};prototype.setVolume=function(volume){this.volume=volume;};prototype.getDisplayKey=function(){return this.displayKey;};prototype.setDisplayKey=function(displayKey){this.displayKey=displayKey;};prototype.getWeight=function(){return this.weight;};prototype.setWeight=function(weight){this.weight=weight;};},{dividendDate:"Date",maturity:"Date",stockKey:"sq.ithemes.StockKey",type:{name:"Enum",arguments:["sq.ithemes.SecurityType"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeRiskUtil=function(){};sq.ithemes.ThemeRiskUtil=stjs.extend(sq.ithemes.ThemeRiskUtil,null,[],function(constructor,prototype){constructor.THEME_RISK_LOW=1;constructor.THEME_RISK_MID=2;constructor.THEME_RISK_HIGH=3;constructor.THEME_RISK_UNKNOWN=-1;constructor.fromCode=function(code){switch(code){case sq.ithemes.ThemeRiskUtil.THEME_RISK_LOW:return sq.ithemes.ThemeRisk.Low;case sq.ithemes.ThemeRiskUtil.THEME_RISK_MID:return sq.ithemes.ThemeRisk.Mid;case sq.ithemes.ThemeRiskUtil.THEME_RISK_HIGH:return sq.ithemes.ThemeRisk.High;default:return sq.ithemes.ThemeRisk.Unknown;}};constructor.getCode=function(risk){switch(risk){case sq.ithemes.ThemeRisk.Low:return sq.ithemes.ThemeRiskUtil.THEME_RISK_LOW;case sq.ithemes.ThemeRisk.Mid:return sq.ithemes.ThemeRiskUtil.THEME_RISK_MID;case sq.ithemes.ThemeRisk.High:return sq.ithemes.ThemeRiskUtil.THEME_RISK_HIGH;default:return sq.ithemes.ThemeRiskUtil.THEME_RISK_UNKNOWN;}};constructor.getLabelFromCode=function(code,i18n){var risk=sq.ithemes.ThemeRiskUtil.fromCode(code);return sq.ithemes.ThemeRiskUtil.getLabel(risk,i18n);};constructor.getLabel=function(themeRisk,i18n){switch(themeRisk){case sq.ithemes.ThemeRisk.Low:return i18n.tileLowRisk();case sq.ithemes.ThemeRisk.Mid:return i18n.tileMidRisk();case sq.ithemes.ThemeRisk.High:return i18n.tileHighRisk();default:return"";}};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeStatus=stjs.enumeration("NEW","SUBMITTED","PUBLISHED");
stjs.ns("sq.ithemes");sq.ithemes.ThemeStatusUtil=stjs.enumeration("NEW","SUBMITTED","PUBLISHED");
stjs.ns("sq.ithemes");sq.ithemes.ThemeTerm=stjs.enumeration("Short","Mid","Long","Unknown");
stjs.ns("sq.ithemes");sq.ithemes.ThemeTermUtil=function(){};sq.ithemes.ThemeTermUtil=stjs.extend(sq.ithemes.ThemeTermUtil,null,[],function(constructor,prototype){constructor.fromCode=function(code){switch(code){case 1:return sq.ithemes.ThemeTerm.Short;case 2:return sq.ithemes.ThemeTerm.Mid;case 3:return sq.ithemes.ThemeTerm.Long;default:return sq.ithemes.ThemeTerm.Unknown;}};constructor.getCode=function(term){switch(term){case sq.ithemes.ThemeTerm.Short:return 1;case sq.ithemes.ThemeTerm.Mid:return 2;case sq.ithemes.ThemeTerm.Long:return 3;default:return-1;}};constructor.getLabel=function(themeTerm,i18n){switch(themeTerm){case sq.ithemes.ThemeTerm.Short:return i18n.tileShortTerm();case sq.ithemes.ThemeTerm.Mid:return i18n.tileMidTerm();case sq.ithemes.ThemeTerm.Long:return i18n.tileLongTerm();default:return"";}};constructor.getLabelFromCode=function(code,i18n){return sq.ithemes.ThemeTermUtil.getLabel(sq.ithemes.ThemeTermUtil.fromCode(code),i18n);};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemePerformanceHisto=function(){};sq.ithemes.ThemePerformanceHisto=stjs.extend(sq.ithemes.ThemePerformanceHisto,null,[],function(constructor,prototype){prototype.themeId=null;prototype.dateStamp=null;prototype.portfolioAmount=null;prototype.dailyPerformance=null;prototype.overallPerformance=null;prototype.getThemeId=function(){return this.themeId;};prototype.setThemeId=function(themeId){this.themeId=themeId;};prototype.getDateStamp=function(){return this.dateStamp;};prototype.setDateStamp=function(dateStamp){this.dateStamp=dateStamp;};prototype.getPortfolioAmount=function(){return this.portfolioAmount;};prototype.setPortfolioAmount=function(portfolioAmount){this.portfolioAmount=portfolioAmount;};prototype.getDailyPerformance=function(){return this.dailyPerformance;};prototype.setDailyPerformance=function(dailyPerformance){this.dailyPerformance=dailyPerformance;};prototype.getOverallPerformance=function(){return this.overallPerformance;};prototype.setOverallPerformance=function(overallPerformance){this.overallPerformance=overallPerformance;};},{dateStamp:"Date"},{});
stjs.ns("sq.ithemes");sq.ithemes.RelatedTheme=function(){};sq.ithemes.RelatedTheme=stjs.extend(sq.ithemes.RelatedTheme,null,[],function(constructor,prototype){prototype.themeId=null;prototype.title=null;prototype.creationDate=null;prototype.modificationDate=null;prototype.inceptionDate=null;prototype.status=null;prototype.risk=null;prototype.term=null;prototype.dailyPerformance=null;prototype.slidingMonthPerformance=null;prototype.slidingQuarterPerformance=null;prototype.slidingHalfyearPerformance=null;prototype.slidingYearPerformance=null;prototype.overallPerformance=null;prototype.available=false;prototype.nameMainThemeCategory=null;prototype.nameSecondThemeCategory=null;prototype.nameThirdThemeCategory=null;prototype.color=null;},{},{});
stjs.ns("sq.ithemes");sq.ithemes.PerformanceHisto=function(){};sq.ithemes.PerformanceHisto=stjs.extend(sq.ithemes.PerformanceHisto,null,[],function(constructor,prototype){prototype.backupFlag=null;prototype.dailyPerformance=null;prototype.dateStamp=null;prototype.dividendYield=null;prototype.overallPerformance=null;prototype.portfolioAmount=null;prototype.slidingMonthPerformance=null;prototype.slidingQuarterPerformance=null;prototype.themeId=null;},{},{});
stjs.ns("sq.ithemes");sq.ithemes.SecurityRaw=function(){};sq.ithemes.SecurityRaw=stjs.extend(sq.ithemes.SecurityRaw,null,[],function(constructor,prototype){prototype.callPut=null;prototype.close=null;prototype.dailyChange=null;prototype.dividend=null;prototype.dividendDate=null;prototype.earningPerShare=null;prototype.exchangeName=null;prototype.issuerName=null;prototype.high=null;prototype.last=null;prototype.lastChangePercent=null;prototype.low=null;prototype.name=null;prototype.maturityDate=null;prototype.open=null;prototype.openEnded=null;prototype.priceEarning=null;prototype.stockKey=null;prototype.isin=null;prototype.stockExchange=null;prototype.currency=null;prototype.strike=null;prototype.symbol=null;prototype.termsheetUrl=null;prototype.type=null;prototype.volume=null;prototype.volatility=null;prototype.underlyings=null;prototype.weight=null;},{stockKey:"sq.ithemes.StockKeyRaw",type:{name:"Enum",arguments:["sq.ithemes.SecurityType"]},underlyings:{name:"Array",arguments:["sq.ithemes.UnderlyingRaw"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.InvestmentThemeRaw=function(){};sq.ithemes.InvestmentThemeRaw=stjs.extend(sq.ithemes.InvestmentThemeRaw,null,[],function(constructor,prototype){prototype.themeId=null;prototype.title=null;prototype.shortDescription=null;prototype.longDescription=null;prototype.creationDate=null;prototype.modificationDate=null;prototype.inceptionDate=null;prototype.mainThemeCategory=null;prototype.secondThemeCategory=null;prototype.thirdThemeCategory=null;prototype.status=null;prototype.risk=null;prototype.term=null;prototype.geographicalZone=null;prototype.imageUrl=null;prototype.largeTile=null;prototype.dailyPerformance=null;prototype.slidingMonthPerformance=null;prototype.slidingQuarterPerformance=null;prototype.slidingHalfyearPerformance=null;prototype.slidingYearPerformance=null;prototype.overallPerformance=null;prototype.structuredProduct=null;prototype.index=null;prototype.dividendYield=null;prototype.portfolio=null;prototype.performanceHistos=null;prototype.nameMainThemeCategory=null;prototype.nameSecondThemeCategory=null;prototype.nameThirdThemeCategory=null;prototype.color=null;prototype.relatedThemes=null;prototype.titleForPiwik=null;prototype.trending=null;prototype.promoted=null;prototype.performanceBasedOnStructuredProduct=null;},{structuredProduct:"sq.ithemes.SecurityRaw",index:"sq.ithemes.SecurityRaw",portfolio:{name:"Array",arguments:["sq.ithemes.SecurityRaw"]},performanceHistos:{name:"Array",arguments:["sq.ithemes.PerformanceHisto"]},relatedThemes:{name:"Array",arguments:["sq.ithemes.RelatedTheme"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.IThemesConfiguration=function(){};sq.ithemes.IThemesConfiguration=stjs.extend(sq.ithemes.IThemesConfiguration,null,[],function(constructor,prototype){prototype.language=null;prototype.getLanguage=function(){return this.language;};prototype.setLanguage=function(language){this.language=language;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.IThemesDataProvider=function(config){this.update(config);};sq.ithemes.IThemesDataProvider=stjs.extend(sq.ithemes.IThemesDataProvider,null,[],function(constructor,prototype){prototype.dataStorage=null;prototype.config=null;prototype.requestId=0;prototype.currentReturnedRequestNumber=0;constructor.getProvider=function(config){return null;};prototype.getData=function(callback0,errorCallback){};prototype.update=function(config){};prototype.getDataStorage=function(){return this.dataStorage;};prototype.setDataStorage=function(ds){this.dataStorage=ds;};prototype.getRequestId=function(){return this.requestId;};prototype.setRequestId=function(requestId){this.requestId=requestId;};prototype.getCurrentReturnedRequestNumber=function(){return this.currentReturnedRequestNumber;};prototype.setCurrentReturnedRequestNumber=function(currentReturnedRequestNumber){this.currentReturnedRequestNumber=currentReturnedRequestNumber;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeDetailServiceDataProvider=function(config,conf){sq.ithemes.IThemesDataProvider.call(this,config);this.configuration=conf;};sq.ithemes.ThemeDetailServiceDataProvider=stjs.extend(sq.ithemes.ThemeDetailServiceDataProvider,sq.ithemes.IThemesDataProvider,[],function(constructor,prototype){prototype.configuration=null;prototype.doThemesDetailsRestRequest=function(callback0,errorCallback){var self=this;this.requestId++;var currentRequestId=this.requestId;var setDataCallback=function(data,metadata){if(self.requestId==currentRequestId){self.updateData(data);if(callback0!=null){callback0();}}};var request=new sq.ithemes.ThemeDetailSearchRequest(this.dataStorage);request.makeRequest(setDataCallback,errorCallback);};prototype.updateDividendsFromITConfig=function(theme){var themeId=theme.themeId;var dividend=this.configuration.dividendsMap.map[themeId];if(dividend!=null){theme.dividendYield=Double.parseDouble(dividend);}
return theme;};prototype.updateData=function(data){var response;if(stjs.isInstanceOf(data.constructor,String)){response=stjs.parseJSON(data,sq.ithemes.InvestmentThemeRaw);}else{response=data;}
if(response==null){return;}
response=this.updateDividendsFromITConfig(response);var themeDetail=this.buildThemeDetail(response);this.dataStorage.updateThemeDetails(themeDetail);};prototype.buildThemeDetail=function(investmentThemeResult){var themeDetail=new sq.ithemes.ThemeDetail();themeDetail.setThemeId(investmentThemeResult.themeId);themeDetail.setTitle(investmentThemeResult.title);themeDetail.setShortDescription(investmentThemeResult.shortDescription);themeDetail.setLongDescription(investmentThemeResult.longDescription);themeDetail.setDailyPerformance(investmentThemeResult.dailyPerformance);themeDetail.setSlidingMonthPerformance(investmentThemeResult.slidingMonthPerformance);themeDetail.setSlidingQuarterPerformance(investmentThemeResult.slidingQuarterPerformance);themeDetail.setSlidingHalfyearPerformance(investmentThemeResult.slidingHalfyearPerformance);themeDetail.setSlidingYearPerformance(investmentThemeResult.slidingYearPerformance);themeDetail.setOverallPerformance(investmentThemeResult.overallPerformance);themeDetail.setDividendYield(investmentThemeResult.dividendYield);var displayPerformance=investmentThemeResult.slidingMonthPerformance==null?investmentThemeResult.overallPerformance:investmentThemeResult.slidingMonthPerformance;themeDetail.setDisplayPerformance(displayPerformance);themeDetail.setGeographicalZone(investmentThemeResult.geographicalZone);themeDetail.setImageUrl(investmentThemeResult.imageUrl);themeDetail.setLargeTile(investmentThemeResult.largeTile);themeDetail.setStatus(investmentThemeResult.status);themeDetail.setRisk(investmentThemeResult.risk);themeDetail.setTerm(investmentThemeResult.term);themeDetail.setRiskClass(sq.ithemes.ThemeRiskUtil.fromCode(themeDetail.getRisk()).name().toLowerCase());themeDetail.setTermClass(sq.ithemes.ThemeTermUtil.fromCode(themeDetail.getTerm()).name().toLowerCase());themeDetail.setRiskText(sq.ithemes.ThemeRiskUtil.getLabelFromCode(themeDetail.getRisk(),this.dataStorage.getiThemeDetail().constructor.i18n));themeDetail.setTermText(sq.ithemes.ThemeTermUtil.getLabelFromCode(themeDetail.getTerm(),this.dataStorage.getiThemeDetail().constructor.i18n));themeDetail.setMainCategory(investmentThemeResult.mainThemeCategory);themeDetail.setSecondCategory(investmentThemeResult.secondThemeCategory);themeDetail.setThirdCategory(investmentThemeResult.thirdThemeCategory);themeDetail.setModificationDate(this.parseIsoDate(investmentThemeResult.modificationDate));themeDetail.setCreationDate(this.parseIsoDate(investmentThemeResult.creationDate));themeDetail.setInceptionDate(this.parseIsoDate(investmentThemeResult.inceptionDate));if(investmentThemeResult.portfolio!=null){var quotes=[];for(var i=0;i<investmentThemeResult.portfolio.length;i++){quotes.push(this.buildThemeQuote(investmentThemeResult.portfolio[i]));}
quotes.sort(function(a,b){var diff=b.getWeight()-a.getWeight();if(diff>0){return 1;}else if(diff==0){return 0;}else{return-1;}});themeDetail.setPortfolio(quotes);themeDetail.setStructuredProduct(this.buildThemeQuote(investmentThemeResult.structuredProduct));themeDetail.setIndex(this.buildThemeQuote(investmentThemeResult.index));}
themeDetail.setColor(investmentThemeResult.color);themeDetail.setNameMainThemeCategory(investmentThemeResult.nameMainThemeCategory);themeDetail.setNameSecondThemeCategory(investmentThemeResult.nameSecondThemeCategory);themeDetail.setNameThirdThemeCategory(investmentThemeResult.nameThirdThemeCategory);themeDetail.setPerformanceBasedOnStructuredProduct(investmentThemeResult.performanceBasedOnStructuredProduct);themeDetail.setPerformanceCurrency(investmentThemeResult.structuredProduct!=null&&investmentThemeResult.performanceBasedOnStructuredProduct?investmentThemeResult.structuredProduct.currency:"CHF");if(investmentThemeResult.performanceHistos!=null){var that=this;var performanceHistoArray=investmentThemeResult.performanceHistos.map(function(ph,aLong,strings){var result=new sq.ithemes.ThemePerformanceHisto();result.setDailyPerformance(ph.dailyPerformance);result.setDateStamp(that.parseIsoDate(ph.dateStamp));result.setOverallPerformance(ph.overallPerformance);result.setPortfolioAmount(ph.portfolioAmount);result.setThemeId(ph.themeId);return result;});themeDetail.setPerformanceHistos(performanceHistoArray);}
if(investmentThemeResult.relatedThemes!=null&&investmentThemeResult.relatedThemes!=undefined){var relatedThemes=[];for(var i=0;i<investmentThemeResult.relatedThemes.length;i++){relatedThemes.push(this.buildRelatedTheme(investmentThemeResult.relatedThemes[i]));}
themeDetail.setRelatedThemes(relatedThemes);}
themeDetail.setTrending(investmentThemeResult.trending);return themeDetail;};prototype.buildThemeQuote=function(rawSecurity){if(rawSecurity==null){return null;}
var tq=new sq.ithemes.ThemeQuote();tq.setStockKey(new sq.ithemes.StockKey(rawSecurity.isin,rawSecurity.stockExchange,rawSecurity.currency));tq.setWeight(rawSecurity.weight);tq.setName(rawSecurity.name);return tq;};prototype.buildRelatedTheme=function(relatedTheme){var themeDetail=new sq.ithemes.ThemeDetail();themeDetail.setThemeId(relatedTheme.themeId);themeDetail.setTitle(relatedTheme.title);themeDetail.setDailyPerformance(relatedTheme.dailyPerformance);themeDetail.setSlidingMonthPerformance(relatedTheme.slidingMonthPerformance);themeDetail.setSlidingQuarterPerformance(relatedTheme.slidingQuarterPerformance);themeDetail.setSlidingHalfyearPerformance(relatedTheme.slidingHalfyearPerformance);themeDetail.setSlidingYearPerformance(relatedTheme.slidingYearPerformance);themeDetail.setOverallPerformance(relatedTheme.overallPerformance);var displayPerformance=relatedTheme.slidingMonthPerformance==null?relatedTheme.overallPerformance:relatedTheme.slidingMonthPerformance;themeDetail.setDisplayPerformance(displayPerformance);themeDetail.setStatus(relatedTheme.status);themeDetail.setRisk(relatedTheme.risk);themeDetail.setTerm(relatedTheme.term);themeDetail.setModificationDate(this.parseIsoDate(relatedTheme.modificationDate));themeDetail.setCreationDate(this.parseIsoDate(relatedTheme.creationDate));themeDetail.setInceptionDate(this.parseIsoDate(relatedTheme.inceptionDate));themeDetail.setColor(relatedTheme.color);themeDetail.setNameMainThemeCategory(relatedTheme.nameMainThemeCategory);themeDetail.setNameSecondThemeCategory(relatedTheme.nameSecondThemeCategory);themeDetail.setNameThirdThemeCategory(relatedTheme.nameThirdThemeCategory);return themeDetail;};prototype.parseIsoDate=function(date){return moment(date).toDate();};prototype.getData=function(callback0,errorCallback){this.doThemesDetailsRestRequest(callback0,errorCallback);};prototype.update=function(config){};},{configuration:"sq.ithemes.InvestmentThemeConfig"},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemePortfolioServiceDataProvider=function(config){sq.ithemes.IThemesDataProvider.call(this,config);};sq.ithemes.ThemePortfolioServiceDataProvider=stjs.extend(sq.ithemes.ThemePortfolioServiceDataProvider,sq.ithemes.IThemesDataProvider,[],function(constructor,prototype){prototype.doThemesDetailsRestRequest=function(callback0,errorCallback){var self=this;this.requestId++;var currentRequestId=this.requestId;var setDataCallback=function(data,metadata){if(self.requestId==currentRequestId){self.updateData(data);if(callback0!=null){callback0();}}};var request=new sq.ithemes.ThemePortfolioSearchRequest(this.dataStorage);request.makeRequest(setDataCallback,errorCallback);};prototype.updateData=function(data){if(data==null){return;}
var themeQuoteMap=this.buildThemeQuoteMap(data);this.dataStorage.updateThemePortfolio(themeQuoteMap);this.dataStorage.updateThemeStructuredProduct(themeQuoteMap);this.dataStorage.updateThemeIndex(themeQuoteMap);};prototype.buildThemeQuoteMap=function(securities){var themeQuoteMap={};if(securities==null||securities==undefined){return themeQuoteMap;}
for(var i=0;i<securities.length;i++){var quote=securities[i];var themeQuote=new sq.ithemes.ThemeQuote();themeQuote.setName(quote.name);themeQuote.setType(quote.type);themeQuote.setSymbol(quote.symbol);themeQuote.setLast(quote.last);themeQuote.setLastChangePercent(quote.lastChangePercent);themeQuote.setReadableLastChangePercent(sq.ithemes.FormatterUtil.formatPercentWithoutMultiply(themeQuote.getLastChangePercent()));themeQuote.setClose(quote.close);themeQuote.setOpen(quote.open);themeQuote.setHigh(quote.high);themeQuote.setLow(quote.low);themeQuote.setVolume(quote.volume);themeQuote.setDividend(quote.dividend);themeQuote.setDividendDate(moment(quote.dividendDate).toDate());themeQuote.setEarningPerShare(quote.earningPerShare);themeQuote.setPriceEarning(quote.priceEarning);themeQuote.setCallPut(quote.callPut);themeQuote.setStrike(quote.strike);themeQuote.setMaturity(moment(quote.maturityDate).toDate());var rawUnderlyings=quote.underlyings;if(rawUnderlyings!=null&&rawUnderlyings.length>0){themeQuote.setMultiUnderlyings(rawUnderlyings.length>1);themeQuote.setUnderlyingName(rawUnderlyings[0].name);}
themeQuote.setIssuerName(quote.issuerName);themeQuote.setImpliedVolatility(quote.volatility);themeQuote.setTermsheetUrl(quote.termsheetUrl);themeQuote.setDailyChange(quote.dailyChange);themeQuote.setExchangeName(quote.exchangeName);themeQuote.setOpenEnded(quote.openEnded);var stockKey=new sq.ithemes.StockKey(quote.stockKey.isin,quote.stockKey.exchangeId,quote.stockKey.currency);themeQuote.setStockKey(stockKey);var displayKey=stockKey.toString();var exchangeId=stockKey.getExchangeId();if("GBP".equals(stockKey.getCurrency())){if(exchangeId==36||exchangeId==361||exchangeId==272||exchangeId==507){var convertedCurrency="GBX";if(sq.ithemes.Constant.SHOW_GBP_AS_GBX){themeQuote.setLast(themeQuote.getLast()*100);}
displayKey=new sq.ithemes.StockKey(stockKey.getIsin(),exchangeId,convertedCurrency).toString();}}
themeQuote.setDisplayKey(displayKey);themeQuoteMap[displayKey]=themeQuote;}
return themeQuoteMap;};prototype.getData=function(callback0,errorCallback){this.doThemesDetailsRestRequest(callback0,errorCallback);};prototype.update=function(config){};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.AbstractRequest=function(ds){this.ds=ds;this.url=this.createURL(ds);this.type=sq.ithemes.AbstractRequest.HttpMethod.GET.toString();};sq.ithemes.AbstractRequest=stjs.extend(sq.ithemes.AbstractRequest,null,[],function(constructor,prototype){prototype.url=null;prototype.ds=null;prototype.type=null;prototype.makeRequest=function(successCallback,errorCallback){var self=this;$.ajax({cache:true,url:self.url,type:self.type,dataType:this.getDataType(),async:this.getAsync(),beforeSend:self.beforeSend(),complete:self.complete(),success:self.getSuccessCallback(successCallback),error:self.getFailureCallback(errorCallback)});};prototype.getAsync=function(){return true;};constructor.getBaseURL=function(){return window.location.protocol+"//"+window.location.host;};prototype.getDataType=function(){return"json";};prototype.beforeSend=function(){};prototype.complete=function(){};prototype.getSuccessCallback=function(callback){};prototype.getFailureCallback=function(callback0){};prototype.createURL=function(ds){};constructor.HttpMethod=stjs.enumeration("GET","POST","PUT");},{},{});
stjs.ns("sq.ithemes");sq.ithemes.IncreaseTrendingRequest=function(ds){sq.ithemes.AbstractRequest.call(this,ds);this.type=sq.ithemes.AbstractRequest.HttpMethod.PUT.toString();};sq.ithemes.IncreaseTrendingRequest=stjs.extend(sq.ithemes.IncreaseTrendingRequest,sq.ithemes.AbstractRequest,[],function(constructor,prototype){constructor.SERVICE_URL="/service-investment-themes/api/service-investment-themes-v1/themes/";prototype.beforeSend=function(){return null;};prototype.complete=function(){return null;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){if(callback!=null){callback(data,[]);}};};prototype.getFailureCallback=function(callback0){return function(jQueryXHR,s,s2){sq.ithemes.Console.error("Error the theme trending increase");};};prototype.createURL=function(ds){return sq.ithemes.IncreaseTrendingRequest.SERVICE_URL+ds.getThemeId()+"/trend";};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.IndexPerformance=function(timestamp,performance){this.timestamp=timestamp;this.performance=performance;};sq.ithemes.IndexPerformance=stjs.extend(sq.ithemes.IndexPerformance,null,[],function(constructor,prototype){prototype.timestamp=null;prototype.performance=null;prototype.getTimestamp=function(){return this.timestamp;};prototype.setTimestamp=function(timestamp){this.timestamp=timestamp;};prototype.getPerformance=function(){return this.performance;};prototype.setPerformance=function(performance){this.performance=performance;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.IndexChartRequest=function(ds){sq.ithemes.AbstractRequest.call(this,ds);};sq.ithemes.IndexChartRequest=stjs.extend(sq.ithemes.IndexChartRequest,sq.ithemes.AbstractRequest,[],function(constructor,prototype){constructor.SERVICE_URL="/sqi_ws/HistoFromServlet?";prototype.beforeSend=function(){return null;};prototype.complete=function(){return null;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var metadata=[];callback(data,metadata);};};prototype.getFailureCallback=function(callback0){return function(jQueryXHR,s,s2){if(callback0!=null&&callback0!=undefined){callback0();}};};prototype.createURL=function(indexChartStorage){var currentURL=sq.ithemes.IndexChartRequest.SERVICE_URL;var differenceInDays=Math.round(Math.abs((indexChartStorage.getThemeDetail().getInceptionDate().getTime()-(new Date()).getTime())/(24*60*60*1000)));var differenceInWeeks=Math.ceil(differenceInDays/7);currentURL+="key="+indexChartStorage.getThemeDetail().getIndex().getStockKey()+"&ptype=w&pvalue="+differenceInWeeks;return currentURL;};prototype.getDataType=function(){return"text";};prototype.getAsync=function(){return false;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeDetailSearchRequest=function(ds){sq.ithemes.AbstractRequest.call(this,ds);};sq.ithemes.ThemeDetailSearchRequest=stjs.extend(sq.ithemes.ThemeDetailSearchRequest,sq.ithemes.AbstractRequest,[],function(constructor,prototype){constructor.SERVICE_URL="/service-investment-themes/api/service-investment-themes-v1/get-theme";prototype.beforeSend=function(){return null;};prototype.complete=function(){return null;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var metadata=[];callback(data,metadata);};};prototype.getFailureCallback=function(callback0){return function(jQueryXHR,s,s2){sq.ithemes.Console.error("Error getting the theme");if(callback0!=null&&callback0!=undefined){callback0();}};};prototype.createURL=function(ds){var currentURL=sq.ithemes.ThemeDetailSearchRequest.SERVICE_URL;currentURL+="?lang="+ds.getLanguage();currentURL+="&themeId="+ds.getThemeId();return currentURL;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemePortfolioSearchRequest=function(ds){sq.ithemes.AbstractRequest.call(this,ds);};sq.ithemes.ThemePortfolioSearchRequest=stjs.extend(sq.ithemes.ThemePortfolioSearchRequest,sq.ithemes.AbstractRequest,[],function(constructor,prototype){constructor.SERVICE_URL="/service-investment-themes/api/service-investment-themes-v1/get-theme/portfolio";prototype.beforeSend=function(){return null;};prototype.complete=function(){return null;};prototype.getSuccessCallback=function(callback){return function(data,textStatus,jqXHR){var metadata=[];callback(data,metadata);};};prototype.getFailureCallback=function(callback0){return function(jQueryXHR,s,s2){sq.ithemes.Console.error("Error getting the theme portfolio");if(callback0!=null&&callback0!=undefined){callback0();}};};prototype.createURL=function(ds){var currentURL=sq.ithemes.ThemePortfolioSearchRequest.SERVICE_URL;currentURL+="?lang="+ds.getLanguage();currentURL+="&themeId="+ds.getThemeId();return currentURL;};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.RenderableChart=function(){};sq.ithemes.RenderableChart=stjs.extend(sq.ithemes.RenderableChart,null,[],function(constructor,prototype){prototype.render=function(container){};prototype.destroy=function(){};prototype.resize=function(width,height){};},{},{});
stjs.ns("sq.ithemes");sq.ithemes.CanvasChart=function(){};sq.ithemes.CanvasChart=stjs.extend(sq.ithemes.CanvasChart,null,[sq.ithemes.RenderableChart],function(constructor,prototype){prototype.chart=null;prototype.chartOptions=null;prototype.render=function(container){var customChartOptions=ChartOption.getDefault();customChartOptions.setType(Chart.ChartType.LINE.toString());customChartOptions.setTitle("");customChartOptions.setProviderClass(sq.ithemes.ThemeChartDataProvider.NAME);customChartOptions.setEngineModel(new sq.ithemes.ThemeEngineModel());customChartOptions.setStyleModel(new sq.ithemes.ThemeStyleModel());customChartOptions.setPopOverAllowed(false);customChartOptions.setY1AxisPosition(Layout.Position.NONE);customChartOptions.setY2AxisPosition(Layout.Position.LEFT);customChartOptions.setChartPaddingTopPercent(5);customChartOptions.setChartPaddingBottomPercent(5);customChartOptions.setChartPaddingLeftPercent(0);customChartOptions.setGridStyle(GraphStyle.HORIZONTAL_GRID_STYLE);customChartOptions.setChartBorderTop(0);customChartOptions.setChartBorderRight(0);customChartOptions.setChartBorderBottom(0);customChartOptions.setChartBorderLeft(0);customChartOptions.setShowXAxisTicks(true);customChartOptions.setShowYAxisTicks(false);customChartOptions.setxAxisFormatter(new DateTimeFormatter());customChartOptions.setXHighlightLabelFormat(DateTimeFormatter.FORMAT_DEFAULT);this.chartOptions=ChartOption.extend(customChartOptions);DataProviderFactory.getInstance().registerProvider(this.chartOptions.getProviderName(),new sq.ithemes.ThemeChartDataProvider(this.chartOptions));this.chart=new DefaultChart(container,this.chartOptions);};prototype.destroy=function(){if(this.chart!=null){this.chart.pause();this.chart.removeChart();this.chart.getParentElement().empty();}
DataProviderFactory.getInstance().removeProvider(this.chartOptions);};prototype.resize=function(width,height){if(this.chart!=null){this.chart.resize(width,height);}};},{chart:"Chart",chartOptions:"ChartOption"},{});
stjs.ns("sq.ithemes");sq.ithemes.BlockCanvasChart=function(stockKey){this.stockKey=stockKey;};sq.ithemes.BlockCanvasChart=stjs.extend(sq.ithemes.BlockCanvasChart,null,[sq.ithemes.RenderableChart],function(constructor,prototype){constructor.CHART_REFRESH_RATE_IN_SECONDS=60;constructor.nextProviderId=1;prototype.chart=null;prototype.chartOptions=null;prototype.stockKey=null;prototype.render=function(container){var customChartOptions=FinancialChartOption.getDefaultFinancialChartOption();customChartOptions.setAutorefreshIntervalSeconds(sq.ithemes.BlockCanvasChart.CHART_REFRESH_RATE_IN_SECONDS);customChartOptions.setShowVolume(true);customChartOptions.setFrequency("30minute");customChartOptions.setPeriod("2iday");customChartOptions.setPopOverAllowed(false);customChartOptions.setGridStyle("horizontal");customChartOptions.setHighlightType("lines+color");customChartOptions.setShowToolTip(false);customChartOptions.setShowLegend(false);customChartOptions.setDynamicXAxisData(true);customChartOptions.setShowLegendInPopover(false);customChartOptions.setShowPeriodMenu(false);customChartOptions.setShowCompareBox(false);customChartOptions.setGridStyle(GraphStyle.CLASSIC_GRID_STYLE);customChartOptions.setProviderClass(this.generateProviderClassId());customChartOptions.setStocks([new Stock(this.stockKey)]);customChartOptions.setTitle(this.stockKey);this.chartOptions=FinancialChartOption.extendFinancialChartOption(customChartOptions);DataProviderFactory.getInstance().registerProvider(this.chartOptions.getProviderName(),new MobileServiceDataProvider(this.chartOptions));this.chart=new FinancialChart(container,this.chartOptions);};prototype.generateProviderClassId=function(){return this.stockKey+"_"+(sq.ithemes.BlockCanvasChart.nextProviderId++);};prototype.destroy=function(){if(this.chart!=null){this.chart.pause();this.chart.removeChart();this.chart.getParentElement().empty();}
DataProviderFactory.getInstance().removeProvider(this.chartOptions);};prototype.resize=function(width,height){if(this.chart!=null){this.chart.resize(width,height);}};},{chart:"Chart",chartOptions:"FinancialChartOption"},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeChartDataProvider=function(config){DataProvider.call(this);this.config=config;this.performancePoints=[];this.indexPoints=[];};sq.ithemes.ThemeChartDataProvider=stjs.extend(sq.ithemes.ThemeChartDataProvider,DataProvider,[],function(constructor,prototype){constructor.INDEX_CHART_COLOR="#1B4498";constructor.NAME="ThemeChartDataProviderId";prototype.performancePoints=null;prototype.indexPoints=null;prototype.getData=function(data){if(data==null){return;}
this.chartData=data;var performancePointString=this.cache.get(sq.ithemes.Constant.THEME_CHART_POINTS);var indexPointsString=this.cache.get(sq.ithemes.Constant.INDEX_POINTS);if(performancePointString==null||performancePointString.trim().length==0){return;}
this.updateConfig(this.config);var performanceColorStrategy=this.config.getColorStrategy();var colorStop=[0,0];var posC=new ChartColor(ChartColor.ColorType.SIMPLE,[sq.ithemes.ThemeChartDataProvider.INDEX_CHART_COLOR],colorStop);var indexColorStrategy=new ColorStrategy(posC,posC);var series=[];var validity=new Date();var metadata=[];if(this.indexPoints!=null&&this.indexPoints.length>0){var indexSerie=new HistoSerie(Period.HISTO_DEFAULT,indexColorStrategy,null);indexSerie.setData(this.indexPoints,validity,metadata);series.push(indexSerie);}
if(this.performancePoints!=null){var performanceSerie=new HistoSerie(Period.HISTO_DEFAULT,performanceColorStrategy,null);performanceSerie.setData(this.performancePoints,validity,metadata);series.push(performanceSerie);}
this.chartData.setSeries(series);};prototype.updateData=function(performancePoints,indexPoints){this.performancePoints=performancePoints!=null?performancePoints:[];this.indexPoints=indexPoints;this.getData(this.chartData);};prototype.updateConfig=function(config){};prototype.clone=function(){return new sq.ithemes.ThemeChartDataProvider(this.config);};},{performancePoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},indexPoints:{name:"Array",arguments:[{name:"Map",arguments:[null,"Object"]}]},cache:"Cache",config:"ChartOption"},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeY1AxisStyle=function(options){DefaultYAxisStyle.call(this,options);this.labelsHeight=this.fontSize+14;};sq.ithemes.ThemeY1AxisStyle=stjs.extend(sq.ithemes.ThemeY1AxisStyle,DefaultYAxisStyle,[],null,{axisTicksColor:"ChartColor",axisTicksColorGradientParam:{name:"Array",arguments:[null]},labelHighlightColor:"ChartColor",labelHighlightColorGradientParam:{name:"Array",arguments:[null]},style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeLineGraphStyle=function(options){DefaultLineGraphStyle.call(this,options);this.graphLineWidth=2;};sq.ithemes.ThemeLineGraphStyle=stjs.extend(sq.ithemes.ThemeLineGraphStyle,DefaultLineGraphStyle,[],null,{backgroundGridColor:"ChartColor",backgroundGridColorGradientParams:{name:"Array",arguments:[null]},highlightLineColor:"ChartColor",highlightLineColorGradientParams:{name:"Array",arguments:[null]},circleHighlightColor:"ChartColor",circleHighlightColorGradientParams:{name:"Array",arguments:[null]},copyrightColor:"ChartColor",highlightBarMode:{name:"Enum",arguments:["sq.ChartElement.HIGHLIGHT"]},highlightBarColor:"ChartColor",highlightBarColorGradientParams:{name:"Array",arguments:[null]},hoverBarMode:{name:"Enum",arguments:["sq.ChartElement.HOVER"]},hoverBarColor:"ChartColor",hoverBarColorGradientParams:{name:"Array",arguments:[null]},groupBarColor:"ChartColor",groupBarColorGradientParams:{name:"Array",arguments:[null]},areaContourColor:"ChartColor",style:{name:"Map",arguments:[null,"Object"]},position:{name:"Enum",arguments:["Layout.Position"]},textColor:"ChartColor",textColorGradientParams:{name:"Array",arguments:[null]},borderLeftColor:"ChartColor",borderRightColor:"ChartColor",borderTopColor:"ChartColor",borderBottomColor:"ChartColor",backgroundColor:"ChartColor",backgroundColorGradientParams:{name:"Array",arguments:[null]}},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeStyleModel=function(){DefaultStyleModel.call(this);};sq.ithemes.ThemeStyleModel=stjs.extend(sq.ithemes.ThemeStyleModel,DefaultStyleModel,[],function(constructor,prototype){prototype.init=function(options){DefaultStyleModel.prototype.init.call(this,options);this.y1AxisStyle=new sq.ithemes.ThemeY1AxisStyle(options);this.graphStyle=new sq.ithemes.ThemeLineGraphStyle(options);};},{globalStyle:"GlobalStyle",tooltipStyle:"ToolTipStyle",titleStyle:"TitleStyle",xAxisStyle:"AxisStyle",y1AxisStyle:"AxisStyle",y2AxisStyle:"AxisStyle",legendStyle:"LegendStyle",graphStyle:"GraphStyle",drawStyle:"DrawStyle",styles:{name:"Map",arguments:[null,"Style"]}},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeY1AxisEngine=function(options){DefaultY1AxisEngine.call(this,options);this.labelsFormatter=new PercentNumberFormatter();};sq.ithemes.ThemeY1AxisEngine=stjs.extend(sq.ithemes.ThemeY1AxisEngine,DefaultY1AxisEngine,[],null,{STEPS:{name:"Array",arguments:[null]},position:{name:"Enum",arguments:["Layout.Position"]},labelsFormatter:"Formatter",range:{name:"Array",arguments:[null]},labelsPosition:{name:"Array",arguments:[null]},options:"ChartOption"},{});
stjs.ns("sq.ithemes");sq.ithemes.ThemeEngineModel=function(){DefaultEngineModel.call(this);};sq.ithemes.ThemeEngineModel=stjs.extend(sq.ithemes.ThemeEngineModel,DefaultEngineModel,[],function(constructor,prototype){prototype.init=function(options){DefaultEngineModel.prototype.init.call(this,options);this.y1AxisEngine=new sq.ithemes.ThemeY1AxisEngine(options);};},{aggregationStrategy:{name:"Enum",arguments:["AggregationStrategy"]},customMainAxisMinMax:{name:"Array",arguments:[null]},context:"ChartContext",engines:{name:"Map",arguments:[null,"Engine"]},drawEngine:"DrawEngine",tooltipEngine:"ToolTipEngine",titleEngine:"TitleEngine",xAxisEngine:"AxisEngine",y1AxisEngine:"AxisEngine",y2AxisEngine:"AxisEngine",legendEngine:"LegendEngine",graphEngine:"GraphEngine"},{});
stjs.ns("sq.ithemes");sq.ithemes.IThemeDetail=function(language,i18n,conf){this.piwikUrl=conf.piwikUrl;this.constructor.i18n=i18n;this.initHandleBars();var themeId=sq.ithemes.RequestHandlerUtil.getParameterByName(sq.ithemes.Constant.SELECTED_THEME);if(themeId!=null&&themeId.trim().length>0){this.themeDetailsDataStorage=new sq.ithemes.ThemeDetailsDataStorage(this);this.themeDetailsDataStorage.setLanguage(language);this.themeDetailsDataStorage.setThemeId(themeId);var config=new sq.ithemes.IThemesConfiguration();this.themePortfolioServiceDataProvider=new sq.ithemes.ThemePortfolioServiceDataProvider(config);this.themePortfolioServiceDataProvider.setDataStorage(this.themeDetailsDataStorage);this.themeDetailServiceDataProvider=new sq.ithemes.ThemeDetailServiceDataProvider(config,conf);this.themeDetailServiceDataProvider.setDataStorage(this.themeDetailsDataStorage);this.themeDetailServiceDataProvider.getData(this.getOnThemeDetailServiceResponseCallback(),this.getOnRequestErrorCallback());}};sq.ithemes.IThemeDetail=stjs.extend(sq.ithemes.IThemeDetail,null,[],function(constructor,prototype){constructor.ID_THEME_CHART_DESCRIPTION_LEGEND_INDEX="#theme-chart-description-legend-index";constructor.instance=null;prototype.themeDetailsDataStorage=null;prototype.themeDetailServiceDataProvider=null;prototype.themePortfolioServiceDataProvider=null;constructor.i18n=null;prototype.piwikUrl=null;prototype.renderTables=function(){var themeDetail=this.themeDetailsDataStorage.getThemeDetail();if(themeDetail==null){return;}
var structuredProduct=themeDetail.getStructuredProduct();if(structuredProduct!=null){$("#structured-product-table").append(new sq.ithemes.StructuredProductTable(themeDetail.getTitle(),[structuredProduct]).render());}
var portfolio=themeDetail.getPortfolio();if(portfolio!=null&&portfolio.length>0){$("#portfolio-table").append(new sq.ithemes.PortfolioTable(portfolio).render());}};prototype.scrollButtonsHandlers=function(){$(".scroll-to-element").click(function(event,element){var options={};options.duration=1000;var dest=event.target.getAttribute("data-scroll-to");var val={"scrollTop":String.valueOf($("#"+dest).offset().top)};$("body, html").animate(val,options);return false;});};prototype.initHandleBars=function(){var checkCondition=function(v1,operator,v2){switch(operator){case"==":return(v1==v2);case"!=":return(v1!=v2);case"<":return(v1<v2);case"<=":return(v1<=v2);case">":return(v1>v2);case">=":return(v1>=v2);default:return false;}};Handlebars.registerHelper("ifCond",function(v1,op,v2,options){return checkCondition(v1,op,v2)?options.fn(this):options.inverse(this);});Handlebars.registerHelper("formatNumber",function(number,options){return sq.ithemes.FormatterUtil.formatNumber(number);});Handlebars.registerHelper("formatPercentNumber",function(number,options){return sq.ithemes.FormatterUtil.formatPercentValue(number);});Handlebars.registerHelper("formatDate",function(date,options){return moment(date).format("DD/MM/YY");});Handlebars.registerHelper("exists",function(o,options){return o!=null?options.fn(this):options.inverse(this);});};constructor.getInstance=function(lang,i18n,conf,newsletterSubUrl){if(sq.ithemes.IThemeDetail.instance==null){sq.ithemes.IThemeDetail.instance=new sq.ithemes.IThemeDetail(lang,i18n,conf);}
sq.ithemes.IThemeDetail.instance.updateLanguage(lang,i18n);return sq.ithemes.IThemeDetail.instance;};prototype.updateLanguage=function(language,i18n){this.themeDetailsDataStorage.setLanguage(language);this.constructor.i18n=i18n;};prototype.renderSocialIcons=function(){$(".social-icons").append(new sq.ithemes.FacebookSocialButton(this.themeDetailsDataStorage.getThemeDetail()).getButton()).append(new sq.ithemes.TwitterSocialButton(this.themeDetailsDataStorage.getThemeDetail()).getButton()).append(new sq.ithemes.LinkedInSocialButton(this.themeDetailsDataStorage.getThemeDetail()).getButton()).append(new sq.ithemes.SQPulseSocialButton(this.themeDetailsDataStorage.getThemeDetail()).getButton());};prototype.getOnRequestResponseCallback=function(){var self=this;return function(){sq.ithemes.TemplateRenderer.render(self.themeDetailsDataStorage.getHandleBarContext());self.renderSocialIcons();self.renderTables();$(window.document).ready(function(event,element){self.hideSrollToStructuredButton();self.scrollButtonsHandlers();self.enableChart();self.updateChart();self.initTooltip();sq.ithemes.SQAnalyticUtil.initTracking(self.piwikUrl,self.themeDetailsDataStorage.getLanguage(),sq.ithemes.Constant.PIWIK_DETAIL_PAGE_TITLE);return true;});};};prototype.hideSrollToStructuredButton=function(){if(this.themeDetailsDataStorage.getThemeDetail().getStructuredProduct()==null){$(".scroll-to-element[data-scroll-to='structured_product']").hide();}};prototype.initTooltip=function(){var tooltip=$(".tooltip-icon");var tooltipOpt={};tooltipOpt.position={};tooltipOpt.position.my="center bottom-20";tooltipOpt.position.at="left center";tooltipOpt.position.using=function(position,feedback){var left=feedback.target.left-feedback.element.left;$(this).css(position).addClass(feedback.vertical).append("<span class='ui-tooltip__arrow' style='left: "+left+"px'/>");};tooltip.tooltip(tooltipOpt);};prototype.enableChart=function(){var performanceChart=new sq.ithemes.CanvasChart();var $chatContainer=$("#theme-chart-container");performanceChart.render($chatContainer);var themeDetail=this.themeDetailsDataStorage.getThemeDetail();$("#theme-chart-description-legend").html(themeDetail.getTitle());if(themeDetail.getIndex()==null){$(sq.ithemes.IThemeDetail.ID_THEME_CHART_DESCRIPTION_LEGEND_INDEX).hide();}else{$(sq.ithemes.IThemeDetail.ID_THEME_CHART_DESCRIPTION_LEGEND_INDEX).html(themeDetail.getIndex().getName());}
if(themeDetail.getOverallPerformance()>=0){$("#theme-chart-description-legend").addClass("positive");}else{$("#theme-chart-description-legend").addClass("negative");}
var chartWrapper=$("#theme-chart-wrapper");$("#theme-performance-chart").append(chartWrapper);chartWrapper.show();$(window).resize();};prototype.getOnThemeDetailServiceResponseCallback=function(){var self=this;return function(){self.themePortfolioServiceDataProvider.getData(self.getOnRequestResponseCallback(),self.getOnRequestResponseCallback());var themeId=self.themeDetailsDataStorage.getThemeId();var visitedTimes=sq.ithemes.WebUtil.getCookie(themeId);if(visitedTimes.trim().length!=0){return;}
var request=new sq.ithemes.IncreaseTrendingRequest(self.themeDetailsDataStorage);request.makeRequest(function(o,strings){var trending=self.themeDetailsDataStorage.getThemeDetail().getTrending();sq.ithemes.WebUtil.setAutoExpiredCookie(themeId,trending.toString());},null);};};prototype.getOnRequestErrorCallback=function(){return function(){$(".errorBlock").html(sq.ithemes.IThemeDetail.i18n.errorWhileLoadingTheTheme()).addClass("error");};};prototype.updateChart=function(){var that=this;var indexPoints=[];if(that.themeDetailsDataStorage.getThemeDetail().getIndex()==null){this.clearChart();}else{var tr=new sq.ithemes.IndexChartRequest(that.themeDetailsDataStorage);var inceptionDate=that.themeDetailsDataStorage.getThemeDetail().getInceptionDate();tr.makeRequest(function(o,strings){var timeOffset=HistoServletRequest.getLocaleCorrectionTimeOffset();var points=new PipeDelimitedDataProcessor().process(o.toString(),0,null,null,timeOffset);for(var i=0;i<points.length;i++){var point=points[i];var pointMillis=point["x"];if(pointMillis!=null&&pointMillis>=inceptionDate.getTime()){indexPoints.push(point);}}},function(){that.clearChart();$(sq.ithemes.IThemeDetail.ID_THEME_CHART_DESCRIPTION_LEGEND_INDEX).hide();sq.ithemes.Console.error("Data for chart from MultipleIntradayServlet is not received.");});}
var performanceHistos=this.themeDetailsDataStorage.getThemeDetail().getPerformanceHistos();if(performanceHistos==null||performanceHistos.length==0){sq.ithemes.Console.error("Empty performance histo");this.clearChart();$("#theme-chart-wrapper").hide();return;}
var performancePoints=performanceHistos.map(function(performanceHisto,i,strings){return{"x":performanceHisto.getDateStamp(),"y":performanceHisto.getOverallPerformance()*100+100};});performancePoints.sort(function(a,b){return moment(a["x"]).diff(b["x"]);});this.updateChartData(performancePoints,indexPoints);};prototype.clearChart=function(){this.updateChartData(null,null);};prototype.updateChartData=function(performancePoints,indexPoints){if(performancePoints==null||performancePoints.length<1){return;}
var provider=DataProviderFactory.getInstance().retriveProvider(sq.ithemes.ThemeChartDataProvider.NAME);if(provider==null){return;}
var indexPointsNormalized=this.alignPointsByDate(this.normalizeIndexPoints(indexPoints),performancePoints);if(indexPointsNormalized!=null&&indexPointsNormalized.length>0){this.themeDetailsDataStorage.getCache().set(sq.ithemes.Constant.INDEX_POINTS,JSON.stringify(indexPointsNormalized));}
this.themeDetailsDataStorage.getCache().set(sq.ithemes.Constant.THEME_CHART_POINTS,JSON.stringify(performancePoints));provider.updateData(performancePoints,indexPointsNormalized);};prototype.alignPointsByDate=function(indexPointsIn,performancePointsIn){var indexPointsOut=[];var j=0;if(indexPointsIn==null||indexPointsIn.length==0){return indexPointsIn;}
for(var i=0;i<performancePointsIn.length;i++){indexPointsOut.push(indexPointsIn[j]);if(i+1<performancePointsIn.length&&j+1<indexPointsIn.length){var indexPointDate=indexPointsIn[j+1]["x"];var performancePointDate=performancePointsIn[i+1]["x"];if(moment(indexPointDate).diff(performancePointDate,"days",true)<=1.0){j++;}}}
return indexPointsOut;};prototype.normalizeIndexPoints=function(indexPoints){if(indexPoints==null||indexPoints.length<1){return null;}
var outPoints=[];var refPrice=indexPoints[0]["y"];var ratio=(refPrice!=0)?(100.0/refPrice):1.0;for(var i=0;i<indexPoints.length;i++){var point=indexPoints[i];var normalizedPoint={"x":new Date(point["x"]),"y":ratio*point["y"]};outPoints.push(normalizedPoint);}
return outPoints;};constructor.Feedback=function(){};constructor.Feedback=stjs.extend(constructor.Feedback,null,[],function(constructor,prototype){prototype.element=null;prototype.horizontal=null;prototype.important=null;prototype.target=null;prototype.vertical=null;},{element:"Position",target:"Position"},{});},{instance:"sq.ithemes.IThemeDetail",themeDetailsDataStorage:"sq.ithemes.ThemeDetailsDataStorage",themeDetailServiceDataProvider:"sq.ithemes.ThemeDetailServiceDataProvider",themePortfolioServiceDataProvider:"sq.ithemes.ThemePortfolioServiceDataProvider",i18n:"sq.ithemes.Messages"},{});
